Skip to content

Unit Attack Priority

Stijn edited this page Aug 11, 2023 · 7 revisions

A loose collection of notes and quotes on unit attack priority. I ran into an issue where some zombies would not attack buildings when there were regular units behind it, even if the zombies had to take a large detour.

  1. The Stats - Priority field does NOT actually affect attack order priority. It changes the ordering of a selection group in the UI.
  2. Buildings without an attack are always ignored. You can add a hidden 1 damage attack with high cooldown
  3. Buildings with Fortified armor type are low(er) priority
  4. Buildings without movespeed are low(er) priority. Assigning nonzero movespeed to a building causes the Orc Burrows ability to no longer attack. Furthermore, it produces funny buildings if Can Flee is enabled as buildings will run away (faster than their movespeed even).

As far as I know there is no easy way to have enemies kill nearby buildings without the side effects of nr. 3.

However, if you have computer players instead then a combination of some of the above might be sufficient as computer players have different attack priority game code.

From Dr Super Good on the Hiveworkshop

The reflexive (not computer controlled, possibly only neutral or no controller) tactical AI of units is such that if it is under attack by combat units it will ignore all buildings (especially without attack). Your Farm units cannot attack hence they are ignored as the AI tries to reach the attackers behind them. Giving them an attack solves part of the problem but nowhere near all (they will give off the odd attack but otherwise still dance around). I guess it assigns buildings a near 0 priority in this tactical AI so any unit nearby will be targeted instead unless completely blocked (cannot move) in which case it will attack buildings with attacks.

The solution is simple. Instead of giving them to no controller, give them to a computer player controller. Even with no running AI script (just the slot set to computer) the computer player tactical AI is far superior to the reflexive tactical AI no controller uses. The computer tactical AI will have no problem attacking your farms to reach the units behind them. Even with riflemen firing on them they will waste no time ripping those farms down.

When you cannot use computer slots but still want sane building targeting then you might have to trigger it. I've heard of people having success with this but have not tried this myself yet.

Priority order seems to be

  1. attacking units
  2. units that aren't workers
  3. attacking workers
  4. workers
  5. attacking buildings
  6. buildings
  7. units attacking a friendly unit (e.g. attacking your own units makes the AI ignore the unit that's attacking unless it's the only remaining target)
Clone this wiki locally