A_SetUserVar

From ZDoom Wiki
Jump to: navigation, search

A_SetUserVar (string name, int value)

Sets the calling actor's user variable named name to value. The name must begin with user_.

User variables are not used by anything internally, contrarily to the args array and the special1 and special2 fields.

Examples

This code creates an imp which attacks with a 360 degree "shockwave" attack composed of 360 individual fireballs. Old mods achieved this effect by reproducing a A_CustomMissile call many times. This cuts down on the amount of lines needed and is much cleaner to implement.

actor ShockWaveDoomImp : DoomImp replaces DoomImp
{
  var int user_theta;
  states
  {
  Missile:
    TROO EF 8 A_FaceTarget
    TROO G 0 A_SetUserVar("user_theta",0)
  Shock:
    TROO G 0 A_CustomMissile("DoomImpBall",32,0,user_theta)
    TROO G 0 A_SetUserVar("user_theta",user_theta+1)
    TROO G 0 A_JumpIf(user_theta==360,"EndShock")
    Loop
  EndShock:
    TROO G 6
    Goto See
  }
}

See also

Personal tools
Namespaces

Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox