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)
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
Waldbaer
#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!
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
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
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)