• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,229
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