ZScript actor flags

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

Actor flags in ZScript are handled differently from DECORATE. A_ChangeFlag is considered deprecated in ZScript, replaced with a simple boolean system.

Flags within a Default block are treated much the same as DECORATE.

Default
{
  Projectile;
  Damage 20;
  -NOGRAVITY // note that semicolons are optional for flags.
  +BOUNCEONFLOORS
}

To refer to a flag within a function, simply insert a 'b' (for 'boolean') in front of the name of the actor flag. Flags may be changed by directly assigning true, false, or an expression that resolves to either.

virtual override BeginPlay()
{
  bSOLID = true;
  bINVULNERABLE = false;
}

The only flags which cannot be changed this way are NOSECTOR and NOBLOCKMAP. These require use of a special function, A_ChangeLinkFlags, in order to perform some necessary internal housekeeping.

See also