- 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.
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.
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?
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>)))
-
Events
-
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)))
-
Events
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)
-
Loop - Actions
- Custom script: call DestroyGroup(udg_RecommandUnitGroup11)
- Custom script: set udg_RecommandUnitGroup11 = null
- Custom script: call DestroyGroup(udg_RecommandUnitGroup12)
- Custom script: set udg_RecommandUnitGroup12 = null
-
Events
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: