Left 4 Dead 2

Left 4 Dead 2

Your own custom apocalypse
Discover and download new maps, Add-ons, Mutations and more! Want to try your hand at modding or want to upload your mod to Steam?
Learn More
[Solved] Disable defibrilating bots
Hi, I'm playing this map where reviving bots is a total waste because they'll die and waste healing items too fast, and it's better to just wait until a real player joins to defib him. But ppl still join and instantly rush to defib them.
For now I have this manual all-in-one command that gives the player explosive ammo and then removes it from them, stopping the defib animation.

Can anybody help finding / making this mod ? Or point me to some commission mod makers ?
Thanks
Last edited by anon2+86; 14 Apr @ 5:42am
< >
Showing 1-8 of 8 comments
There are several ways to do that via event function, like:
1. Stumble
no_defib <- { function OnGameEvent_defibrillator_begin(event) { local defibuser = GetPlayerFromUserID(event.userid); local defibtarget = GetPlayerFromUserID(event.subject); if(IsPlayerABot(defibtarget) { defibuser.Stagger(defibtarget.GetOrigin()); } } } __CollectGameEventCallbacks(no_defib);

2. Drop defib
no_defib <- { function OnGameEvent_defibrillator_begin(event) { local defibuser = GetPlayerFromUserID(event.userid); local defibtarget = GetPlayerFromUserID(event.subject); if(IsPlayerABot(defibtarget) { defibuser.DropItem(defibuser.GetActiveWeapon().GetClassname()); } } } __CollectGameEventCallbacks(no_defib);

Write either one of them in "director_base_addon.nut".

There are also other alternative ways, & other modders may have other alternative ways.
Last edited by kurochama; 12 Apr @ 7:54am
anon2+86 12 Apr @ 11:50pm 
Thank you but none seem to work, I've browsed around and it seems these quick work-arounds stopped working since TLS ?

Or maybe I did something wrong: I put the file in scripts/vscripts, didnt work ; I put it in a vpk, didn't work ; I've tried renaming the file to the map name, didn't work.
Last edited by anon2+86; 12 Apr @ 11:58pm
Originally posted by anon2+86:
Thank you but none seem to work, I've browsed around and it seems these quick work-arounds stopped working since TLS ?

Or maybe I did something wrong: I put the file in scripts/vscripts, didnt work ; I put it in a vpk, didn't work ; I've tried renaming the file to the map name, didn't work.
Did you copy-paste the code into "director_base_addon.nut"? You can also check the console for errors with red texts. If scripts don't work, usually some errors will show up on console.
It looks like the problem lies on "IsPlayerABot". Somehow this can't be used to check whether the dead survivor is a bot. When I simplified the code like this, it worked:
function OnGameEvent_defibrillator_begin(event) { local defibuser = GetPlayerFromUserID(event.userid); local defibtarget = GetPlayerFromUserID(event.subject); defibuser.Stagger(defibtarget.GetOrigin()); }
However, this will completely make defib unusable, because the defib user will stumble when trying to use defib.

So, probably we can go back to the beginning & try to modify your "all-in-one command" instead:
Originally posted by anon2+86:
For now I have this manual all-in-one command that gives the player explosive ammo and then removes it from them, stopping the defib animation.
Does this your all-in-one command also use vscript? If it does, then you can replace the mechanism to give the explosive ammo with "player.DropItem(itemclassname)". This will make the player trying to revive a bot with your all-in-one command to drop their defib. Alternatively, you can use "player.SwitchToItem(itemclassname)" to force the player to switch to other item (like primary or secondary gun) when they try to use defib on a dead bot.
Last edited by kurochama; 13 Apr @ 4:39am
anon2+86 13 Apr @ 5:22am 
Thank you for your time but if it makes the defib completly unusable that won't do :/

The problem with my current solution is that it's manual, so I have to be on the lookout for some guy suddenly deciding it's time to revive some bots, and press the button in time.
I was hoping for a peace-of-mind automatic solution.

But thanks for trying
anon2+86 14 Apr @ 5:40am 
Hey kurochama, if you haven't unfollowed this thread, I want to say THANK YOU IT WORKS :)

The problem was a missing closed parenthesis in the "if"

I'm going with the stumble solution because the drop defib actually deletes the defib instead of dropping it.

Thank you very much
Last edited by anon2+86; 14 Apr @ 5:45am
Originally posted by anon2+86:
Hey kurochama, if you haven't unfollowed this thread, I want to say THANK YOU IT WORKS :)

The problem was a missing closed parenthesis in the "if"

I'm going with the stumble solution because the drop defib actually deletes the defib instead of dropping it.

Thank you very much
I see... It looks like I forgot to check the codes again because I wrote them via phone & didn't notice that I missed a bracket. It's good to know that it finally worked. So, the "DropItem" deleted the defib instead? Normally this only drops the item on the ground when used on primary & secondary weapons.

Btw you can also add "ClientPrint" to let the player know that they can't use defib on bots, like:
ClientPrint(defibuser, 5, "Defib failed. You can't use defib on a dead bot.")
Last edited by kurochama; 14 Apr @ 7:14am
anon2+86 14 Apr @ 9:10am 
Originally posted by kurochama:
Alternatively, you can use "player.SwitchToItem(itemclassname)".
[...] Btw you can also add "ClientPrint"
That's even better actually because I don't want the players to stumble into fallling, the map has lots of places where you can fall from.

So finally I'm using this:
defibuser.SwitchToItem("weapon_*"); ClientPrint(defibuser, 5, "Defib failed. You can't use defib on a dead bot.");
It forces the player to switch to secondary weapon, whatever it is.

Thanks again
Last edited by anon2+86; 14 Apr @ 9:16am
< >
Showing 1-8 of 8 comments
Per page: 1530 50