-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some monsters triggered while in the process of dying are brought back to life #3061
Comments
Looks like this is actually being used in Blue Shift. The map I'd recommend limiting this to the idle and script states like so:
It would probably be better if they were broken out of their script by ending the script, but that would require potentially significant changes to the map script. I'd still recommend disabling this method entirely in the SDK and requiring the use of normal script ending entity setups. Ideally killtargeting a |
The frozen Alien Slaves script can be modified so that instead of triggering the Alien Slaves the To change this the map can be ripented. Add targetnames to the |
Note that monstermaker spawns NPCs with a wait schedule which this use function is supposed to preempt. Removing the function altogether breaks a couple other scripts in maps like alien slaves that teleport in. |
Some monsters that are triggered while in the process of dying are brought back to life in an undead state where they are immune to some types of damage.
This happens because these monsters use the default monster Use method:
halflife/dlls/monsters.cpp
Lines 570 to 577 in c7240b9
Normally when a monster dies it sets the ideal monster state to
MONSTERSTATE_DEAD
:halflife/dlls/combat.cpp
Line 607 in c7240b9
But when a monster is triggered while dying the ideal monster state is set to
MONSTERSTATE_ALERT
. This occurs after its state has been set to dead.As a result the monster's schedule code will keep going and continues running the AI as normal, only the damage logic will ignore some types of damage since it now treats the monster as a corpse:
halflife/dlls/combat.cpp
Lines 846 to 849 in c7240b9
halflife/dlls/combat.cpp
Lines 1004 to 1014 in c7240b9
There doesn't appear to be any use of this feature in Half-Life.
There is one case of it happening in Opposing Force:
In the map
of6a2
there are a fewmonstermaker
entities that have emptytarget
keyvalues. These spawn Shock Troopers with a small delay between them. If you kill the first Shock Trooper quickly enough the second monstermaker will trigger this Shock Trooper when it spawns its own monster, which triggers theMonsterUse
method. The spawned monsters have no targetname which causes them to match an empty string when triggered.No monsters will be brought back from the dead because Opposing Force has a workaround for this bug.
CBaseMonster::ChangeSchedule
has additional logic that prevents a monster from changing schedules if its last schedule ended withTASK_DIE
. This isn't a proper fix since it only deals with the symptoms, not the cause.For reference, in Source this method is a no-op:
https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/server/ai_basenpc.cpp#L4052-L4068
The return statement at the start causes all of the code in the method to be skipped.
It's a good idea to make this a no-op in the SDK, changing it in official games is risky because there could be maps that use the method as intended.
The text was updated successfully, but these errors were encountered: