HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Cancelling training

07-16-2008, 05:32 PM#1
CommanderZ
Is it possible to cancel unit training through scripts? I need to remove all units in the training queue.

TY
07-17-2008, 05:02 AM#2
Anopob
Not sure how sloppy this can get, but would selecting your unit and doing Force UI Key - Cancel work well (if you do it fast enough)?
07-17-2008, 02:33 PM#3
CommanderZ
Quote:
Originally Posted by Anopob
Not sure how sloppy this can get, but would selecting your unit and doing Force UI Key - Cancel work well (if you do it fast enough)?
This would interfere with player's other actions
07-23-2008, 08:44 AM#4
Pyrogasm
Then no, you can't do it. Forcing the UI key is the only way.
07-23-2008, 03:14 PM#5
Blubb-Tec
Quote:
Originally Posted by PitzerMike
851976 (cancel): This is an order with no target that is like a click on a cancel button. We used to be able to catch cancel clicks with this id back then but this id doesn't seem to work any more.
I tested it, it still works for canceling unit production. So simply issue the (immediate) order 851976, like this:
call IssueImmediateOrderById(u, 851976) (don't know the gui-command right now)
Do that 10 times or so and all unit-production should be cancelled :)

Edit: attached my test map
Attached Files
File type: w3mstop.w3m (16.2 KB)
07-25-2008, 05:50 PM#6
Hydrolisk
Just loop it 7 times, since it only has that many que slots... Ten times is just a waste, IMO.
07-25-2008, 08:08 PM#7
Ammorth
Why not just do:

Collapse JASS:
function CancelTrainOrder takes unit u returns nothing
    call IssueImmediateOrderById(u, 851976)
    call IssueImmediateOrderById(u, 851976)
    call IssueImmediateOrderById(u, 851976)
    call IssueImmediateOrderById(u, 851976)
    call IssueImmediateOrderById(u, 851976)
    call IssueImmediateOrderById(u, 851976)
    call IssueImmediateOrderById(u, 851976)
endfunction

No loop involved (so should be faster, even with extra function call) and makes the code cleaner.