• 🏆 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!

Automatically train units when a building is constructed

Status
Not open for further replies.
Level 5
Joined
Jul 13, 2010
Messages
84
Barracks Finish
Events
Unit - A unit Finishes construction
Conditions
(Triggering unit) Equal to BarracksVariable
Actions
Unit - Order BuilderVariable to build a Supply Depot at (Center of Supply Depot1 <gen>)
Unit - Order BarracksVariable to train/upgrade to a Marine
Unit - Order BarracksVariable to train/upgrade to a Marine
Trigger - Turn on Marine Variable new <gen>
Trigger - Turn off (This trigger)


Barracks Variable
Events
Unit - A unit Begins construction
Conditions
(Triggering unit) Equal to BuilderVariable
Actions
Set BarracksVariable = (Constructing structure)
Trigger - Turn on Barracks Finish<gen>
Trigger - Turn off (This trigger)
I'm trying to get the barracks to train marines when it finishes, but it doesn't....idk something is apparantly wrong with this trigger? Plz help it's so confusing. Do buildings not constitute as units? Do buildings currently being build not constiture as a Constructing structure??????
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You can use
  • tags to post triggers :)
  • Units are not constructed. Units are "Trained". Buildings are Constructed.
  • [Trigger]
  • Unit - Order BuilderVariable to build a Supply Depot at (Center of Supply Depot1 <gen>)
It leaks Point. ---Fix--->
  • Set Point = Center of Supply Depot 1 <gen>
  • Unit - Order BuilderVariable to build a Supply Depot at Point
  • Custom script: call RemoveLocation(udg_Point)
If you want Barracks to train marines, why don't you just add the Marines into the possible Units to train in the Object Editor, in the Barracks data?

  • Barracks Variable
  • Events
    • Unit - A unit Begins training a unit
  • Conditions
    • (Triggering unit) Equal to BuilderVariable
  • Actions
    • Set BarracksVariable = (Triggering Unit)
    • Trigger - Turn on Barracks Finish<gen>
    • Trigger - Turn off (This trigger)
 
Level 12
Joined
Oct 16, 2010
Messages
680
Unit - A unit Finishes construction
for this , Triggering Unit refers to the builder not the building . Use "Constructed Structure"

buildings counts as units

EDIT: and also you should make it clear to us which variable is a structure and which variable is worker(think builder is a worker,barrack is a structure:D)and explain which trigger what should do exactly
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok... sorry... I got messed with the names. BuilderVariable is the Worker/Builder... Then follow Lender suggest.

  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • (Triggering unit) Equal to BarracksVariable
The unit that "Finishes Construction" is the worker, not the building. =)
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
after the unit is constructed, add it to a looping group...something like this...
  • Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • //specify your condition
    • Actions
      • Unit Group - Add (Triggering unit) to StructureGroup
      • Set StructureIndex = (StructureIndex + 1)
      • Trigger - Turn on Train <gen>
  • Train
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in StructureGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • //specify your condition
            • Then - Actions
              • Unit - Order (Picked unit) to train/upgrade to a Footman
              • Unit - Order (Picked unit) to train/upgrade to a Rifleman
            • Else - Actions
              • Unit Group - Remove (Picked unit) from StructureGroup
              • Set StructureIndex = (StructureIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Integers Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Status
Not open for further replies.
Top