Hell Warrior's temporary invincibility?

Thu Nov 04, 2021 1:45 pm

Not sure if anyone is able to help me with this here, but I guess it cannot hurt to ask.

So I have been playing with a custom difficulty mod that replaces the Hell Knight with Realm667's Hell Warrior. For the most part, it works well, but on occasions, the enemy becomes temporary invincible even when its guard is down and it does not appear to take any damage for a brief period. I am not sure what causes the issue to happen nor what causes it to stop; I thought hitting the enemy with different attacks was it, but apparently, it just stops on its own.

Does anyone know what could be causing this and how to prevent it from happening?

Thanks in advance!

Re: Hell Warrior's temporary invincibility?

Thu Nov 04, 2021 2:17 pm

I suspect I know what's happening. Several state sequences in the enemy set the monster to be invulnerable. However, it might be the case that one or more of these can be interrupted after invulnerability has been set but before it has used an "A_UnSetInvulnerable();" pointer. To be fair, the code looks OK, but I guess it must be happening. Perhaps if it starts a missile attack but then the player gets in close enough for a melee attack it might jump to the melee state label... maybe?

With a monster like this, a "belt and braces" approach would be to add an "A_UnSetInvulnerable()" pointer to the start of the "see" state sequence (and any other sequence where you definitely do not want it to be invulnerable) so that you can guarantee that whenever it goes to this sequence, it will be vulnerable. You could set it up to always run:
Code:
  See:
    HWAR A 0 A_UnSetInvulnerable();
   HWAR AABBCCDD 3 A_Chase();
    Loop;


But it should only be needed once so
Code:
  See:
    HWAR A 0 A_UnSetInvulnerable();
   HWAR AABBCCDD 3 A_Chase();
    goto See+1;

should also be OK.

Re: Hell Warrior's temporary invincibility?

Thu Nov 04, 2021 3:22 pm

That was faster and simpler than I expected! Thank you so much! :thumb:

I will let you know if it happens again.