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
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top