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.
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.
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.
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.
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...
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'
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.
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
Man, yhis is one hot discussion... 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...
(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