| 05-22-2003, 08:50 PM | #1 |
Call me blind, but I seem to be unable to find a way to give a unit an order to cancel whatever unit it may be training. Is this even possible? It doesnt seem to be in the Unit-Issue order with no target... |
| 05-22-2003, 11:33 PM | #2 |
Use the Event: Unit - Player-Owned Unit Event (A unit owned by player X begins training a unit) Now use a condition like like trained unit equal to footman. Then, a method I use for this would be to select the building training the unit (that would be the tirggering unit) and then use the selection trigger actions to clear current selection, select the triggering unit and use the action Game - Force UI/Cancel. That should cancel the currently training unit. I'm sure there's a better way, but my computer is really screwy right now. |
| 05-24-2003, 10:54 AM | #3 |
Well, heres what I did, and it doesnt cancel: Code:
call ClearSelection( ) call SelectUnitSingle( GetTriggerUnit() ) call ForceUICancelBJ( GetOwningPlayer(GetTriggerUnit()) ) Yes thats JASS, but I needed to put multiple commands in an IF statement. That was cut+paste from these GUI triggers: Code:
Selection - Clear Selection Selection - Select (Triggering Unit) Game - Force (Owner of (Triggering Unit)) to press Escape/Cancel In the JASS one (the one that gets executed), the line right before the selection ones executes, so its not my IF thats the problem. |
| 05-25-2003, 08:32 PM | #4 |
You can issue a cancel order directly in JASS. Cancel has no order string, but an order id. The advantage compared to the force key thing is that it also works for computer players. The order id of Cancel is 851976 . So you can use call IssueImmediateOrderById(GetTriggerUnit(), 851976) |
| 05-25-2003, 10:17 PM | #5 |
Please, can you tell me if there is a way to get the cancelled upgraded unit/building ??? I am stuck with that pb GetCancelledStructure only works for cancelled building, not upgrading. what can i do ?? Regards |
| 05-26-2003, 12:00 AM | #6 |
Thanks 2 AiAndy for that solution. It works perfectly, seamlessly. |
| 05-26-2003, 06:20 AM | #7 |
@ChrydGod: I have looked and could find no event reaction for that in common.j . So there might not be one. What you can try is GetTriggerUnit or one of those: // EVENT_PLAYER_UNIT_CONSTRUCT_START constant native GetConstructingStructure takes nothing returns unit // EVENT_PLAYER_UNIT_CONSTRUCT_FINISH // EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL constant native GetCancelledStructure takes nothing returns unit constant native GetConstructedStructure takes nothing returns unit // EVENT_PLAYER_UNIT_RESEARCH_START // EVENT_PLAYER_UNIT_RESEARCH_CANCEL // EVENT_PLAYER_UNIT_RESEARCH_FINISH constant native GetResearchingUnit takes nothing returns unit constant native GetResearched takes nothing returns integer // EVENT_PLAYER_UNIT_TRAIN_START // EVENT_PLAYER_UNIT_TRAIN_CANCEL constant native GetTrainedUnitType takes nothing returns integer // EVENT_PLAYER_UNIT_TRAIN_FINISH constant native GetTrainedUnit takes nothing returns unit |
