• 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.

Increasing the priority of attack on a unit of a certain type

Status
Not open for further replies.
Level 7
Joined
Sep 10, 2022
Messages
101
I am new to War3 World Editor and I am trying to do monster waves that will attack the player's/computer 's camp. I made a custom unit called "City Gate", just to block monsters for a certain amount of time in terrain passages. I assumed that the enemy units would attack the gate in priority (because they have no choice and there is nothing else to attack), the Gate is owned by the player, but they just stand there and watch as they are killed by towers...

Screenshot_1.png


And I am going to fix this, but I am not sure what to do. At first, I wrote a script that will force the enemy to attack the Gate. But it will only work for this Gate. So, If the solution is trigger, I wonder how to force the enemy to attack not the Gate, but the Type of Unit, so the enemy will have priority on the Gate Type Unit. (I mean I am bad at this stuff)

1669240495916.png


Or at last, it should be easier to give the Gate previously invented (but not yet ready) custom ability, like "Passive Taunt" ?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I replied to this before the database fuckery with a response but it's gone now since the restore. Basically: store all your gates in a destructible array. Every few seconds, loop through that array and check if each gate is alive--if so, order nearby (brown?) units to attack the gate.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Alternatively, you could make the Gate Invulnerable and place a Unit on top of it that has no collision and have it act as the Gate. As this unit takes damage you could then damage the gate, or just detect when the Unit dies and Destroy the gate in response. Not the cleanest solution but it gets the job done.

You could then give the Gate Unit an attack that deals 0-0 damage or some ability on autocast that draws aggro if the AI still ignores it.
 
Last edited:
Level 7
Joined
Sep 10, 2022
Messages
101
I replied to this before the database fuckery with a response but it's gone now since the restore. Basically: store all your gates in a destructible array. Every few seconds, loop through that array and check if each gate is alive--if so, order nearby (brown?) units to attack the gate.
Alternatively, you could make the Gate Invulnerable and place a Unit on top of it that has no collision and have it act as the Gate. As this unit takes damage you could then damage the gate, or just detect when the Unit dies and Destroy the gate in response. Not the cleanest solution but it gets the job done.

You could then give the Gate Unit an attack that deals 0-0 damage or some ability on autocast that draws aggro if the AI still ignores it.
I will try both variants, thank you
 
Status
Not open for further replies.
Top