• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Attack priority

Status
Not open for further replies.
Level 4
Joined
Aug 17, 2008
Messages
81
I think you want to go into object editor and set each of the heroes priority lower than the other units.

Then you need to make a trigger like this for making the towers attack heroes defensively.

  • Tower Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A Hero) Equal to True
      • ((Attacked unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Attacking unit)) matching (((matching unit) is A structure) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
              • ((Picked unit) belongs to an ally of (Owner of (Attacked unit))) Equal to True
              • ((Attacking unit) is in (Units within 512.00 of (Position of (Picked unit)))) Equal to True
            • Then - Actions
              • Unit - Order (Picked unit) to Attack (Attacking unit)
            • Else - Actions
              • Do nothing
This trigger would make any structure in 512 range attack your hero if you attacked an enemy hero on their team if you aren't on their team.
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
I edited the trigger of Tazuwukie

It is now leak free and also I ensure that it doesn't detect dead towers.


  • Tower Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A Hero) Equal to True
      • ((Attacked unit) is A Hero) Equal to True
    • Actions
      • Set temp_loc1= Position of Attacking Unit
      • Set temp_group = Units within 600 distance of temp_loc1 matching (((matching unit) is A structure) Equal to True)) and (matching unit) is alive) Equal to True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
              • ((Picked unit) belongs to an ally of (Owner of (Attacked unit))) Equal to True
            • Then - Actions
              • Unit - Order (Picked unit) to Attack (Attacking unit)
            • Else - Actions
              • Do nothing
  • Custom script: call RemoveLocation(udg_temp_loc1)
  • Custom script: call DestroyGroup(udg_temp_group)
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
Actually all towers/units attack no matter a unit or hero that has low hp or when trying to kill a hero, I think it's a code script like AI order. I usualy backup the targeted unit but to prevent this from happening you'll need to trigger like these guys said ^^
 
Status
Not open for further replies.
Top