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

Closer 2 attack unit

Status
Not open for further replies.
Level 21
Joined
Jan 5, 2005
Messages
3,515
i think this would work, you need to add as many players in the event as you want affected by this trigger with size needs to be changed to the distance away you want the unit to be able to attack from. there may be a problem where this region doesnt actually exist, i dont know i havent teseted it. report back whether it works or not.

[trigger:1:7e474e1cb6]
Untitled Trigger 001
Events
Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
Unit - A unit owned by Player 2 (Blue) Is issued an order targeting an object
Unit - A unit owned by Player 3 (Teal) Is issued an order targeting an object
Unit - A unit owned by Player 4 (Purple) Is issued an order targeting an object
Unit - A unit owned by Player 5 (Yellow) Is issued an order targeting an object
Unit - A unit owned by Player 6 (Orange) Is issued an order targeting an object
Conditions
(Issued order) Equal to (Order(attack))
((Owner of (Targeted unit)) is an enemy of (Triggering player)) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Region centered at (Position of (Targeted unit)) with size (0.10, 0.10)) contains (Triggering unit)) Equal to True
Then - Actions
Do nothing
Else - Actions
Unit - Order (Triggering unit) to Stop
[/trigger:1:7e474e1cb6]
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
ohoh i have a better way of doing this now! the distance thing i changed is in real comparisons under maths (math - distance between points). im confident this will work. also you MUST have the wait there or it wont work. another tip is that if you dont know the size you want in numbers, make a region and use this condition:

[trigger:1:64509fcaee]
(Distance between (Position of (Triggering unit)) and (Position of (Targeted unit))) Less than or equal to (Width of Attack Distance Region)
[/trigger:1:64509fcaee]

any ways heres what u want.

[trigger:1:64509fcaee]
Untitled Trigger 001
Events
Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
Unit - A unit owned by Player 2 (Blue) Is issued an order targeting an object
Unit - A unit owned by Player 3 (Teal) Is issued an order targeting an object
Unit - A unit owned by Player 4 (Purple) Is issued an order targeting an object
Unit - A unit owned by Player 5 (Yellow) Is issued an order targeting an object
Unit - A unit owned by Player 6 (Orange) Is issued an order targeting an object
Conditions
(Issued order) Equal to (Order(attack))
((Owner of (Targeted unit)) is an enemy of (Triggering player)) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between (Position of (Triggering unit)) and (Position of (Targeted unit))) Less than or equal to 10.00
Then - Actions
Do nothing
Else - Actions
Wait 0.10 seconds
Unit - Order (Triggering unit) to Stop
[/trigger:1:64509fcaee]
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
my triggers make it so if the unit is told to attack a target that is a more than a certain distance away it wont do anything. if you wanted it so a unit will only attack automattically withing a certain range then you can do it in object editor under aqusition range. the difference is that my trigger will stop the unit from attacking when is told to attack, while aqusition range works when the unit automattically attacks a unit in range.

having said that my trigger will work for both, but if you only want automatic attacking use aqusition as the game will lag less.
 
Status
Not open for further replies.
Top