| 06-18-2004, 04:10 AM | #1 |
Does anyone know any way to detect when a unit stops without clicking the "Stop" button? |
| 06-18-2004, 06:52 AM | #2 |
I think this is more of a JASS code you want here since the GUI doesn't have this function. |
| 06-18-2004, 07:03 AM | #3 |
Well, you could do a position comparison. Every second, compare the distance between the position of the unit and the position of the unit one second ago... |
| 06-18-2004, 01:47 PM | #4 |
Try checking the current order, if it is 0 or OrderId("stop") it should work |
| 06-18-2004, 04:39 PM | #5 | |
Quote:
|
| 06-18-2004, 04:44 PM | #6 |
Does a unit receive a stop order even if it stops without the order being given by the player? I mean, i know it does when the unit is unable to reach the destination it was ordered to move to, but I didn't know it happens also when the unit reaches it's destination. Sc_freek, the proper way of detecting it is Event: Generic unit event - a unit is issued an order without target Condition: Order comparison - issued order equal to "stop" Actions: put here what you want to happen when a unit stops. |
| 06-18-2004, 05:12 PM | #7 |
I think you can detect it by order string "idle". |
| 06-18-2004, 05:19 PM | #8 | |
Quote:
PatruX, I'll have to try that out |
| 06-19-2004, 01:27 AM | #9 |
"Idle" is in use ALWAYS when the unit is standing still, even if he's stopped or if he has moved to a location. |
| 06-19-2004, 02:11 AM | #10 |
Try the event A unit stops channeling an ability. In that trigger you'd turn off your periodic triggers or what-not. |
| 06-19-2004, 02:15 AM | #11 | |
Quote:
Or am I just totaly off? |
| 06-19-2004, 03:07 AM | #12 |
Anitar is right that solution seems like it will work. Don't forget though to click the initially on checkbox off since you'll want this event to happen at a specific time rather then every time a unit stops. You'll need to have a turn trigger on action somewhere and a turn trigger off when your through with the trigger. |
| 06-19-2004, 04:04 AM | #13 |
try it, it won't work unless you actually click on the stop button. PatruX, the idle doesn't seem to work... |
| 06-19-2004, 07:52 AM | #14 |
Well, I was only guessing, I didn't say it must work... Anyway, having re-read Lord Vexorian's post, I think I know where I went wrong. You shouldn't be checkig when a unit is issued an order "stop", but when it's current order is "stop" (with a periodic trigger). If Lord Vexorian is right, that should do it. Otherwise, you can still try the position comparison with a periodic trigger that goes something like this: Code:
unit is moving detection
Events
Time - Every 0.50 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to NumberOfUnitsToCheck, do (Actions)
Loop - Actions
Set Position[(Integer A)] = (Position of UnitVariable[(Integer A)])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(X of Position[(Integer A)]) Equal to (X of OldPosition[(Integer A)])
(Y of Position[(Integer A)]) Equal to (Y of OldPosition[(Integer A)])
Then - Actions
Game - Display to (All players) the text: ((Unit + (String((Integer A)))) + is standing still.)
Else - Actions
Game - Display to (All players) the text: ((Unit + (String((Integer A)))) + is moving.)
Custom script: call RemoveLocation( udg_OldPosition[GetForLoopIndexA()] )
Set OldPosition[(Integer A)] = Position[(Integer A)]
Custom script: call RemoveLocation( udg_Position[GetForLoopIndexA()] )Of course, if you have a lot of units, this can get laggy. Also, this will not detect if a unit stands still for less than the frequency of the trigger, and may not detect if a unit stands still for less than double of the frequency of the trigger. Of course, the more accurate you want it to be, the more laggy it gets. |
| 06-19-2004, 08:09 AM | #15 |
Uhhh sorry LOL. I misread the topic. I thought it was stopping a spell. |
