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

get the group the unit is in

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
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