[Trigger] Attacking priority GUI Trigger

Status
Not open for further replies.
Level 5
Joined
Feb 18, 2016
Messages
96
Hello
I am trying to finish this trigger that should make certain units(buildings in this case) stop from attacking heros and change the objective of the order to another random non hero unit in their range

My problem is that i can not create the action

  • nohero attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A structure) Equal to True
      • ((Attacked unit) is A Hero) Equal to True
    • Actions
      • Set APOINTTEMP = (Position of (Attacking unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 700.00 of APOINTTEMP) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ???
            • Then - Actions
              • ???
            • Else - Actions
      • Custom script: call RemoveLocation (udg_APOINTTEMP)
Keep in mind that if no non-hero unit is found near the range would mean that the trigger should not modify the building objective
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
There are better ways to do this in JASS, but that's how I would do it in GUI.
btw Triggering unit = Attacked unit
  • NotAttackHeroes
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A structure) Equal to True
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set TempPoint = (Position of (Attacking unit))
      • Set TempGroup = (Units within 700.00 of TempPoint)
      • Set TempBoolean = True
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempBoolean Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is an enemy of (Owner of (Attacking unit))) Equal to True
                  • ((Picked unit) is A Hero) Equal to False
                • Then - Actions
                  • Set TempBoolean = False
                  • Unit - Order (Attacking unit) to Attack (Picked unit)
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 5
Joined
Feb 18, 2016
Messages
96
Mine is almost same as yours
  • nohero attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A structure) Equal to True
      • ((Attacked unit) is A Hero) Equal to True
    • Actions
      • Set APOINTTEMP = (Position of (Attacking unit))
      • Set AAATEMPGROUP = (Units within 700.00 of APOINTTEMP)
      • Set TEMPBOOL = True
      • Unit Group - Pick every unit in AAATEMPGROUP and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TEMPBOOL Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is an enemy of (Owner of (Attacking unit))) Equal to True
                  • ((Picked unit) is A Hero) Equal to False
                • Then - Actions
                  • Set TEMPBOOL = False
                  • Unit - Order (Attacking unit) to Attack (Picked unit)
                • Else - Actions
            • Else - Actions
      • Custom script: call RemoveLocation (udg_APOINTTEMP)
      • Custom script: call DestroyGroup(udg_AAATEMPGROUP)
 
Status
Not open for further replies.
Top