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

Checking is there an enemy nearby

Status
Not open for further replies.
Level 6
Joined
Apr 20, 2007
Messages
232
I tried a lot of variations , yet none of them work.

PaladinArmy1 is a unit group variable.
Paladin1 is the unit that the army belongs to.

There is a trigger like this :
  • Events
    • Time - Every 5.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Order PaladinArmy1 to Follow Paladin1
And so , they allways follow their leader. Though there's a problem with fighting. I made a lot of triggers , but they all failed. All I want is that the trigger would check , if there are enemies nearby , or if the paladin1 is under attack (or whole PaladinArmy1). For example , I made this change :
  • Events
    • Time - Every 5.00 seconds of game time
  • Conditions
    • Paladin1 Not equal to (Attacked unit)
  • Actions
    • Unit Group - Order PaladinArmy1 to Follow Paladin1
It still didn't worked. Any suggestions ? Or it is impossible without the jass *scary music* ?
 
Level 4
Joined
Jun 1, 2007
Messages
92
If you want the army to attack anything in sight then follow the paladin. You could order the army to attack-move to the position of Paladin1. However in this way, even if the paladin1 runs away, his army will still fight anything it sees.
 
Level 22
Joined
Feb 26, 2008
Messages
891
> I tried it. They don't follow at all.

Works for me....

  • Untitled Trigger 002
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Right-Click Paladin 0001 <gen>
 
Level 6
Joined
Apr 20, 2007
Messages
232
> I tried it. They don't follow at all.

Works for me....

  • Untitled Trigger 002
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Right-Click Paladin 0001 <gen>

The thing is , I want them to stop following while in battle. Your idea is better than mine , sure , 'cause they attack at all , but in battle , every two seconds they return to their leader , which makes them crapy. I need a trigger to turn this off while in battle , or a good condition , 'cause I tried a lot and none of them worked ;( .
 
Level 4
Joined
Jun 1, 2007
Messages
92
This simply follows
  • follow
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Order unitgroup to Follow paladin1
When the paladin takes damage, it turns off the following and orders the army to attack.
  • take damage
    • Events
      • Unit - Scout Tower 0000 <gen> Takes damage
    • Conditions
    • Actions
      • Set Action_Time = 5.00
      • Trigger - Turn off follow <gen>
      • Unit Group - Order unitgroup to Attack (Damage source)
This trigger counts down and when the paladin doesn't take damage for 5 seconds, they resume following instead of fighting.
  • action timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Action_Time = (Action_Time - 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Action_Time Equal to 0.00
        • Then - Actions
          • Trigger - Turn on follow <gen>
          • Unit Group - Order unitgroup to Follow paladin1
        • Else - Actions
The only downsides is if the attacking unit is unreachable.
 
Level 6
Joined
Apr 20, 2007
Messages
232
This simply follows
  • follow
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Order unitgroup to Follow paladin1
When the paladin takes damage, it turns off the following and orders the army to attack.
  • take damage
    • Events
      • Unit - Scout Tower 0000 <gen> Takes damage
    • Conditions
    • Actions
      • Set Action_Time = 5.00
      • Trigger - Turn off follow <gen>
      • Unit Group - Order unitgroup to Attack (Damage source)
This trigger counts down and when the paladin doesn't take damage for 5 seconds, they resume following instead of fighting.
  • action timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Action_Time = (Action_Time - 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Action_Time Equal to 0.00
        • Then - Actions
          • Trigger - Turn on follow <gen>
          • Unit Group - Order unitgroup to Follow paladin1
        • Else - Actions
The only downsides is if the attacking unit is unreachable.

That was really 1337. Thanks :). I didn't thought of using variables , next time I'll allways do.

~Solved :)
 
Last edited:
Status
Not open for further replies.
Top