Warcraft III resources & community, 2003–2006 · archived

NO ATTACK ON ALLIES TRIGGER

8 posts
#1

NO ATTACK ON ALLIES TRIGGER

how do i make trigger that stops players from attacking their allies like in the early dota versions a player would get hexed if they try to attack their allies

i made this trigger but it doesn't work

Unit - A unit Is attacked
Conditions
((Attacked unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True
Actions
Unit - Create 1 Dummy for (Owner of (Attacked unit)) at (Position of (Attacking unit)) facing Default building facing degrees
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
#2
Hex can't be casted on allied units if you use the standart hex.
And you should use
Unit - issue order (attacking unit) to stop
#3
I actually don't see why your trigger doesn't work, but since allies don't attack each other you could try to use as event "a unit gets an order targeting on a unit" and as conditions
-targeted unit belongs to an enemy of owner of (triggering unit())
-order not equal to "move"
-order not equal to "patrol"
-order not equal to "smart"

This should also work against spells... try it out and post the results! :wink:
#4
Events:
Generic Unit Event: A unit Is attacked

Actions:
If/Then/Else:

If:
Boolean Comparison: If (((Attacked Unit) belongs to an ally of (Owner of (Attacking Unit))) Equal to True)
Then:
Unit - Issue order with no Target: Order (Attacking Unit) to Stop
Else:
Do Nothing


I've tested this one and it works. Good luck with your map :wink:
#5
Like Waldbär said thats not the clean way.
It is possible to hurt allies once. So you may kill them by fast re-attacking
Use target events instead. It prevents selection of allies
#6
thanks apocalypse_dude your advice worked! now one can attack their allies in my thanks alot
#7
Of course, you can make it so that it's impossible to order a unit to attack friends. Just make targets have enemy true.
#8
i wouldn't even use a trigger for this. That only increase the possibility for lags, for there is an additional event registered, that needs to be checked...

i would simply edit the 'targets' for the attacks and abilites. if you put it like '(air), ground, neutral, enemy, ...' you acn not attack a friend - its not specified ^^

it might be some more work, but in the end, your map is quite faster (and it's easier)