• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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.
Top