• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Need help to refer training unit

Status
Not open for further replies.

ManWhoKnows

M

ManWhoKnows

When it's using event "Unit - begins training unit" how I can refer training unit?
(to store this unit into variable).
simply:
i wanna refer
unit- begins training unit

p.s. English isn't my mother language, but I hope my question is clear.
 
Last edited by a moderator:
Triggering unit refers unit- begins training unit, but i wanna refer unit- begins training unit
 
Check orders, if a structure or eventually an unit get a build order UnitId2String(GetIssuedOrderId()) != null (even if this function always return null on a saved game ...).
Or you can try to create an unit with this order, if created unit == null then it's not a build order, else it is and don't forget to remove the unit
You would need to attach the trained unit to his "builder", but i'm fairly sure it can be done in some way or an other.
 
You can't refer to a training you since that unit doesn't exists untill the training is done. So how to get the traning unit you need to refer it by, Unit - Finish Traning a unit. (Not on a computer with WE atm so im not sure it thats correct)
 
That would not be a problem if we could perfectly detect when an unit is removed from the construction queue, but sadly it seems we can't detect it when the user abort the training with a left mouse click on an unit.
So no, it can't be done :(

EDIT : Hmm, yes you're right, i thought he was talking about the end training event and not the begin one.
 
Last edited:
Are u sure that unit don't exists when it's training? Sad news...
2Azeroc:
I don't test it, but I think it works on Finish Training Unit only.
 
I make map wh40k-style. And when unit is training, big thunderhawk(spaceship) arrives from sky(=orbit) and bring it. thunderhawk is "aloc" hidden unit which is shown when it's 10 sec since moment "Unit - begins training unit". Unit training time=15 sec, so 5 sec for thunderhawk landin animations. When player cancels unit training, thunderhawk must fly away momentaly (or dont arrive if player cancels earlier than thunderhawk arrives). That part have 2 triggerrs - on train and on cancel and haven't problems. Problems starts when player cancels unit in queue for training, 'cos there is no way to define what unit has been canceled - in queue or in training. Event "Unit - Cancels training a unit" works in both cases.
 
When a unit starts training it doesn't create a handle, only when the training is finished. This means that there is no possible way you can reference it (because its not there). I can't imagine anything that would require referencing a unit before it has been trained.
 
Even if you were able to reference the unit, you still would have no idea whether or not the training of it was canceled. You could detect when the player hits the "ESC" key (or clicks Cancel) and then remove the integer unit-type from a stack of units "to be trained".
 
Azeroc said:
There are hidden abilities like your mentioned "Cancel", which can only be refereed with custom script

I don't think you know what you're talking about.

Azeroc said:
You might be wrong again.

No, I know exactly what I'm talking about. There are only 3 types of orders, a point, a widget-target, or an immediate order. These are all usable in the GUI-trigger-editor.
 
Azeroc said:
Because you can't actually do some orders with GUI, you need JASS.

There is no need to issue these special abilities, only detect when they are used by the user in-game, which GUI is completely capable of.

  • Untitled Trigger 002
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Issued order)))
This will display every order issued, regardless of whether it can be referenced from GUI or not.

Azeroc said:
Yes I do know what I am talking about.

Nah.
 
2Azeroc It doesn't fit: player cancels unit in training queue, and if unit-type of canceled unit is same as now training unit - it will be bug. But if them are different - it will work right.
 
ManWhoKnows said:
Problems starts when player cancels unit in queue for training, 'cos there is no way to define what unit has been canceled - in queue or in training. Event "Unit - Cancels training a unit" works in both cases.

"Cause there is no way to define what unit has been canceled"

So the problem here is the "Unit cancels training" event can respond before the "Unit begins training" event does. Is this correct?
 
no, ya're wrong. player can cancel da unit in queue for training and "Unit cancels training" event does, but in my case this event should work only when player cancels da now training unit. my speach is correct? is it understandable? may be have somebody another resolve of my problem with thunderhawk? I attached both triggers in jpeg-image.
 

Attachments

  • triggers.JPG
    triggers.JPG
    146.8 KB · Views: 131
ManWhoKnows said:
no, ya're wrong. player can cancel da unit in queue for training and "Unit cancels training" event does, but in my case this event should work only when player cancels da now training unit.

No, I'm not wrong. What you just explained is the same problem that I explained in different words. Your English isn't so good though so I'm not going to get on your ass about it.

Just to clarify for anybody else who may be reading this: The problem that ManWhoKnows is experiencing is the outcome of the "Unit cancels training" event responding in situations where the "Unit starts training" does not. More specifically, when units are added to the training queue they are completely undetected, but when they are removed from the queue they are "canceled", triggering the "Unit cancels training" event.
 
Last edited:
Ok, now I understand you, but
So the problem here is the "Unit cancels training" event can respond before the "Unit begins training" event does
- isn't full explanation of a situation and it can mislead (in some cases)))
 
Status
Not open for further replies.
Back
Top