| 01-25-2009, 01:40 PM | #1 |
Hi guys, I want to display an animation at the head of the worker when he is idle. However to do this I need to know which workers are idle and which workers are not. How does the game finds that out? How can I know when my workers are idle ? |
| 01-25-2009, 01:51 PM | #2 |
Get its current order? and see if its no order? |
| 01-25-2009, 01:55 PM | #3 | |
Quote:
|
| 01-25-2009, 02:00 PM | #4 | |
Quote:
0 |
| 01-25-2009, 02:57 PM | #5 |
You can know for all hidden workers (all race which is not undead or human), but for these two last races, you can't really know, since you can't know the difference when a builder will build it (receive the order) or is actually building it. Ok, i've missunderstood the question ... |
| 01-25-2009, 03:40 PM | #6 | |
Quote:
JASS:GetUnitCurrentOrder(WORKER)==OrderId("stop") When worker has an order "stop", game treats it as idle worker so use trigger that fires when player issues "stop" order may be the way to go. |
| 01-25-2009, 03:43 PM | #7 |
Mmm Ahh thx to all! +rep for all who helped me. |
| 01-26-2009, 01:21 AM | #8 |
You're wrong BestZero. It has order of "0" like people said before you, not stop order. |
| 01-26-2009, 03:59 AM | #9 |
That's true. I have tried it, when unit is in a stop stance it has 0 order not stop order. Sorry for my misunderstanding. |
| 01-26-2009, 05:14 AM | #10 |
A unit has stop order for the instance it was ordered stop (caught during the event EVENT_PLAYER_UNIT_ISSUED_ORDER). After that, a 0 order or "" in GUI. |
| 01-26-2009, 07:25 AM | #11 |
this will work for workers without attack only, cos auto attack without order cannot be detected. |
| 01-26-2009, 08:43 AM | #12 |
Auto-acquire attacks keep the unit at having no order. (i.e. if you order a unit to stop, then it acquires a target, its registered order will still be "null"). Workers do not usually auto-acquire but I think they engage when they are 'forced' into it. You will not be able to ascertain if the worker is still idle in this case by a simple GetUnitCurrentOrder() method. edit: zzz the post above |
| 01-26-2009, 08:45 AM | #13 |
The auto attack can be detected with the event EVENT_UNIT_ACQUIRED_TARGET, then to keep the order track, you can order the triggering unit to attack his target, unfortunately, there is no PLAYER_UNIT_EVENT. |
| 01-26-2009, 07:56 PM | #14 | |
Quote:
Are workers hard-coded to not acquire a target? Therefore this work-around would not be needed. |
| 01-26-2009, 08:39 PM | #15 |
i think yes ..units with worker classification wont aquire targets... |
