• 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 faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

get the group the unit is in

Status
Not open for further replies.

Uncle

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