Left 4 Dead 2

Left 4 Dead 2

Staggering Melee Specials
ChimiChamo 2023 年 10 月 31 日 下午 1:49
A more compatible version of the script
Having made this I realise that me giving advice on how to code probably isn't the best idea but whatever. Here's a fixed version that fixes several errors and allows for compatibility with other scripts:

StaggeringSpecials <- { function OnGameEvent_player_hurt(params) { if("attackerentid" in params && "type" in params && "userid" in params && "attacker" in params && "weapon" in params) { if(params.type != DMG_POISON) { if(EntIndexToHScript(params.attackerentid).IsPlayer()) { local infected = GetPlayerFromUserID(params.attacker) local survivor = GetPlayerFromUserID(params.userid) local damagetype = params.weapon if(infected.GetZombieType() <= 6 && survivor.IsSurvivor()) { if(!survivor.IsDominatedBySpecialInfected() && damagetype != "insect_swarm") { survivor.Stagger(infected.GetOrigin()) } } } } } } } __CollectEventCallbacks(StaggeringSpecials, "OnGameEvent_", "GameEventCallbacks", RegisterScriptGameEventListener)
< >
正在显示第 1 - 4 条,共 4 条留言
Interneted  [开发者] 2023 年 11 月 1 日 上午 2:28 
I knew it! So putting it in a table and call the event to the director table fixes it afterall, it just that I haven't tested it yet.

Anyways I was just wondering on the purpose of checking if the string keys exist on the game event params table and the next 2 if statements? I don't think it is needed, unless you got some explanation about it, newbie here.

For anyone wondering why do I include every single non boss SI, I got issues on my sanity.

Help.

Jokes aside, I will add a configurable settings later after I dive into more built in functions that I am unaware in the future.
最后由 Interneted 编辑于; 2023 年 11 月 1 日 上午 2:29
R󠀡F 2023 年 11 月 1 日 上午 3:00 
Yeah you need to put game events into a isolated section or else other scripts wont be able to use those events.
ChimiChamo 2023 年 11 月 1 日 上午 8:58 
I suppose I should have added comments to it. We check for all the stuff in params so we know that we have all the things we call functions on. For example in the current version of your script, if a common infected damages you, the common has GetZombieType() called on it. The entity doesn’t support that function so there’s an error. The next if statement is just a check for whether the damagetype isn’t the one used when you’re bleeding out when incapped since that caused an error. The next one is probably done incorrectly but that’s just how I do things. It just checks whether the attacker’s entity id is one of a player, so the rest of the stuff doesn’t call on a common infected for example.
Interneted  [开发者] 2023 年 11 月 1 日 下午 7:42 
Omg, totally forgot about the incapacitation damage and other stuff, oh well, thanks @RF, @ChimiChamo!

So uh, any plans on updating your shove tanks add-on and others?
最后由 Interneted 编辑于; 2023 年 11 月 1 日 下午 10:40
< >
正在显示第 1 - 4 条,共 4 条留言
每页显示数: 1530 50