• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Unit Build Orders?

Status
Not open for further replies.
Level 18
Joined
Mar 13, 2009
Messages
1,411
For my map I need a trigger that if a structure trains a unit, the structure is automatically ordered to train a new unit of the same type.

The only thing I can find in the Editor are Unit-specific build orders and I need to make this trigger work for multiple unit types.

The solutions I could think of are:
Making a new action for each single unit-type in my map;
Putting each unit-type and order in Array Variables and then working out something with a For each Integer kind of trigger.

Wouldn't there be an easier, more efficient way to just give a new build order? Preferably without the need to make a Custom build order for each unit (which I don't know how to do yet).
 
Last edited:
Level 18
Joined
Mar 13, 2009
Messages
1,411
There must be some way of converting from unit type to build order. Mind you, wc3 lacked something like that, so I guess they didn't think to put it in sc2 either D:

Something like this would work in Warcraft III:
  • Train Unit
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Unit - Order (Triggering unit) to train/upgrade to a (Unit-type of (Trained unit))
This would make it a bit more complicated:
  • Train Unit
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Trained unit)) Equal to trainUnitType[(Integer A)]
            • Then - Actions
              • Unit - Order (Triggering unit) to train/upgrade to a trainUnitType[(Integer A)]
            • Else - Actions
The only orders I see in Starcraft II though are unit-specific. In that case I would have to make a custom build order for each specific unit, put them in an array and then trigger it like I did in my second example... kinda inefficient if you ask me.

This is my inefficient way which would require a custom build order for each single unit in my map:

buildu.png


Haven't checked if it works yet though.




Edit: Saving gives me an error on my Initialization for

gv_orderBuildUnit[1] = Order(AbilityCommand("BarracksTrain", 0));

"Implicit cast not allowed"
 
Last edited:
Status
Not open for further replies.
Top