• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

NO ATTACK ON ALLIES TRIGGER

Status
Not open for further replies.
Level 4
Joined
Feb 27, 2006
Messages
49
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)
 
Level 10
Joined
Jul 14, 2004
Messages
463
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:
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
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:
 
Level 6
Joined
Feb 18, 2005
Messages
263
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)
 
Status
Not open for further replies.
Top