| 02-17-2005, 11:37 AM | #1 |
i got another really quick question. Is it possible to make 3D arrays, it would be really helpful if i could. i think the answer is no but if there is a way to do it i would be thankful |
| 02-17-2005, 12:01 PM | #2 |
Yea, but it would be complicated. You would have to use a normal array, but access its elements like this: array[x*(yMAX+1)*(zMAX+1) + (y*zMAX+1) + z] where xMAX/yMAX would be the maximum value of x/y. To access an array element 4, 5, 6, you would just fill in the numbers. I think that would work, cant give you a 100% guarentee though. |
| 02-17-2005, 01:46 PM | #3 |
The max elements of an array is 8192, not a lot if you want to do 3D array[x*(yMAX+1)*(zMAX+1) + (y*zMAX+1) + z] works I thinks yMAX+1 and zMAX+1 are the dimensional size |
| 02-17-2005, 01:57 PM | #4 |
Guest | 3D arrays are something really perturbating. I tried to do some myself and miserably failed. But I think a way of doing it is using 4 arrays, 1 for each dimension, and a final array that will mix/convert all like a save/load code. |
| 02-17-2005, 08:35 PM | #5 |
whoa allot of talk while i was at skool, ill give it a try. So are regular Variable arays 1 dimensional Variable[index] 2d arrays are Variable[index, index] and 3d arrays are variable[index, index, index]? |
| 02-17-2005, 08:46 PM | #6 | |
Quote:
yes but in JASS you can only declare 1 dimensional but with these you can make 2D 3D or XD dimensional as the posts before explain it. |
| 02-17-2005, 09:31 PM | #7 |
ok variables can confuse me sometimes |
| 02-17-2005, 11:31 PM | #8 |
Use gamecache (not as game saving thing but as data storage= StoreInteger( GameCache_variable, "mission", "key", integer) with mission and key you already have a 2d array and with just concatenating like "mission" , I2S(Y)+";"+I2S(X) you have a 3d array it is incredibly easy to go to a nd array actually |
| 02-18-2005, 10:32 AM | #9 |
Guest | Woah that sounds easy now thx for the explanation Lord Vexorian ^_^ What useful stuff can you do with 3D arrays? Define 3D regions and points I guess, but what else? Make some custom 3D effects to spells? Make some kind of "plane commander" map where you see a plane in FPS? or just something in space? OMFG this gives me a lot of ideas |
| 02-18-2005, 01:50 PM | #10 |
there is allot of useful things u can do with 3d arrays, use ur imagination. a 3d array is like a array of 2d arrays |
