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

Can we detect unit doing "nothing" for x seconds?

Level 17
Joined
Jun 2, 2009
Messages
1,141
Hello everyone. I want to detect specific unit not moving, atacking, casting spells for 4 seconds.

Details: Your hero becomes invisible if stays 4 seconds.

Is there a way to check this?
No need to be a mui. Only 1 unit can do this in my map.
 
Level 20
Joined
Feb 27, 2019
Messages
593
There is an ability called permanent invisibility that makes units invisible if they dont attack or cast spells. That does not account for moving. The move part could be handled by checking if the unit is located at the same location or co-ordinate after a time. If true, then add permanent invisibility and set a boolean to true, if false remove permanent invisibility and set a boolean to false.

In never versions there is the ability shadow meld (item) but it causes the unit to not auto-target enemies when the ability is pressed, not when it activates automatically. I dont know if permanent invisibility auto-targets enemies or not.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,853
If is a passive ability, you can just use the night elf ambush ability, in case that you wanna the unit can move after that, so you can check in a periodic timer if the unit is not doing anything for 4 seconds then adding the invisibility:
  • Timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of <Your unit>) Equal to (Order(<Empty String>))
        • Then - Actions
          • Set VariableSet Counter = (Counter - 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Counter Less than or equal to 0.00
            • Then - Actions
              • -------- Add invisibility --------
            • Else - Actions
        • Else - Actions
          • Set VariableSet Counter = 4.00
If the ability is active then you can just set the cast time to 4 seconds (because the caster do anything while casting) and when the spell effect is triggered add the invisibility, so in case of being interrupted it won't cast.
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
You can't really do that as far as I know.
What kind-of works is setting unit's Combat - Acquisition range to 1.0 (setting it to 0.0 or negative values had no effect, at least on v1.36). However if an enemy unit touches the unit with acquisition range '1.0', then the unit will auto-attack the enemy anyway.

The only units that do not auto-attack are units with Unit classification 'Worker'. The downside is that those units do not auto-attack even if they are attacked themselves and they show as idle workers (the idle worker icon above minimap).
 
Top