InStateSequence

From ZDoom Wiki
Jump to: navigation, search
Note: This feature is for ZScript only.

bool InStateSequence (State newstate, State basestate)

Usage

Looks for what state sequence the actor is in. Importantly, this function checks an entire sequence of states (from one label to the next). For example, CurState == ResolveState("Pain") will only return true if the actor is in the first state of its Pain sequence, whereas InStateSequence(CurState, ResolveState("Pain")) will return true for the entire Pain sequence.

Parameters

  • newstate: What you are checking.
  • basestate: What you are checking for.

Examples

This plasma ball will announce when it has gibbed what it hits.

class GibAnnouncer : PlasmaBall replaces PlasmaBall
{
    States
    {
    XDeath:
        PLSX A 0
        {
            if(BlockingMObj &&
                BlockingMObj.InStateSequence(BlockingMObj.CurState, BlockingMObj.ResolveState("XDeath")))
            {
                A_Log("GIBBED!");
            }
        }
        Goto Death;
    }
}