[GUI-Triggers] Can't attack friendly units.

Epicgamers

New Member
Reaction score
5
Hello, Once again =]

Can someone please tell me how/if it can't be easier.
That you can't attack friendly units with 'Attack Command'?
Cause im making a RPG and it will be stupid that you kill the whole town.

And i can't make them invurnerable cause enemies may kill the guards =]


thank you,

RodyIsGod
 

AgentPaper

From the depths, I come.
Reaction score
107
Give them a classification like "ancient" or some such, and then set it so that the hero unit cannot attack ancients.
 

blooman

New Member
Reaction score
16
Trigger:
  • dd
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Player Group - Pick every player in Team1 and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Targeted unit)) Equal to (==) (Picked player)
            • Then - Actions
              • Unit - Order (Ordered unit) to Stop
            • Else - Actions
You can try like that
Give them a classification like "ancient" or some such, and then set it so that the hero unit cannot attack ancients.

Also that Wouldnt work cuz maybe all the players might be the same units
and you can change the attack to Enemy only
 

simonake

New Member
Reaction score
72
Trigger:
  • Anti-Friendly fire
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Attacking unit) belong to an Ally of (Owner of (Attacked unit) Equal to TRUE)
    • Actions
      • Unit - Order (Attacking unit) to Stop

Done as it is in Dota Template.
 

blooman

New Member
Reaction score
16
Trigger:
  • Anti-Friendly fire
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Attacking unit) belong to an Ally of (Owner of (Attacked unit))
    • Actions
      • Unit - Order (Attacking unit) to Stop
Lol it was that ez? Wow im a dumb@ssXD
 

the_ideal

user title
Reaction score
61
Or, more simply:
Code:
Event - A unit is attacked
Condition - Boolean - (Owner of (Triggering Unit)) is an ally of (Owner of (Attacking Unit)) Equal to (True)
Action - Order (Attacking Unit) to (Stop)

edit: woah, fast posts. I have been bested.
 

AgentPaper

From the depths, I come.
Reaction score
107
Hm, forgot about enemy only, that would be the best option. There's no need to trigger this, at any rate.
 

Epicgamers

New Member
Reaction score
5
Trigger:
  • dd
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Player Group - Pick every player in Team1 and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Targeted unit)) Equal to (==) (Picked player)
            • Then - Actions
              • Unit - Order (Ordered unit) to Stop
            • Else - Actions
You can try like that


Also that Wouldnt work cuz maybe all the players might be the same units
and you can change the attack to Enemy only

Ur trigger doesn't work either.
Or how you got pick every player in TEAM1.
How you got team 1? if its a variable which should i use.
 

blooman

New Member
Reaction score
16
Ur trigger doesn't work either.
Or how you got pick every player in TEAM1.
How you got team 1? if its a variable which should i use.
Team 1 is a player group variab;e
Mkae a trigger which adds players to the player group
I just used that trigger cuz it was in the map i was making lol so trust simonake
 

Epicgamers

New Member
Reaction score
5
Woah, 3 posts while i was trying his code.
Well thank you, yours was way clearer.

Thank you for trying too Blooman, then it would probably worked, but ya i got for the easiest =]

THANKS!
 

blooman

New Member
Reaction score
16
Woah, 3 posts while i was trying his code.
Well thank you, yours was way clearer.

Thank you for trying too Blooman, then it would probably worked, but ya i got for the easiest =]

THANKS!
Waah You didnt pick mineD::mad::mad:
JkXD:shades:at least ty for trying mines out
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Team 1 is a player group variab;e
Mkae a trigger which adds players to the player group
I just used that trigger cuz it was in the map i was making lol so trust simonake

Lolz, I think simonake is a noob.
 

AgentPaper

From the depths, I come.
Reaction score
107
Have you tried setting the hero's attacks so that they can only target and affect enemies? Using a trigger just adds in more work for the computer (not much, but it adds up) and makes the whole deal less reliable. If there's a bit of lag or a lot of triggers running at once, it could take a while before the trigger kicks in. Just disallowing attacking allies in the first place on the other hand would remove that much more processing power and bandwidth needed. :rolleyes:

Also, no need to go insulting others, especially when they just finished helping someone.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top