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

Order Unbroken Rager to ensare Heroes

Status
Not open for further replies.
Level 13
Joined
Nov 4, 2006
Messages
1,239
depending on how many you have you can add an Event "Unit (rager) comes within xxx of unit (you hero)"
and add each rager separetely,

if they are not preplaced, add the event with a trigger: Event: "(last created unit) comes within range of (your hero)"

you could also use a periodic unitgroup event, but that can be laggy.
 
Level 7
Joined
Jan 23, 2011
Messages
350
Periodic Unitgroup is the best way, as you CAN'T reference the unit that has been aproached(this would be your Rager) in the units comes within range event

A periodic unit group with 0.03 or 0.04 would be the way, and it won't be laggy, unless you leak points and unit group
 
Level 13
Joined
May 10, 2009
Messages
868
The "Unit - A unit comes within X of YOUR_UNIT" event is actually capable of detecting a "target", but only if YOUR_UNIT tries to attack the approaching unit. To sum it up, it is a combination of "A Unit is Attacked" event with its main purpose (detecting any unit within X range). I wouldn't go with this one for it triggering a trigger many times in a short time.

On the other hand, you can use this - if your unit attacks, of course:
  • Events
    • -------- Specific Unit Event --------
    • Unit - YOUR_UNIT Acquires a target
  • Conditions
  • Actions
    • -------- YOUR_UNIT = (Triggering Unit) --------
    • -------- Target = (Targeted Unit)
This one won't spam-fire your triggers as much, but the downside is melee units not being able to target air units.


At last, you have what Marcos_M suggested, which is capable of detecting most units. However, I don't think you'd need such a small interval for it. Well, it really depends on the amount of existing Unbroken Rager units in your map. If you have a few of them at once, something around 0.4 timeout interval should be enough.


To be honest, the correct answer is: test them all and see which one suits you best, because having hundreds of registered units through specific-unit events in a trigger wouldn't be a smart choice either. Unless you know how to "recycle" your triggers.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
One idea is to use an array list and every 0.03 seconds you poll through 5-10 elements of the list. Each element of the list consists of a unit, which gets loaded into a temporary global unit variable, and a trigger which gets run. These triggers are "tactical AI functions" which make cast decisions for the unit contained in the temporary global unit variable. When the unit is removed, remove its entry from the array list (might require a hash table).

The resulting system is extremely scalable and flexible.
 
Status
Not open for further replies.
Top