I need help on a map i'm working on.
I want the game to automatically group lets say the last 3 created units.
The issue i got is, that i can only create group variables static and not dynamic.
The best thing would be if i could acces a group through the units in it.
maybe you have an idea how this could work. If you got further questions, just ask!
btw: dint found any related topic in search
You could construct an Indexing system to keep track of it.
You have a global array of unit groups ( gUnitGroup[x] )
And a global integer (gCounter = 0)
Then if you want to group units into a group you can do
Add (unit1) to gUnitGroup[gCounter]
Set Custom Value of (unit1) to gCounter
Add (unit2) to gUnitGroup[gCounter]
Set Custom Value of (unit2) to gCounter
Set gCounter = gCounter + 1
That'd be best to be made into a own function so you don't have to care about the counter increment.
If you want to get the unit group then you can do
Set tempGroup = gUnitGroup[ Custom Value of (my unit) ]
This is rather basic, of course. But it does work.
I don't know how much you know about triggering, so if there's anything I've not explained well enough, just post it.
Thank you very much!
The only problem i got is, that i cant set the Custom Value of the Unit to the Integer.
- Set unit1 custom value 0 to 100.0
the "0" can be set as any integer, but the 100.0 cant be replaced by an integer