• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Training unit ?

Status
Not open for further replies.
Level 6
Joined
Sep 13, 2013
Messages
155
  • Unit - A unit Begins training a unit
in classification check there is only a trained unit which refers to the unit which was already trained. how can I add conditions for units which are not yet trained ?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Units that are not yet trained?
"No unit"

Question: What is the unit called that does not exist?
What is the unit type of the unit that does not exist?
What is the model file of the unit that does not exist?
What is the race of the unit that does not exist?
What is the base damage of the unit that does not exist?
What is the movement speed of the unit that does not exist?

THE UNIT DOES NOT EXIST!!!

So, you should try to find if you can do a condition on the trained unit-type.
 
Level 6
Joined
Sep 13, 2013
Messages
155
I realized that and that is not my point. the trained unit type only works with this event:

  • Unit - A unit Finishes training a unit
however, i have to use this one:

  • Unit - A unit Begins training a unit
and thanks for training detection. that is what i wanted.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
The unit is not finished training.
A building can start training a unit of a specific unit type.
So when you have a trigger that runs on "A unit begins training a unit", you can refer to the unit type.
However, once the unit finished training, then the unit is actually created. Before that moment, the unit DOES NOT EXIST!
Only a reference to the unit type.

  • Good
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
      • (Trained unit-type) Equal to Footman
    • Actions
      • Game - Display to (All players) the text: footman is training
This is a good working trigger.

  • Bad
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Footman
    • Actions
      • Game - Display to (All players) the text: footman is training
This is not.

Another way of detect training is checking orders.
The difference is that the event "A unit begins training a unit" runs when the train order becomes te first training (the one that will actually be trained) additional training orders are placed in the queue and will run the event later.
The order event "A unit is issued an order with no target" runs when the unit is added to the queue. This is the preffered order if you want to add some restrictions on the training of the unit related to cost etc.
Using the other event is preferred when the requirements can change.

Take for example food cost in WC3.
When you have 4 food left, and issue a barracks to train 7 footmen, the first two will be trained, the others wont have the required food at the moment that they become the training unit.
 
Status
Not open for further replies.
Top