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

Order multiple units to train.

Status
Not open for further replies.
Level 9
Joined
Jan 24, 2008
Messages
113
I need help trying to figure this out.

--------
event starts -> creates multipple buildings -> select all buildings -> train units.
--------

this is for neutral hostile. theres no problem with food cap since i set it to max at the start of the game. the units cost 0 gold and 0 lumber. and only takes 5 seconds to train.

pls halp :vw_wtf:
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
  • Events
    • Your Event
  • Conditions
    • Your Conditions
  • Actions
    • Unit - Create 5 building for neutral hostile facing default
    • Custom Script: set bj_wantdestroygroup = true
    • Unit group - Pick every unit in (Last created unit) and do (Actions)
      • Loop Actions
        • Unit - Order (Picked unit) to train Footmen
Its probly not exactly like that some of them might be different but thats the basic jist im sure u can figure it out
 
Level 5
Joined
Jan 4, 2007
Messages
103
Try this:
  • Events
    • Time - Elapsed game time is 50.00 seconds
  • Conditions
  • Actions
    • Set Region(Variable) = (Your Region)
    • Unit - Create 1(or how many you want) Building for Neutral Hostile at (Center of (Region)) facing Default building facing degrees
    • Custom script: call RemoveRect (udg_Region)
    • Wait 0.01 seconds
    • Set Region = (Your Region)
    • Unit Group - Pick every unit in (Units in (Region)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Picked Unit)) Equal to Your Building
          • Then - Actions
            • Unit - Order (Picked unit) to train/upgrade a Your Unit
          • Else - Actions
            • Do nothing
    • Custom script: call RemoveRect (udg_Region)
 
Level 10
Joined
Jun 26, 2005
Messages
236
Try this:
  • Events
    • Time - Elapsed game time is 50.00 seconds
  • Conditions
  • Actions
    • Set Region(Variable) = (Your Region)
    • Unit - Create 1(or how many you want) Building for Neutral Hostile at (Center of (Region)) facing Default building facing degrees
    • Custom script: call RemoveRect (udg_Region)
    • Wait 0.01 seconds
    • Set Region = (Your Region)
    • Unit Group - Pick every unit in (Units in (Region)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Picked Unit)) Equal to Your Building
          • Then - Actions
            • Unit - Order (Picked unit) to train/upgrade a Your Unit
          • Else - Actions
            • Do nothing
    • Custom script: call RemoveRect (udg_Region)

That leaks a location, store the center of the region as a point and remove it. Also, "Do Nothing" is useless.
 
Level 5
Joined
Jan 4, 2007
Messages
103
That leaks a location, store the center of the region as a point and remove it. Also, "Do Nothing" is useless.

Well, to be sure it doesn't leak, try this OP:
  • Events
    • Time - Elapsed game time is 50.00 seconds
  • Conditions
  • Actions
    • Set Region(Variable) = (Your Region)
    • Set Point(Variable) = (Center of (Region))
    • Unit - Create 1(or how many you want) Building for Neutral Hostile at Point facing Default building facing degrees
    • Custom script: call RemoveRect (udg_Region)
    • Custom script: call RemoveLocation (udg_Point)
    • Wait 0.01 seconds
    • Set Region = (Your Region)
    • Unit Group - Pick every unit in (Units in (Region)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Picked Unit)) Equal to Your Building
          • Then - Actions
            • Unit - Order (Picked unit) to train/upgrade a Your Unit
          • Else - Actions
            • Do nothing
    • Custom script: call RemoveRect (udg_Region)
 
Status
Not open for further replies.
Top