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

Giving negative regen to a unit when it goes too far away from a specific building

Status
Not open for further replies.
Level 3
Joined
Dec 7, 2017
Messages
13
Hi,
Im working on a map where Im creating a type of unit that need to stay close to a specific type of building that workers can build otherwise it will slowly lose HP over time.
I am struggling on the 'Event' part of the trigger, how can I detect this event ?
In the trigger editor I have 'Units leave a region within range of units' but it has to be a precise unit and not a variable.
Thx for help !
 
Level 3
Joined
Dec 7, 2017
Messages
13
Thanks for your reply DaneTheBeast but if I put a regen aura to the building all the units will benefit from it ? Do you know to make it that the aura only work on a specific unit ? In the allowed target field of aura I have 'buildings, flying units, mechanical, etc...' but I don't see how to choose a specific unit.
Thx
 
Level 12
Joined
Dec 11, 2014
Messages
662
Ah right, you can make the unit an ancient and then make the aura only target ancients (This won't work for you if you're using the ancient classification for other units too). Keep in mind that there are a number of solutions to your problem, this aura one may not be the best, but it should work
 
Level 11
Joined
Nov 23, 2013
Messages
665
Using a periodic timer, you may pick every unit from player, and then check the unit type + check the distance (real value) between the building and the unit of that type:
'Every X seconds, pick every unit of type Footman owned by player 1
if distance between Barracks and picked unit >= Y,
then picked unit takes Z damage'.
Something in that area maybe? It probably won't be that simple, especially if you have several buildings that the unit is not supposed to get away from, but this is how I'd start.
 
Status
Not open for further replies.
Top