• Check out the results of the Techtree Contest #19!
  • 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 void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Ranged units not attack same target

Level 10
Joined
Jun 13, 2010
Messages
398
If i have a bunch of archers vs a bunch of units, very often my archers will automatically attack the closest whatsoever target.

I would like the archers to attack more randomly, so they don't spend so all their dmg on one single target when they could kill multiple units by spreading out their focus.

How would you do this?

I could create a group within attack range and pick a random enemy to attack - but when will i do this? I can't time it, since they would have varying attack speeds.

Also I would love it to fire even though they are not in agro range but in a custom attack range like in 2000 units range.
 
You have to do it using a Unit Group and the Get random unit function.

You could also use a smarter formula to count up nearby allies and handle them all together so you can better split up their targeting.

When to do it:
1. Upon issuing an attack order. (A unit issued an Order Event)
2. Upon acquiring a target. (Requires a special design to fully utilize this Event)
3. Upon attacking a unit. (A unit is attacked Event)
4. Periodically.

Use some combination of those, taking performance into consideration. The best way to keep this efficient is to have some kind of cooldown for how often the retargeting occurs. In other words, allow the occasional "poorly targeted" attacks to slip through.
 
Last edited:
You have to do it using a Unit Group and the Get random unit function.

You could also use a smarter formula to count up nearby allies and handle them all together so you can better split up their targeting.

When to do it:
1. Upon issuing an attack order. (A unit issued an Order Event)
2. Upon acquiring a target. (Requires a special design to fully utilize this Event)
3. Upon attacking a unit. (A unit is attacked Event)
4. Periodically.

Use some combination of those, taking performance into consideration. The best way to keep this efficient is to have some kind of cooldown for how often the retargeting occurs. In other words, allow the occasional "poorly targeted" attacks to slip through.
Thank you so much for taking time to this. I see this might be bigger, than i expected. Also i need to make a system, take it the conditions arent met, they should be able to still attack the same target. I might have to focus on other more essential stuff first
 
Back
Top