STEAM GROUP
Left 4 Dead 2 Workshop Beta L4D2WSB
STEAM GROUP
Left 4 Dead 2 Workshop Beta L4D2WSB
5
IN-GAME
36
ONLINE
Founded
15 October, 2012
Fish 13 Feb, 2013 @ 8:00am
How to find out whether survivor is bot or connected player (VScripts)
I have my shovel out and have been doing some digging!

So far I have found a couple of functions. One of these functions is extremely handy, so much so that I felt like sharing.

IsPlayerABot( player ) : bool - returns true if player is a bot.

I don't know if this has been found before. I certainly haven't came across it.

Example:
// Simple bot finder by The Fish survivors <- { nick = Entities.FindByName(null, "!nick") // Store Nick in table ellis = Entities.FindByName(null, "!ellis")// Store Ellis in table rochelle = Entities.FindByName(null, "!rochelle")// Store Rochelle in table coach = Entities.FindByName(null, "!coach")// Store Coach in table } foreach( name, survivor in survivors) {// Loop through each value in survivors if ( IsPlayerABot( survivor ) ){// Check to see if the current value is a bot printl(name+" is a bot!"); // If it is, then print it to console. survivor.SetHealth(50000);// Make the bot a super bot! }else{ printl( name+" is being controlled by "+survivor.GetPlayerName() ); } }
Last edited by Fish; 13 Feb, 2013 @ 10:17am
< >
Showing 1-7 of 7 comments
bruhlord 13 Feb, 2013 @ 10:43am 
You can find more at the wiki page: https://developer.valvesoftware.com/wiki/List_of_L4D2_Script_Functions

Another one that's pretty useful function is IsTankInPlay(). It's pretty handy for game balance.
shotgunefx 13 Feb, 2013 @ 12:22pm 
There's also .
.GetActiveWeapon()
.GetZombieType() // Survivor is type 9,
Considering this being Beta, I didn't know if I should be editing the wiki or not
bruhlord 13 Feb, 2013 @ 1:13pm 
I'd recommend waiting until we're out of beta and the tool is released before editing the wiki.
Tedgrocer 13 Feb, 2013 @ 4:57pm 
Sounds like a good idea. I did a little bit today and I am ashamed. So no more wiki fiddling for me until end of beta.
Kerry 13 Feb, 2013 @ 5:40pm 
Since it would probably be helpful for others in the beta, feel free to update the wiki as you see fit. In the case of features that are new to the beta, you could tag them as such so to reduce confusion until we're out of beta.
shotgunefx 13 Feb, 2013 @ 8:26pm 
So maybe an examples section like in the main Vscript section?
Fish 14 Feb, 2013 @ 6:50am 
Kerry, seems to be a problem with the error handling on the IsPlayerABot function. If a null parameter is sent to it the game crashes without error.
< >
Showing 1-7 of 7 comments
Per page: 1530 50