• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

My unit is attacking an enemy unit but it doesnt attack back

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
111
Scenario:

Enemy unit dark green is being attacked by my Player unit Red. While I'm attacking it, it's attacking my ally (Computer Blue) and will not change target to attack me, even if im very close to it.

If there are no other units around it will attack me and chase up to a point, but if its already engage with another enemy it wont change target.

Stats - Priority is given to my unit as 20 and the computer blue unit as 10..
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
well thats common except if the computer blue becomes unattackable or you could trigger it..

Event - A unit is attack

Condition - Attacked unit is an enemy of attacking unit equal to true

Action - Unit - Order attacked unit to attack attacking unit..


Although its a very simple trigger it will solve your problem (since it affects everything) but you can add additional conditions like if the attacking unit is a hero ..etc..
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
It all depends on how much agro you generate. If your unit has high health I believe they will prioritise lower health units but I am not sure if that was a map specific AI (SWAT Aftermath). There it was a big problem if you got hurt as suddenly all the zombies would prioritise you over the tank.
 
Level 5
Joined
Feb 1, 2009
Messages
111
Well my map is complex and I cant just simply issue an attack command. There's pathing, there's attack-move happening elsewhere, and if I just issue an attack command it would only last for that 1 instance while I need it throughout the game.

I mean if Enemy unit A -> attacks allied computer B

but

Player controlled C (allied to B) attacks enemy unit A , i want A to change aggro to C ... (me)

Gameplay constants:
Guard distance - 500
Guard return distance - 500
Guard return time - 5

Object editor:

Priority set on max (20) for A and 1 for B, although i tried doing vice versa incase I had it wrong and still no effect.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Yes, once an AI unit has locked onto a target, it will not stop attacking it until that target itself stops attacking and so loses agro. Only attacking targets have agro so they will happily change target from you when you run away onto someone who is attacking.
 
Status
Not open for further replies.
Top