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

Force to attack unit

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
731
Hi,

In my map I have a spell which randomly makes them target a nearby unit (ally or enemy). This is meant to be so that they start attacking their allies or it backfires and they attack you instead. This target wouldn't change until the target dies.

So anyway I was thinking of changing it so that the entire spell is about them being forced to attack specific targets but I don't know how I'd make any other orders to attack other units would be overridden.

Thoughts?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
1)You change owner of forced units to a temporary player, so their owners can't control them to stop.

2)First you order your units to attack, then you periodically order them again and again.There are 2 ways of doing this.You either need to use a periodic trigger with low timeout, or you will have another trigger that detects order.
 
Level 13
Joined
Oct 16, 2010
Messages
731
In the second one what would I need to detect? I know you can detect all orders but wouldn't it cause an infinite loop if they attack the target then get re-ordered to attack them via trigger constantly? How would I filter whether they are attacking their target?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Well, you simply won't reorder if unit is again attacking the target you want.All other orders including attack will be reordered, except that one case.
 
Status
Not open for further replies.
Top