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

All Neutral Hostile Units regen health when unengaged

Status
Not open for further replies.
Level 2
Joined
Jul 29, 2017
Messages
4
Hello guys, I am in a pickle. I'm trying to make that every 30 second of the game, a trigger checks if ANY neutral hostile unit is attacking or being attacked, if they are, nothing happens, but when they are not doing anything (nor attacking or being attacked) they gain an ability which i already have that regenerates their health completely.
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
I think this should do the trick. When a neutral unit isn't engaged in combat, it's current order should be "none".

the part I didn't include here - make a unit group that includes all neutral hostile units. I don't know if your map has preplaced units or spawns units so I didn't bother making the trigger, but just stick them all in one unit group (here i called it CreepGroup). That way you don't have to keep creating and destroying the same unit group (redundant and uses unnecessary memory).


  • periodic heal
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (CreepGroup) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (Order(none))
            • Then - Actions
              • Unit - Set life of (Picked unit) to 100.00%
            • Else - Actions
good luck!
 
Level 23
Joined
Apr 3, 2018
Messages
460
This will not work as intended, because units do not necessarily get orders when they acquire a target.
Just tested it by placing a neutral hostile rifleman and checking its order every second, the order remains at 0 even while it fights player's units.

Autoattack works in order (tested it in an empty map):
  • EVENT_UNIT_ACQUIRED_TARGET fires when a suitable enemy is found while the unit was in a neutral state
  • EVENT_UNIT_TARGET_IN_RANGE and EVENT_PLAYER_UNIT_ATTACKED fire with each attack
  • the whole time the unit's current order does not actually change

Maybe this system will be helpful:
 
Last edited:
Status
Not open for further replies.
Top