Warcraft III resources & community, 2003–2006 · archived

Array Variables??

5 posts
#1

Array Variables??

Just wanted to know if its possible to create two-dimensional arrays. Example: v[3][5]
#2
There is no true way to create matrises but you can simulate them by using two arrays. Use the first for X and the second for Y. I think there is a script here for it.
#3

....

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.
#4
I have used Array[ string( integer(value1) integer(value2) ) ] some times :)
#5
That will bug like hell when you have integers of multiple characters.