Preventing Friendly Fire

Level 2
Joined
Jul 28, 2011
Messages
8
Heya people, making a map in which I have triggers that are activated when units are killed. I need to make it so that allies can't kill eachother's units and exploit the triggers I've made.

I've seen it on a few maps where when you manually press 'a' and click on an ally's unit it won't allow you to attack it. Anyone know how it's done?
 

Dr Super Good

Spell Reviewer
Level 62
Joined
Jan 18, 2005
Messages
27,047
There are 2 ways...

1. Go through all effects and weapons that deal damage and make them exclude friendly units as a valid target.
2. Use a trigger that detects when a unit tries to attack a friendly unit and then orders the units to stop the attack order. You would still need to do 1 for all the effects.
 
Level 25
Joined
May 11, 2007
Messages
4,656
A unit is attacked by an unit
condition: player(owner of attacking unit) equal to player(owner of attacked unit)
action
unit issue order - order attacking unit to stop.

Sorry for the bad layout, but you get the idea.
 
Top