[Trigger] Canceling training queue units

Level 4
Joined
Sep 27, 2018
Messages
61
I've found the better way to cancel units in a queue or just one and also depending the unit-type. I maded to change the "stats - build time" of a Unit, basically I have to create a footman for example with less build time, copy the original and change the stat.

  • PressEsc
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
      • (Trained unit-type) Equal to Soldado raso
    • Actions
      • Set VariableSet Cancel[(Veces + 1)] = (Triggering unit)
      • Custom script: call IssueImmediateOrderById(udg_Cancel[udg_Veces+1], 851976)
      • Game - Display to (All players) the text: (String(Veces))
      • Wait 1.00 seconds
      • Unit - Order Cuartel 0010 <gen> to train/upgrade to a Soldado raso (Faster)
And then limit the times at 8 (queue spaces)

  • Return
    • Events
      • Game - Button for train Soldado raso pressed.
    • Conditions
      • Veces Equal to 8
    • Actions
      • Set VariableSet Veces = 0
Change the unit

  • Fin
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Trained unit-type) Equal to Soldado raso (Faster)
    • Actions
      • Unit - Replace (Trained unit) with a Soldado raso using The old unit's relative life and mana
This way, the units create faster than before and is still the same unit-type.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I truly do not understand what you think you've discovered here. Can you elaborate?

Yes... a unit with a shorter training time trains faster. Yes... you can replace a unit in the game world when it enters, thus desynchronizing the trained unit from the received unit. When doing this: start training unit A, replace it with B in the queue, then change it back to an A again after it trains... what is the first step achieving? You could just make the building train unit B directly instead.

If you are trying to create a way to remove a specific unit in the queue (that isn't the last-added unit) then there already exist automation systems like TrainingDetection v3.1a to make that process easier.
 
Level 4
Joined
Sep 27, 2018
Messages
61
I truly do not understand what you think you've discovered here. Can you elaborate?

Yes... a unit with a shorter training time trains faster. Yes... you can replace a unit in the game world when it enters, thus desynchronizing the trained unit from the received unit. When doing this: start training unit A, replace it with B in the queue, then change it back to an A again after it trains... what is the first step achieving? You could just make the building train unit B directly instead.

If you are trying to create a way to remove a specific unit in the queue (that isn't the last-added unit) then there already exist automation systems like TrainingDetection v3.1a to make that process easier.
Suppose you have a custom AI for your campaign. And units are trained by the AI, in my case I want specific units to be trained faster based on a boolean. Since there is no way to change "stats- Build time" during game with triggers, the first trigger gets to cancel the queued units of that unit type and then swap it for a dummy that trains faster and then back to the original unit. And then if you want to train slower you can come back to the original unit.
 
Last edited:
Top