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

[Solved] Building order

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,850
Hello, in my map there are towers what if they are destroyed then a worker builds another in the same place and in my map are only 5 workers, so when that happens just pick someone who don't have any current order, but if the towers are destroyed and all the workers have some order so the tower will never be constructed, so my option is do that when the current order of that workers isn't build, so my question is this: How can I do that? (Current order its not "build") because when I see the issued order I just get a code.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
This is setup to work with Peasants that build Scout Towers:
  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Workers = (Units of type Peasant)
  • Tower Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Scout Tower
    • Actions
      • Set VariableSet Break = False
      • Unit Group - Pick every unit in Workers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Break Equal to False
              • ((Picked unit) is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of (Picked unit)) Equal to (Order(stop))
                  • (Current order of (Picked unit)) Equal to (Order(smart))
                  • (Current order of (Picked unit)) Equal to (Order(attack))
                  • (Current order of (Picked unit)) Equal to (Order(stand down))
                  • (Current order of (Picked unit)) Equal to (Order(harvest))
                  • (Current order of (Picked unit)) Equal to (Order(patrol))
                  • (Current order of (Picked unit)) Equal to (Order(repair))
                  • (Current order of (Picked unit)) Equal to (Order(holdposition))
            • Then - Actions
              • Set VariableSet Break = True
              • Set VariableSet Point = (Position of (Triggering unit))
              • Unit - Order (Picked unit) to build a Scout Tower at Point
              • Custom script: call RemoveLocation (udg_Point)
            • Else - Actions
So you contain your Workers in a Unit Group (Workers). Then whenever a tower dies you loop through the Workers group looking for a worker that isn't currently building. After finding one you order that worker to build a tower at the position of the dying unit. I use the boolean Break to prevent multiple workers from trying to build at the same time.

There may be other orders that you need to add to the Conditions.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,850
This is setup to work with Peasants that build Scout Towers:
  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Workers = (Units of type Peasant)
  • Tower Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Scout Tower
    • Actions
      • Set VariableSet Break = False
      • Unit Group - Pick every unit in Workers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Break Equal to False
              • ((Picked unit) is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of (Picked unit)) Equal to (Order(stop))
                  • (Current order of (Picked unit)) Equal to (Order(smart))
                  • (Current order of (Picked unit)) Equal to (Order(attack))
                  • (Current order of (Picked unit)) Equal to (Order(stand down))
                  • (Current order of (Picked unit)) Equal to (Order(harvest))
                  • (Current order of (Picked unit)) Equal to (Order(patrol))
                  • (Current order of (Picked unit)) Equal to (Order(repair))
                  • (Current order of (Picked unit)) Equal to (Order(holdposition))
            • Then - Actions
              • Set VariableSet Break = True
              • Set VariableSet Point = (Position of (Triggering unit))
              • Unit - Order (Picked unit) to build a Scout Tower at Point
              • Custom script: call RemoveLocation (udg_Point)
            • Else - Actions
So you contain your Workers in a Unit Group (Workers). Then whenever a tower dies you loop through the Workers group looking for a worker that isn't currently building. After finding one you order that worker to build a tower at the position of the dying unit. I use the boolean Break to prevent multiple workers from trying to build at the same time.

There may be other orders that you need to add to the Conditions.
In fact, I already have a trigger to build the towers, I just wanna know how to select a worker when he is not building or going to build, but I will prove with that conditions that you have.
 
Status
Not open for further replies.
Top