Unit type of training unit???

ecad

New Member
Reaction score
0
I want a unit to in some cases be trained instantly, but Iam missing 2 triggers that are not in the world editor!!!

Main Question:
Do you know how I can make it so that a unit is trained instantly the secound I click to train that unit?


Do you know any ways to recognize "training unit" when using the event "Begins Training a unit"? (Triggering unit returns the building training the unit and Trained Unit doesn't work)

Do you know any ways to set the training progress when training a unit, just like in the trigger Set (Constructing Structure) construction progress to 100%??

Thank you!
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • Unit - Set (Triggering unit) construction progress to 99% // or 100%
 

ecad

New Member
Reaction score
0
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • Unit - Set (Triggering unit) construction progress to 99% // or 100%

Thanks, but don't work.

Because triggering unit = Barracks ( or building training the unit ).

I need to get the unit-type of the unit trained by the building before training is finished.

Iam sure there is a custom script which makes this possible.
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
Not possible in GUI as i know of. Why not just set build time in the object editor?
or Sell them as creep like a creep shop would. Which will place them instantly.
 

ecad

New Member
Reaction score
0
I found a method now if anyone else is interested:

Code:
    Events
        Unit - A unit Is issued an order with no target
    Conditions
        ((Ordered unit) is A structure) Equal to True
        (Unit-type of (Ordered unit)) Not equal to Altar of Kings
        (Unit-type of (Ordered unit)) Not equal to Altar of Storms
        (Unit-type of (Ordered unit)) Not equal to Altar of Darkness
        (Unit-type of (Ordered unit)) Not equal to Altar of Elders
    Actions
        Unit - Create 1 (Unit-type((String((Issued order))))) for (Owner of (Ordered unit)) at (Position of (Ordered unit)) facing Default building facing degrees
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Last created unit) is A structure) Equal to True
            Then - Actions
                Unit - Remove (Last created unit) from the game
            Else - Actions
                Unit - Order (Last created unit) to Move To (Rally-Point of (Ordered unit) as a point)
                Wait 0.10 seconds
                Custom script:   call IssueImmediateOrderById(GetOrderedUnit(), 851976)

Without the 0.10 secounds wait it crashes the game.

Now a new problem with this is I can't research any teches :thdown:

Also causes heavy lag and all units are free and don't cost resources.

Lol would still like answers to my original question.
 

Bomber7

New Member
Reaction score
0
Having googled this issue and come upon this thread, I decided to answer. There is in fact a native called GetTrainedUnitType() which does exactly what you're looking for. It returns the unit type in integer form. I know the native says "TrainedUnit" but it works for units that are in the process of being trained.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Having googled this issue and come upon this thread, I decided to answer. There is in fact a native called GetTrainedUnitType() which does exactly what you're looking for. It returns the unit type in integer form. I know the native says "TrainedUnit" but it works for units that are in the process of being trained.

A necromancer huh? This thread is about 1 year old buddy. You are too late for the party.
 

Bomber7

New Member
Reaction score
0
lol I looked at the date and said "January 15th? That was only 4 days ago!" My bad, I didn't mean to bring this back from the brink of nonexistence.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top