• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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 63
Joined
Jan 18, 2005
Messages
27,191
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,651
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