HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Variable Issues

01-15-2007, 08:20 AM#1
Pheonix-IV
Roite. I'm not sure if this is doable, so here's my question:

Lets say i have 10 regions for each player. What i want to be able to do is put those 10 regions into 10 seperate variable arrays. Right. Now i hit a snag, what i'm then after is some way to make an array of variables, so i can do something like this:

Trigger:
Unit Group - Pick every unit in (Units in WeaponPoints[Player Number of Picked Player]WeaponRegions[3]) and do (Do nothing)

What i'm trying to do is grab a random unit, use it's player number to get to the array for that players regions, then use another number to select a unit in one of those regions. How can i do this?
01-15-2007, 11:45 AM#2
Fireeye
If you don't hit the 8192 limit of an array you can use for the array:
((Playernumber-1))*MaxRects)+NeededRect ||This is the GUI-Form
e.g to set up fo player 1 with 10 rects you can make it like this
Trigger:
Actions
// the names are only for better indentification rPlayerNumber;WhichRect
Set rects[0] = r1;0
Set rects[1] = r1;1
Set rects[2] = r1;2
Set rects[3] = r1;3
Set rects[4] = r1;4
Set rects[5] = r1;5
Set rects[6] = r1;6
Set rects[7] = r1;7
Set rects[8] = r1;8
Set rects[9] = r1;9
Set rects[10] = r1;10
The rest is propably only much trigger work, btw. i won't try to make an array inside an array, it's possible, but they are such hard to debug and you make easily mistakes.
To make the needed triggers, get a random unit, get the PlayerNumber.
Finally you set an integer to a random one and can use the formula @ the top
((Playernumber-1))*MaxRects)+RandomInteger
e.g. You pick a unit owned by Player 1 and have a random trigger of let's say 6, then it looks like this (max. 10 rects per Player)
((1-1)*10)+6 => 6, so you can pick another unit from rects[6].
I hope this helped a bit.
01-15-2007, 10:37 PM#3
Pheonix-IV
Yeah, i settled on doing that as a temp method and decided that i might as well use it anyway, since it works fine. Only difference is i used Player Number X 100 so i can add more regions if need be.
01-15-2007, 10:58 PM#4
Mapz_Maker
First off, the limit is 8192 variables in an array NOT '3000s'
Second, with jass this would be much simpler