• 🏆 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 to Check if the Unit is doing NOTHING.

Status
Not open for further replies.
Level 9
Joined
May 21, 2014
Messages
580
I don't know how to check if the unit is doing nothing.

I tried checking each current order of a unit when the unit is ordered, OR what his order is after execution of the order.

  • Test Trigger
    • Events
      • Player - Player 1 (Red) types a chat message containing c as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Current order of Rifleman 0016 <gen>)))
  • Order Checker
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All Players) the text: (String((Issued order)))
When a unit is currently patrolling after commanding him to patrol, the unit has no current order.
When a unit is doing nothing, the unit has no current order.

I have a trigger that recommands all enemy units on the map when the unit is doing nothing.
  • Recommand AI Periodic
    • Events
      • Time - RecommandTimer (Repeatable) expires
    • Conditions
    • Actions
      • Set RecommandUnitGroup11 = (Units owned by Player 11 (Dark Green) matching (((Unit-type of (Matching unit)) Not equal to Pest) and (((Current order of (Matching unit)) Equal to (Order(stop))) or ((Current order of (Matching unit)) Equal to (Order(move))))))
      • Set RecommandUnitGroup12 = (Units owned by Player 12 (Brown) matching (((Unit-type of (Matching unit)) Not equal to Pest) and (((Current order of (Matching unit)) Equal to (Order(stop))) or ((Current order of (Matching unit)) Equal to (Order(move))))))
      • Unit Group - Add all units of RecommandUnitGroup12 to RecommandUnitGroup11
      • Unit Group - Pick every unit in RecommandUnitGroup11 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack (Random unit from PlayerUnits)
      • Custom script: call DestroyGroup(udg_RecommandUnitGroup11)
      • Custom script: set udg_RecommandUnitGroup11 = null
      • Custom script: call DestroyGroup(udg_RecommandUnitGroup12)
      • Custom script: set udg_RecommandUnitGroup12 = null
Since there is no current order, the recommanding of the enemy unit will fail. Does anybody know how to check if the unit is doing nothing/has no current order?
Alternatives are welcome on how to recommand enemy units.

EDIT:
I did many tests and these are what I found:
<Empty String> is the ID of doing nothing (this includes auto-attacking though).
When a unit is under patrol, I checked two things: What the order string is when commanded, what the current order of a patrolling unit after being commanded.
When the unit is commanded to patrol, it returns the string patrol. When the unit is currently patrolling, the current order is nothing, so I assumed it to be an <Empty String>. Sadly, When i created an if-else statement, it doesn't go as an <Empty String>.
Weird...

The current order returns nothing, but it doesn't match an empty string. How should I detect when a unit is currently patrolling...? Custom Values cannot be used as I used them already. Point Values cannot be used also. Other than storing the unit in a big data structure or indexing it, is there any way to detect that a unit is currently patrolling?
 
Last edited:
Level 9
Joined
May 21, 2014
Messages
580
isn't order(stop) doing nothing? :D

I checked.
When I issued an order of Stop, the order is called stop.
But the current order of the unit is nothing, thus an <Empty String>.

So if I check the current order using Stop, and the unit is doing nothing, then it cannot be checked since

"stop" not equal to ""

The weirder thing now is Patrol. Even if the unit is patrolling currently, there is no order; an <Empty String>
But checking it with an <Empty String> does not match with the condition. I wonder why.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
The order is stop because the unit has not finished stopping... yea sounds weird.
If you check the order 0 seconds after the stop order, the order might be "". (a 0 seconds wait doesn't work, you have to use a timer to get values below 0.168)
 
Level 9
Joined
May 21, 2014
Messages
580
The order is stop because the unit has not finished stopping... yea sounds weird.
If you check the order 0 seconds after the stop order, the order might be "". (a 0 seconds wait doesn't work, you have to use a timer to get values below 0.168)

This is a very useful information.
I was going to try but it made me thinking...

I wanted to recommand enemy units that are doing "nothing."
Of course checking the current order would be very much beyond 0 seconds, even beyond 0.168.

Hm... :/ Well, maybe I should just avoid commanding enemy units to "patrol."
Current Orders are, like, a completely different world than issuing them...
:ogre_rage:
 
Last edited:
Status
Not open for further replies.
Top