• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Add unit to the end of training queue

Status
Not open for further replies.
Level 2
Joined
Feb 16, 2013
Messages
9
Both GUI function and jass function "IssueImmediateOrder ( unit, string_order )" add unit to the begining of a queue.
It isn't suitable for me at all, because I have to add it to the end.(

If rebuilding the queue from its ending then I have to remember all the orders of adding units to the queue. But I shan't be able to rebuild queue again if training of any unit will be canceled. So fail...

Is there any other solution to my problem?

Thank you.
 
Level 2
Joined
Feb 16, 2013
Messages
9
"orderId" must contain only integer. 'hpea' is a string variable.
But I think this function does the same. The difference is that that only ID is needed.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Both GUI function and jass function "IssueImmediateOrder ( unit, string_order )" add unit to the begining of a queue.
It isn't suitable for me at all, because I have to add it to the end.(

If rebuilding the queue from its ending then I have to remember all the orders of adding units to the queue. But I shan't be able to rebuild queue again if training of any unit will be canceled. So fail...

Is there any other solution to my problem?

Thank you.

if u want make unit cancelable unit production then use hashtable

when u order a unit for train a unit save the unit handleid or unit custom value (custom value if u use a indexer)
  • Unit - Order unit to train/upgrade to a Footman
  • Hashtable - Save (Player number of (Triggering player)) as (Custom value of unit) of 0 in (Last created hashtable)
in this example we save the player number and where they key is the unit variable custom value, 2nd key is 0 (unit variable is the factory what craft the unit)


  • Untitled Trigger 003
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (((Name of (Trained unit)) + crafted by player ) + (String((Load (Custom value of (Triggering unit)) of 0 from (Last created hashtable)))))
      • Hashtable - Save 0 as (Custom value of (Triggering unit)) of 0 in (Last created hashtable)
      • -------- here Triggerunit = the crafter building, Trained unit is the produced unit --------
  • Untitled Trigger 004
    • Events
      • Unit - A unit Cancels training a unit
    • Conditions
      • (Load (Custom value of (Triggering unit)) of 0 from (Last created hashtable)) Not equal to 0
    • Actions
      • Hashtable - Save 0 as (Custom value of (Triggering unit)) of 0 in (Last created hashtable)
      • Game - Display to (All players) the text: construction aborte...
u tryed something like this?
"orderId" must contain only integer. 'hpea' is a string variable.
But I think this function does the same. The difference is that that only ID is needed.
that is integer not string, string is with "" not with '',
"hpea" = string, 'hpea' = integer
 
Last edited:
Level 2
Joined
Feb 16, 2013
Messages
9
Omg. Solved. The problem was that that there was not "wait 0.2 second" before the action. When unit finishes training there is an empty slot, in which the next unit in the queue is still not placed. So there have to be a small pause before the actions in order to let the building set the next unit to the first slot, which can be probably tacken by "Order unit to train ..." action.
 
Status
Not open for further replies.
Top