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.
Nuvolabomb.png Warning: The feature described on this page has been deprecated, and will no longer be supported or updated by the GZDoom developers. While some functionality may be retained for the purposes of backwards-compatibility, authors are strongly discouraged from utilizing this feature in future projects and to instead use a combination of direct access to flags and SetStateLabel function (or ResolveState function depending on the use case) in ZScript. Compatibility with future GZDoom versions is not guaranteed.

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
  }  
}