InStateSequence

clearscope static bool InStateSequence (State newstate, State basestate)

Note: This feature is for ZScript only.

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: The state to check. The variable CurState (as above) will return the actor's current frame.
  • basestate: The state sequence to compare against.

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;
    }
}
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.