Dead monsters firing their targets twice

Discussion related to Hexen II mapping. If you are currently working on a new map this is the perfect place to share your progress.
Post Reply
User avatar
Posts: 74
Joined: Sat Apr 18, 2020 8:05 am
Location: Paris, France

Dead monsters firing their targets twice

Post by Inky »

Sometimes you want the player to fight monsters to trigger something once they're all dead. Like "kill the 2 guardians, then the door will open".

I just discovered a corner case able to mess up such a configuration. Indeed, depending on the amount of damage a monster has taken when it dies, it either falls down on the floor as a dead body or explodes in chunks (thanks to function chunk_death). Both situations fire the monster's targets. And since it turns out that a dead body is just a modified state of the monster it previously was, not a new separate entity, it keeps its original targets and can fire them a second time if the player blasts the body (because it will call chunk_death also when exploding in chunks).

Some weapons inflict a high damage, like the demoness' weapon 4 and can somehow "kill the monster twice" (regular kill + body blasting in a row).

In the previous example with 2 monsters pointing to a trigger_counter (with count = 2 and targeting the door to open), the first monster may be double-killed and trigger the door opening right away whereas the other monster took no damage yet.

If you think it's not the way you want things to happen, then put an intermediary trigger_once between each monster and the trigger_counter. Thus, no matter how many times each monster dies, the trigger_once it's pointing to will decrease the trigger_counter's count property only once. Please note that for some reason using a trigger_relay with wait = -1 doesn't work: it has to be a trigger_once.
Post Reply