• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Unit Group Arrays?

Status
Not open for further replies.
Array goes to from 0 to 8191, and if you tick array it does not create automatically 8192 unit groups at game start.
It does only create for index 0 and index 1. So MyGroup[0] and MyGroup[1] should work correctly be default.
You can increase the amount of created groups in the variable editor to a higher number, to 5 for example.
You also can create it with custom script, which allows you more control over it.
For example:
  • Custom script: set udg_MyGroup[5] = CreateGroup()
Now MyGroup[5] does exist and you can use it.

To check if a group does already exist or not you can compare it with "null", for example:
  • Custom script: if udg_MyGroup[5] == null then
  • Custom script: set udg_MyGroup[5] = CreateGroup()
  • Custom script: endif
So now we would only create the group for index 5 if it does not exist yet.
 
Status
Not open for further replies.
Back
Top