*Trigger Help* Allies unable to attack.

DJSTONE

Active Member
Reaction score
0
How do I make a trigger where allies are unable to attack each other, but can still attack enemy/neutral units.

Thanks.
 

X-maul

AKA: Demtrod
Reaction score
201
Well you could make a trigger with an event that checks when an attack order is issued, and if the target it allied to the owner, then order the unit to stop.

OR you could make the weapon target filter not include allies.
 

DJSTONE

Active Member
Reaction score
0
Well you could make a trigger with an event that checks when an attack order is issued, and if the target it allied to the owner, then order the unit to stop.

OR you could make the weapon target filter not include allies.


That is what I've been trying to find, but I can't find "target is allied" anywhere in triggers conditons etc..
 

DJSTONE

Active Member
Reaction score
0
You know what let me rephrase this. How do I make a trigger where I can't attack certain(of my choice) units?
 

Carnerox

The one and only.
Reaction score
84
If you still haven't figured it out, you can try something like this.

Trigger:
  • No Attack
    • Events
      • Unit - Any Unit is issued an order to Attack
    • Local Variables
      • attacker = (Triggering unit) <Unit>
      • target = (Target unit for (Triggering order)) <Unit>
      • attackerOwner = (Owner of attacker) <Integer>
      • targetOwner = (Owner of target) <Integer>
      • targetLocation = (Position of target) <Point>
    • Conditions
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • And
            • Conditions
              • ------- The main unit who you don't want to attack certain units.
              • (Unit type of attacker) == Marine
              • ------- Make sure the attacker and target are allies.
              • (Player attackerOwner treats player targetOwner as Ally) == True
              • Or
                • Conditions
                  • ------- The filtered units that you don't want the attacker to be able to attack.
                  • (Unit type of attacker) == Marauder
                  • (Unit type of attacker) == Medivac
                  • (Unit type of attacker) == SCV
                  • (Unit type of attacker) == Reaper
                  • (Unit type of attacker) == Siege Tank (Siege Mode)
                  • (Unit type of attacker) == Siege Tank (Tank Mode)
        • Then
          • ------- This can be changed to anything, like ordering the attacker to just stop in his tracks or anything else you have in mind.
          • Unit - Order attacker to ( Move targeting targetLocation) (Replace Existing Orders)
        • Else
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top