A_SetArg

From ZDoom Wiki
Jump to: navigation, search

A_SetArg (int position, int value)

Changes the calling actor's args[position] field to value.

Examples

This health bonus will have a float bobbing movement (like Heretic's and Hexen's powerups and items) if its first argument (Args[0]) is higher than 0. It won't enter the FloatBobMovement state more than once because Args[0] will be changed to 0 if the actor enters this state.

ACTOR FloatBobHealthBonus HealthBonus
{
 States
 {
 Spawn:
   BON1 A 0 A_JumpIf(Args[0]>0, "FloatBobMovement")
   BON1 ABCDCB 6
   Loop
 FloatBobMovement:
   BON1 A 0 A_SetArg(0, 0)
   BON1 A 0 A_ChangeFlag("FLOATBOB", 1)
   Goto Spawn
 }
}

This actor will have the same behavior as D'Sparil

ACTOR NewSorcerer2 : Sorcerer2
{
  States
  {
  Death:
    SDTH A 8 A_SetArg(4, 7) //Replicates A_Sor2DthInit
    Goto Super::Death+2
  DeathLoop:
    SDTH DE 7
    SDTH F 7 A_SetArg(4, Args[4]-1)
    SDTH F 0 A_JumpIf(Args[4]>0,"DeathLoop") //Replicates A_Sor2DthLoop
    Goto Super::DeathLoop +4
  }
}