Left 4 Dead 2
Shovable Witches
Interneted 6 DIC 2024 a las 3:07
Better version.
Fixing the console errors is an integral thing to do, especially when it's in the event callback, it will mess up other scripts that use the same events.
ShoveWitches <- { // The only downside that this will stagger the witch even if she is already staggering. // You should stagger only when the witch is not staggering, for consistency, but for now I have no idea how to check for that other than sequences. // But eh, it's your script, do whatever you want. function OnGameEvent_entity_shoved(params) { if("entityid" in params && "attacker" in params) { local surv = GetPlayerFromUserID(params.attacker); local witch = EntIndexToHScript(params.entityid); if(surv != null && witch != null) { if(surv.IsValid() && witch.IsValid()) { if(surv.IsSurvivor() && witch.GetClassname() == "witch") { // This method to ensure the witch did not take any damage when being staggered. local health = witch.GetHealth(); witch.SetHealth(health + 1.0); witch.TakeDamage(0.1, (1 << 6), surv); witch.SetHealth(health); } } } } } } __CollectGameEventCallbacks(ShoveWitches);
Última edición por Interneted; 6 DIC 2024 a las 3:23
< >
Mostrando 1-6 de 6 comentarios
kurochama 6 DIC 2024 a las 6:31 
If it's a stagger because of the "blast" damage type, I'm not sure if that can be nullified by adding health. Another example is common infected. If you use "fire" or "blast" damage on "TakeDamage", even with 1 damage & at the same time adding 100 health, they'll still die instantly.

One of methods to prevent stagger when witch is still in stagger state is by using "Time()" to reset the stagger timer when witch is shoved. For example, if you want to make witch immune to stagger for 1 second, use something like:
if(Time() >= witch_stagger_timer + 1) { witch_stagger_timer = Time(); witch.TakeDamage(1, 64, player); }
If each survivor has this code, then each survivor has their own stagger cooldown on a witch. However, I'm not sure if the original L4D2 scripts will intervene or not, because based on the original L4D2, a staggering witch can be staggered continuously (I ever saw a video about someone killing a sitting witch with sniper headshot + shove + melee combo, like, after staggering her with a headshot, he kept hitting with a melee like 1-2 hits & then shoved her again before landing the last 2 hits to kill her).

Another method to prevent stagger is if you can find netprops that controls witch animation. Recently there's a mod that gives survivors different animations when falling from different height, so probably there's also netprops to detect stagger state on witch. If that is found, then all you need to do is triggering "TakeDamage" only when witch is not in that stagger animation.

But well, I'm also not sure if Geebanger wants this kind of stagger immunity on witch when she staggers. Afaik there's no problem in staggering a witch even when she's staggering, like it won't even cause a serious bug like a crash or a bugged witch when she's staggered continuously.
Interneted 6 DIC 2024 a las 7:03 
Yes, you're right with the infected thing, but it's specifically for the witch, so I don't see any problem using it since it's not an insta-kill.

Using Time() is kind of jank, the witch have different stagger sequences that differs in duration, especially the 'shoved to the wall' sequence. In addition, you can already shove a staggering witch no matter what, it's best to prevent unnecessary thing that has been in the game's feature until now.

The second method that you just mention is what I wrote in the comments of the code, which is checking the sequences, it is done by using built in functions in the CBaseAnimating class, but I am afraid it is out of way, since other scripts may set the sequence to a non staggering animation even though she is actually staggered.

Forcing gesture animations on survivors have nothing to do with checking the current sequence of the survivor, it doesn't update some networked properties related to animations at least from what I tested, which is the scary part.

No offense to anyone, make any script you want as long as there's isn't any console errors.
Última edición por Interneted; 6 DIC 2024 a las 7:21
Geebanger0  [desarrollador] 6 DIC 2024 a las 12:46 
Publicado originalmente por Interneted:
make any script you want as long as there's isn't any console errors.

never :Eddie:
Interneted 6 DIC 2024 a las 22:52 
Publicado originalmente por Geebanger0:
Publicado originalmente por Interneted:
make any script you want as long as there's isn't any console errors.

never :Eddie:
My comment on the code says it afterall ¯\_(ツ)_/¯
dirtydemps 7 DIC 2024 a las 8:06 
why is every comment here longer then the bible
Shadowysn 14 JUN a las 1:49 
Publicado originalmente por Geebanger0:
Publicado originalmente por Interneted:
make any script you want as long as there's isn't any console errors.

never :Eddie:
prepare for the wrath of angry scripters relying on the entity_shoved event
Última edición por Shadowysn; 14 JUN a las 1:49
< >
Mostrando 1-6 de 6 comentarios
Por página: 1530 50