Set up an array in DECORATE?
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Set up an array in DECORATE?
How exactly do you define an array for an actor? Is it the same as setting up a user variable?
Re: Set up an array in DECORATE?
Yes. See [wiki]DECORATE expressions[/wiki]
- User Variables — user variables are defined as "var int user_(name);" in actor properties
- User Arrays — user arrays are defined as "var int user_(name)[(size)];" in actor properties
Re: Set up an array in DECORATE?
Oh. Not where I expected it to be! Thank you Gez.
Re: Set up an array in DECORATE?
Must be doing something wrong... Are DECORATE arrays started at zero? Sometimes the ball will curve, sometimes it flies straight. It should curve the other way...
Code: Select all
ACTOR LightBeamProjectile
{
Radius 8
Height 8
Speed 20
Damage 8
Scale 0.4
Projectile
Renderstyle Add
Alpha 0.6
+RIPPER
var int user_weave;
var int user_weavearray[2];
States
{
Spawn:
TNT1 A 0 A_SetUserArray("user_weavearray",0,-2)
TNT1 A 0 A_SetUserArray("user_weavearray",1,2)
TNT1 A 0 A_SetUserVar("user_weave",user_weavearray[random(0,1)])
Flying:
LBPR A 1 A_SpawnItemEx("LightBeamProjectileTrail")
TNT1 A 0 A_Weave(user_weave,user_weave,1.0,1.0)
Loop
Death:
TNT1 A 0
Stop
}
}
Re: Set up an array in DECORATE?
You simply forgot about the Curse Of The Spawn State(tm): an actor only runs its action function when it transitions to a new state, and thus does not run the code from its spawn state...
Re: Set up an array in DECORATE?
Crap! I usually tend to be good about that. Thank you Gez...