Left 4 Dead 2

Left 4 Dead 2

217 ratings
Infected can disarm survivors
   
Award
Favorite
Favorited
Unfavorite
Game Content: Scripts
Game Modes: Single Player, Co-op
File Size
Posted
6.747 KB
30 Dec, 2024 @ 6:18pm
1 Change Note ( view )

Subscribe to download
Infected can disarm survivors

Description
This cusomisable mod lets the infected knock a survivors weapon to the ground if they hit them.

The CFG file in "ems\infected_disarm\disarm.txt" lets you edit 3 variables. You can change how likely an infected is to disarm a survivor when the survivor has high health, low health, and how much health is needed to be considered 'low health'. Using this, you can make injured survivors more likely to drop their weapons.
42 Comments
Geebanger0  [author] 10 Jul @ 3:41am 
Ellis doesn't get stumbled there, he just runs away
withextradip 10 Jul @ 12:12am 
You should make the survivors stumble when they drop a weapon, similar to the video
rgawsome231 9 Jul @ 6:21pm 
@Geebanger0

Many thanks for the explanation, I hope you have a fantastic night and good fortune on future projects!
Geebanger0  [author] 9 Jul @ 12:02am 
If you get an error, it means that at some point during this the script failed. So long as it still otherwise works though, it's fine. Almost every script I make produces errors in console constantly. I don't know how/can't be bothered to make them in such a way that they don't produce the errors. The scripts still work perfectly fine otherwise, and most people don't check the console at all so they won't even know.

So yeah, unless the script doesn't work, you don't have to worry about the errors.
Geebanger0  [author] 8 Jul @ 11:59pm 
The function basically means this

When a player takes damage:
- Check which player it was who took the damage
- Check what damage type that player took. Every damage type has a corresponding number
- If the damage type equals 128 (which it should if a common infected hit the player):
-- Continue with the rest of the script
rgawsome231 8 Jul @ 8:34pm 
Hey I don't know if you still watch over this mod but on line 117 to 122 which is this:

function OnGameEvent_player_hurt(event)
{
local victim = GetPlayerFromUserID(event.userid);
local damagetype = event.type;
if(damagetype == 128)

I think this is what causes error problems on my computer, as in the console it show it as "type is not a valid" something of this sort. I was wondering if you can explain what this function does and maybe review it to see if it happens on your end too.

Thank you for your time! :-3
Corveck (Fusion) 20 Jun @ 10:42pm 
@an apocalypse fae It's not like anyone's asking you to download this lol
an apocalypse fae 16 Jun @ 1:54pm 
i'd like to keep my reserve ammo :/
Kouga 29 May @ 11:19pm 
is it possible to add a variable in the cfg to blacklist what weapons can be dropped?
SP-Calamitas 26 May @ 5:24am 
thank you. i found it the mod causing it but, curiously, it seems this mod has an error actually


AN ERROR HAS OCCURED [the index 'type' does not exist]

CALLSTACK
*FUNCTION [OnGameEvent_player_hurt()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/addons/workshop/3396548149.vpk/scripts/vscripts/director_base_addon.nut line [120]
*FUNCTION [__RunEventCallbacks()] unnamed line [211]
*FUNCTION [__RunGameEventCallbacks()] unnamed line [218]

LOCALS
[victim] INSTANCE
[event] TABLE
[this] TABLE
[funcName] "OnGameEvent_player_hurt"
[idx] 11
[useTable] TABLE
[bWarnIfMissing] true
[globalTableName] "GameEventCallbacks"
[prefix] "OnGameEvent_"
[params] TABLE
[event] "player_hurt"
[this] TABLE
[params] TABLE
[event] "player_hurt"
[this] TABLE