Snippet Making it So Allies Can't Attack Allies

Nets8

New Member
Reaction score
1
This will fix any cheaters and back stabbers on your map. It's a big ass trigger to function not being able to attack allies. Basically what it is saying is that if a unit of a player is attacked by an ally, the triggering unit will be paused for five game-seconds and then unpaused.

Code:
allies cant attack allies
    Events
        Unit - A unit owned by Player 12 (Brown) Is attacked
        Unit - A unit owned by Player 11 (Dark Green) Is attacked
        Unit - A unit owned by Player 10 (Light Blue) Is attacked
        Unit - A unit owned by Player 9 (Gray) Is attacked
        Unit - A unit owned by Player 8 (Pink) Is attacked
        Unit - A unit owned by Player 7 (Green) Is attacked
        Unit - A unit owned by Player 6 (Orange) Is attacked
        Unit - A unit owned by Player 5 (Yellow) Is attacked
        Unit - A unit owned by Player 4 (Purple) Is attacked
        Unit - A unit owned by Player 3 (Teal) Is attacked
        Unit - A unit owned by Player 1 (Red) Is attacked
        Unit - A unit owned by Player 2 (Blue) Is attacked
    Conditions
        ((Triggering player) is an ally of Player 12 (Brown)) Equal to True
        ((Triggering player) is an ally of Player 11 (Dark Green)) Equal to True
        ((Triggering player) is an ally of Player 10 (Light Blue)) Equal to True
        ((Triggering player) is an ally of Player 9 (Gray)) Equal to True
        ((Triggering player) is an ally of Player 8 (Pink)) Equal to True
        ((Triggering player) is an ally of Player 7 (Green)) Equal to True
        ((Triggering player) is an ally of Player 6 (Orange)) Equal to True
        ((Triggering player) is an ally of Player 5 (Yellow)) Equal to True
        ((Triggering player) is an ally of Player 4 (Purple)) Equal to True
        ((Triggering player) is an ally of Player 3 (Teal)) Equal to True
        ((Triggering player) is an ally of Player 2 (Blue)) Equal to True
        ((Triggering player) is an ally of Player 1 (Red)) Equal to True
    Actions
        Unit - Pause (Triggering unit)
        Wait 5.00 game-time seconds
        Unit - Unpause (Triggering unit)

Have fun!
 
Are you serious? This trigger does nothing. Meaning that people will still be able to attack each other. The trigger does not stop them from attacking, it does nothing at all. The action Do Nothing does just that - nothing.
 
Then why is there something like that for actions? Then if someone picks that they shouldn't have a trigger at all?
 
> Then why is there something like that for actions?

I have no idea, but that action is pretty pointless. Don't ever use it. It just takes up unnessary RAM.

> Then if someone picks that they shouldn't have a trigger at all?

Well, the trigger will do nothing.
 
I'm kind of new to this. I have my own map and it is pretty decent. A gate system and stuff. Then what would you do so allies can't attack allies?
 
> Then what would you do so allies can't attack allies?

You would order the attacking unit to stop.
 
Making it So Allies Can't Attack Allies FIXED

This will fix any cheaters and back stabbers on your map. It's a big ass trigger to function not being able to attack allies. Basically what it is saying is that if a unit of a player is attacked by an ally, the triggering unit will be paused for five game-seconds and then unpaused.

Code:
allies cant attack allies
    Events
        Unit - A unit owned by Player 12 (Brown) Is attacked
        Unit - A unit owned by Player 11 (Dark Green) Is attacked
        Unit - A unit owned by Player 10 (Light Blue) Is attacked
        Unit - A unit owned by Player 9 (Gray) Is attacked
        Unit - A unit owned by Player 8 (Pink) Is attacked
        Unit - A unit owned by Player 7 (Green) Is attacked
        Unit - A unit owned by Player 6 (Orange) Is attacked
        Unit - A unit owned by Player 5 (Yellow) Is attacked
        Unit - A unit owned by Player 4 (Purple) Is attacked
        Unit - A unit owned by Player 3 (Teal) Is attacked
        Unit - A unit owned by Player 1 (Red) Is attacked
        Unit - A unit owned by Player 2 (Blue) Is attacked
    Conditions
        ((Triggering player) is an ally of Player 12 (Brown)) Equal to True
        ((Triggering player) is an ally of Player 11 (Dark Green)) Equal to True
        ((Triggering player) is an ally of Player 10 (Light Blue)) Equal to True
        ((Triggering player) is an ally of Player 9 (Gray)) Equal to True
        ((Triggering player) is an ally of Player 8 (Pink)) Equal to True
        ((Triggering player) is an ally of Player 7 (Green)) Equal to True
        ((Triggering player) is an ally of Player 6 (Orange)) Equal to True
        ((Triggering player) is an ally of Player 5 (Yellow)) Equal to True
        ((Triggering player) is an ally of Player 4 (Purple)) Equal to True
        ((Triggering player) is an ally of Player 3 (Teal)) Equal to True
        ((Triggering player) is an ally of Player 2 (Blue)) Equal to True
        ((Triggering player) is an ally of Player 1 (Red)) Equal to True
    Actions
        Unit - Pause (Triggering unit)
        Wait 5.00 game-time seconds
        Unit - Unpause (Triggering unit)

Have fun!
 
Don't start a whole new thread. Simply edit your existing trigger. Also, I don't think there is a Triggering Player, either. And another thing is you can't have all of those conditions be true at the same time. A much better and more efficient way would be like this:

Code:
Stop Attacks
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Attacking unit)) is an ally of (Owner of (Attacked unit))) Equal to True
            Then - Actions
                Unit - Order (Triggering unit) to Stop
            Else - Actions
 
> Done.

However, the trigger doesn't work.

1. You can't have all of those conditions be true at the same time. That would mean that the owner of the unit is allied to everyone.

2. There is no Triggering Player. You have to use Owner of Triggering Unit.
 
and you gotta have the conditions set as if like one happens, because it wont work if theres like 20 conditions, and you only need one for the player. so make it

If (ANY) conditions are true THEN actions
 
> If (ANY) conditions are true THEN actions

That would be an OR comparison.
 
Correct me if I'm wrong, but I believe the Unit is Attacked event is for attack orders On Striking, and I was able to attack my allies (with similar functions) if clicked fast enough. I would imagine that a order comparison would be better. But then again, I dunno, never tried it :D . Why do so many ppl want Anti-FF triggers these days anyway =/. Just make them pay the price :p.
 
Also, this is alot of un-needed GUI..

Try

Events
Unit - A Unit is Attacked
Conditions
Any of the Conditions are true:
Unit - Owner of (Attacking Unit) is equal to (Player 1 (Red))
..etc
Actions
If/Then/Else
If Attacked Unit = Ally to owner of Attacking Unit
Then
. Unit - Order Unit to Stop
 
> Also, this is alot of un-needed GUI..

Try

o_O I think I covered that:

Code:
Stop Attacks
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Attacking unit)) is an ally of (Owner of (Attacked unit))) Equal to True
            Then - Actions
                Unit - Order (Triggering unit) to Stop
            Else - Actions
 
Yeah, thats exactly what I was thinking of, I cant get the triggers right, because i need a new copy of my wc3 CDs so i dont have the editor with me right now.
 
Trigger
-----------------------------------------------------------------
Event:
-Unit - A unit Is attacked
Condition:
-((Owner of (Attacking unit)) is an ally of (Owner of (Attacked unit))) Equal to True
Action:
-((Owner of (Attacking unit)) is an ally of (Owner of (Attacked unit))) Equal to True
-Unit - Order (Attacking unit) to Stop
-Unit - Pause (Attacking unit)
-Special Effect - Create a special effect attached to the overhead of (Attacking unit) using Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
-Wait 0.50 seconds
-Special Effect - Destroy (Last created special effect)
-Wait 14.00 seconds
-Unit - Unpause (Attacking unit)
-----------------------------------------------------------------------
Worked for me ^^
 
14 seconds seems kind of long doesnt it? And wouldn't that trigger cause leaks because the special effect isnt designated to a variable?>
 
Ghan gave you the solution but usually submissions are for working triggers... ;)
 
use this :
-------------------------------------------------
Event:

Unit is Attacked
-------------------------------------------------
Condition:

Attacking unit belongs to an ally of attacked unit
-------------------------------------------------
Action:

Unit - Order Attacking Unit to Stop
-------------------------------------------------
So much shorter ;)
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top