How does Escapehits work?

kimono

Well-known member
Hello, dear Openbor experts.
Code:
Escapehits 2
is set up as follows, and Kaioh successfully escapes on the third hit:
However, this isn't the case with other bosses.
What are the conditions for Escape Hits to work, besides the presence of
Code:
anim special2
?
For example, is this setting dependent on the duration of the
Code:
anim pain
?
 
Solution
Hello, dear Openbor experts.
Code:
Escapehits 2
is set up as follows, and Kaioh successfully escapes on the third hit:
However, this isn't the case with other bosses.
What are the conditions for Escape Hits to work, besides the presence of
Code:
anim special2
?
For example, is this setting dependent on the duration of the
Code:
anim pain
?

@kimono,

Escapehits depends on how many consecutive pain-state updates the entity takes. The engine increases an internal counter called escapecount every time the entity is hit while still in a pain animation. Getting knocked down resets that counter.

C:
void common_takedamage() {
    //...
   
    // Enemies can now use SPECIAL2 to escape cheap...
Hello, dear Openbor experts.
Code:
Escapehits 2
is set up as follows, and Kaioh successfully escapes on the third hit:
However, this isn't the case with other bosses.
What are the conditions for Escape Hits to work, besides the presence of
Code:
anim special2
?
For example, is this setting dependent on the duration of the
Code:
anim pain
?

@kimono,

Escapehits depends on how many consecutive pain-state updates the entity takes. The engine increases an internal counter called escapecount every time the entity is hit while still in a pain animation. Getting knocked down resets that counter.

C:
void common_takedamage() {
    //...
   
    // Enemies can now use SPECIAL2 to escape cheap attack strings!
    if(acting_entity->modeldata.escapehits)    {
        if(acting_entity->drop)    {
            acting_entity->escapecount = 0;
        } else {
            acting_entity->escapecount++;
        }
    }  
   
    //...
}

Once the AI runs its thinking routine, it checks whether:

Escapecount is greater than escapehits
• Entity is not airborne
• Entity actually has a valid anim special2

If all of those are true, the AI tries to use special2 as an escape move. It still has to meet the usual special-move requirements, including energy cost.

C:
int ai_check_escape()
{
    if((self->escapecount > self->modeldata.escapehits) && !inair(self) && validanim(self, ANI_SPECIAL2))
    {
        // Counter the player!
        check_costmove(ANI_SPECIAL2, 0, 0);
        return 1;
    }
    return 0;
}

Finally, whenever the entity updates its animation and is no longer flagged as being in any pain state, escapecount automatically resets to zero. That means short pain animations, knockdowns, or any interruption that clears inpain will prevent escapecount from ever rising high enough to trigger an escape.

C:
void update_aniamtions(){
    //...
   
    // Reset their escapecount if they aren't being spammed anymore.
    if(self->modeldata.escapehits && self->inpain == IN_PAIN_NONE)
    {
        self->escapecount = 0;
    }
   
    //...
}

To summarize: Escapehits only works when you land multiple hits that keep the entity locked in a continuous pain state. Anything that clears pain, knocks down, or ends the animation chain will reset the counter.

HTH,
DC
 
Solution
Thanks Damon for the detailed explanation: I understand that the target must remain in the animation pain state
in some way until the number of hits exceeds the escapehits limit.
So, I can increase the duration of the animation pain so the counter isn't reset too easily.
 
Back
Top Bottom