• 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.

Preventing Friendly Fire

Status
Not open for further replies.
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 64
Joined
Jan 18, 2005
Messages
27,258
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,650
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.
 
Status
Not open for further replies.
Top