get the group the unit is in

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,854
You can check if a Unit Group contains a unit but there's no way natively to get a unit's "group" seeing as how it can belong to any number of Unit Groups.

A solution would be to link the Unit Group to the Unit using a Unit Indexer or Hashtable.

Then you'll always have a reference to the Unit Group as long as you have a reference to it's linked Unit.

Unit Indexer example of linking and then destroying a Unit Group:
  • Set Variable CV = Custom value of some unit
  • Set Variable LinkedGroup[CV] = Some existing Unit Group
  • Custom script: DestroyGroup( udg_LinkedGroup[udg_CV] )
 
Last edited:
Status
Not open for further replies.
Top