Set up an array in DECORATE?

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Set up an array in DECORATE?

Postby Ceeb » Wed Oct 06, 2010 3:49 pm

How exactly do you define an array for an actor? Is it the same as setting up a user variable?
User avatar
Ceeb
Official Idoit Of ZDoom
Banned User
 
Joined: 11 Jun 2008
Location: Castle Wut

Re: Set up an array in DECORATE?

Postby Gez » Wed Oct 06, 2010 4:09 pm

Yes. See DECORATE expressions
  • 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
Gez
 
 
 
Joined: 06 Jul 2007

Re: Set up an array in DECORATE?

Postby Ceeb » Wed Oct 06, 2010 4:20 pm

Oh. Not where I expected it to be! Thank you Gez. :)
User avatar
Ceeb
Official Idoit Of ZDoom
Banned User
 
Joined: 11 Jun 2008
Location: Castle Wut

Re: Set up an array in DECORATE?

Postby Ceeb » Wed Oct 06, 2010 4:31 pm

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 allExpand view
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
    }
}
User avatar
Ceeb
Official Idoit Of ZDoom
Banned User
 
Joined: 11 Jun 2008
Location: Castle Wut

Re: Set up an array in DECORATE?

Postby Gez » Wed Oct 06, 2010 4:36 pm

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...
Gez
 
 
 
Joined: 06 Jul 2007

Re: Set up an array in DECORATE?

Postby Ceeb » Wed Oct 06, 2010 4:39 pm

Crap! I usually tend to be good about that. :oops: Thank you Gez...
User avatar
Ceeb
Official Idoit Of ZDoom
Banned User
 
Joined: 11 Jun 2008
Location: Castle Wut


Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 1 guest