• 🏆 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!

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,198
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