Warcraft III resources & community, 2003–2006 · archived

Prevent "friendly fire"

16 posts
#1

Prevent "friendly fire"

Can someone please tell me a nice trigger, or tell me were i can find one here, thet prevents allies from attacking eachother. I'vve tried simple ones, like just order unit to stop, but its kinda buggy and only works from time to time.
#2
In Object Editor, manipulate with unit's Target Allowed property to make unit not able to attack allies.
#3
exactly how do i do that, theres no "non friendly" i can fill in...

Maybe just fill in enemy works.
#4
No, it's under ally or something.
#5
I think he's talking about ordering a unit to attack a friendly, not the effect of a spell or something. You could copy DOTAs way and make it so when you attack a friendly unit, the attacking unit turns into a sheep.
#6
noobystance is trying to get him to edit unit data in the Object Editor. As you know, you can choose what unit-type a unit can attack. As long as you remove allied and add enemy, you can't attack allies.
#7
You can still order a unit to attack a friendly unit... Example: You have two grunts, you click the attack icon and select your other grunt.
Example: You have a grunt and your ally has a grunt, you can order you grunt to attack his grunt.

Those fields in the unit object editor only apply to the units AI, it is still capable of attacking other things.
#8
Event: Unit is attacked
Conditions: Boolean - ((Owner of attacking unit) is an ally of (owner of attacked unit) equal to TRUE)
Actions: Unit - Order Attacking unit to (Stop), Unit (Pause) (Attacking unit), wait 2 seconds, Unit (unpause) (attacking unit).


That will stop from attacking and make thier unit freeze for 2 second penalty. This has always worked for me along with:
Event: Unit is attacked
Condition: Boolean - ((Owner of attacking unit) is an ally of (owner of attacked unit) equal to TRUE)
Actions:
  Unit - Order (attacking unit) to stop
  Set Penalty[Player number of attacking unit] = Player[player number of attacking unit] + 1
  If/then/else
    If Integer - Player[player number of attacking unit] equal to 3
    then Unit - Kill attacking unit, Game - Display to [owner of attacking unit]: You have tried to team kill to many times!
    else Do nothing


For that make Player an integer variable with however many numbers of players as the array, then it sets it to +1, so pretty much if they attack 3 times thier guy dies... Good in a resident evil game i suppose... You could go with a smaller penalty like gold loss, turn em into a sheep (;) kam) or just freeze em again. You can also add a wait then set it to -1, so if they try to attack 3 times in 2 seconds it happens etc...
#9
Ok, im gonna use one of thoose triggers, since the "targets allowed" are just data on the units AI.

But while were talking about sheeps, how to turn it into a sheep? Do you need dummy units?, cause i havent learned to use dummy units yet...

If not, just tell me the trigger... :)
#10
KamYou can still order a unit to attack a friendly unit... Example: You have two grunts, you click the attack icon and select your other grunt.
Example: You have a grunt and your ally has a grunt, you can order you grunt to attack his grunt.

Those fields in the unit object editor only apply to the units AI, it is still capable of attacking other things.


no, you're completely wrong. If in the object editor it has enemy checked and allied unchecked when you try to target an ally it will say 'Cannot target allied units'
#11
With a spell, jesus. The basic attack can target your own units. Do I really have to make a video for you when you can just play any wc map and see for yourself? I just did it, took me two secs to map a new map to test. You do it.
#12
KamWith a spell, jesus. The basic attack can target your own units. Do I really have to make a video for you when you can just play any wc map and see for yourself? I just did it, took me two secs to map a new map to test. You do it.


But does the unit attack himself? no... thats what the guy needs
#13
Man, yhis is one hot discussion... :shock:
Just to get things sorted out, i meant a trigger to prevent "assholes" from using the "attack" aiming to kill allied players on my map.

And to add my own opinion, to fill in the boxes in "targets allowed" didnt work for me. I had no allied or friend, but i had enemy signed as a target, but i could still attack my allies.

I will use trigger, since that also punishes the player who attacks...
#14
Events

A unit is attacked

Conditions

(Owner of (Attacking unit)) Not equal to (Owner of (Attacked unit))
(((Attacked unit) is A ground unit) Equal to true) or ((((Attacked unit) is A flying unit) Equal to True) or (((Attacked unit is A structure) Equal to True))
((Attacked unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True
((Attacked unit) is A neutral unit) Equal to False

Actions

Unit - Explode (Attacking unit)
#15
hehe that was to much punishing for the little incident someone would do, i dont like blowing up people... :P