A_CheckFlag

From ZDoom Wiki
Jump to navigation Jump to search

state A_CheckFlag (string flagname, statelabel label [, int check_pointer])

Note: Jump functions perform differently inside of anonymous functions.
Note: The feature described should only be used in DECORATE code and should be considered deprecated in ZScript code where a combination of direct access to flags and SetStateLabel function (or ResolveState function depending on the use case) should be used instead.

Usage

Checks if the actor designated by the given actor pointer has the flag of this name, and if it is valid. If the pointer does not have the flag, no jump is performed.

Parameters

  • flagname: the name of the flag check for.
  • label: the state to jump to if the specified flag is set for the pointed to actor.
  • check_pointer: the actor to perform the flag check on. This is an actor pointer. Default is AAPTR_DEFAULT, which corresponds to the calling actor.

Examples

If this Imp's master is frightened, this imp will be frightened too.

ACTOR CowardImp : DoomImp
{
  States
  {
  See:
    TROO A 0 A_CheckFlag("FRIGHTENED", "RunAway", AAPTR_MASTER)
    TROO AABBCCDD 3 A_Chase
    Loop
  RunAway:
    TROO A 0 A_ChangeFlag("FRIGHTENED", TRUE)
    Goto See+2
  }  
}