• 🏆 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!

How can i stop auto-attacking

Status
Not open for further replies.
Level 13
Joined
Mar 4, 2009
Messages
1,156
i have one unit called main human and enemy units are always auto attacking him

even while some structure is attacking the enemy if the main human comes near that enemy,than the enemy will want to kill him instead the structure that is attacking him
 
Level 8
Joined
Aug 1, 2008
Messages
420
Well what you could do is something like this... i dont know if it will work though.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Triggering unit) Equal to (*your unit*)
    • Actions
      • Unit - Add Invulnerable (Neutral) to (Attacked unit)
Then add a wait, then remove it or something. im not sure..
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Target unit of issued order)) Equal to Main Human
          • (Issued order) Equal to (Order(attack))
    • Actions
      • Set TempPoint = (Position of (Ordered unit))
      • Set TempGroup = (Units within (Current acquisition range of (Ordered unit)) of TempPoint matching (((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to (Target unit of issued order))) and (((Owner of (Matching unit)) is an enemy of (Owner of (Ordered
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than 0
        • Then - Actions
          • Unit - Order (Ordered unit) to Attack (Random unit from TempGroup)
        • Else - Actions
  • Custom script: call DestroyGroup(udg_TempGroup)
  • Custom script: call RemoveLoaction(udg_TempPoint)
Meh, Something like this?
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Target unit of issued order)) Equal to Main Human
          • (Issued order) Equal to (Order(attack))
    • Actions
      • Set TempPoint = (Position of (Ordered unit))
      • Set TempGroup = (Units within (Current acquisition range of (Ordered unit)) of TempPoint matching (((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to (Target unit of issued order))) and (((Owner of (Matching unit)) is an enemy of (Owner of (Ordered
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than 0
        • Then - Actions
          • Unit - Order (Ordered unit) to Attack (Random unit from TempGroup)
        • Else - Actions
  • Custom script: call DestroyGroup(udg_TempGroup)
  • Custom script: call RemoveLoaction(udg_TempPoint)
Meh, Something like this?

not really but close (good event)

BTW enemies MUST be able to attack the main human...

but i could do something like


(Issued order) Equal to (Order(attack))
(target of ordered unit) equal unit of type (main human)

if (ordered unit) is <very close (100 range)> (target of ordered unit) not equal to true
ACTION
order (ordered unit) to attack random unit <very close (100 range)> (ordered unit)


but the problem is if player will really want to attack the main human his unit will not do it and he will be ordered to attack random unit near himself

{EDIT}
you can see what am i taking about if you do

-you unit with attack (main human)
-your enemy unit with attack
-unit with no attack

than put 50 units with no attack around the enemy and when your unit with attack comes he will want to attack him
 
Last edited by a moderator:
Level 13
Joined
Mar 4, 2009
Messages
1,156
Why can't you just change the priority in the Object Editor?

Priority will not work

{EDIT 1}
ok i have a solution. theres a tab in the object editor that makes the person a worker, ancient ect. make him a worker and he'll stop auto-attacking.

but that is bad because enemy unit will not want to attack any unit
i just want him to treat main human like unit that hes no attack

i have one idea,i could remove attack from the main human

i need spell that will be his attack (good because his classification is >worker< and he will never want to attack enemies anyway)

{EDIT 2}
this works great for me i used attack icon ReplaceableTextures\CommandButtons\BTNAttack.blp
I don´t know how to put (ability chain) icon on the attack place (up-right)

i used this but it doesn´t work if you have (summon building) ability
Normal(X) 0
Normal(Y) 0
Turn Off(X) 2
Turn Off(Y) 0
 
Last edited by a moderator:
  • Angry
Reactions: Rui
Status
Not open for further replies.
Top