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

Setting variable for any unit a player owns

Status
Not open for further replies.
Level 6
Joined
Sep 24, 2015
Messages
174
How to set a variable if i want that this variable would be equal to any units owned by ennemy of player? i can't found it on world editor.

e.g : set somebuilding = any units owned by ennemy of player x

player x has got a unit that would attack a unit owned by his ennemy

because i'm triying to understand that old post i made (on my lost map ofc)...
with the damage engine...trying to get it alone but it's still complicated. also i don't know if i'm posting on the right section :/
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
You probably want random unit in unit group for attacking. You other the unit to attack move to the position of that random unit periodically. A smarter system would first filter the group by distance or try looking for nearby enemy units first, and then order it to attack a random one of them otherwise the unit might spend a lot of time wandering to far away targets instead of killing what is nearby.

If you want to apply something for every unit in a unit group you use the pick unit action.
 
Status
Not open for further replies.
Top