• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Array Variables??

Status
Not open for further replies.
Level 2
Joined
Feb 28, 2005
Messages
6
....

You can do something like this:

Say you have 4 units that each need 5 usable variables and you want to store all data into 1 array.

What I always do is give every unit a unique custom value.

Say each unit has a custom value from 1 to 4.

If I wanted to query unit 3's 4th value, I would use the following equation.

set variable = x((custom value of unit * 5) + 4)

x x x x x
x x x x x
x x x x x
x x x x x

In this case, "variable" gets set to the 5 times the custom value of the unit plus 4. In actuality it would return the value in slot number 19 which is on the 4th row. Don't worry about this for now, just know that this system works.

Hope that makes sense.
 
Status
Not open for further replies.
Top