• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Multiple units repairing one building

Status
Not open for further replies.
Level 4
Joined
Sep 6, 2012
Messages
88
Hi guys !

My map has a system where players can place a building wherever they want, then peasants will automatically run to the chosen position to build it. However, as I implement this idea, only one Peasant stays to build, the other just arrives at the place and stand idly there.

I expected them to co-build the building, as I based these units from the basic Human Peasant. The building I was trying to build was a Human Cannon Tower with only combat stats modified.

So, anyone can roughly identify what's the problem here ?

Thank you very much for the help !
 
You need to issue a separate order. You selected all units in unit group and ordered them to move? then build? I really need to see the trigger. Post the trigger. Maybe you should post the map too but if its all fairly standard stuff in OE then the trigger would be all I need to see. My guess is that you just need to re-issue and order to all the peasants who are not building. Its like in the standard game when you select a group and tell them to build, only one builds. You must be doing something a bit more though, if you got them to go stand by and watch, lazy bastards :)

How to post triggers
 
Level 4
Joined
Sep 6, 2012
Messages
88
Sorry, I'm not having the map here since I left it at my office (today's weekend :().

Actually what I did was to create 2 Peasants and ordered them to repair the building. I will try to post the trigger as soon as I can. Thanks a lot for all the help !
 
Level 4
Joined
Sep 6, 2012
Messages
88
@ruleofiron99: yeah, at first when I created the trigger I tried to order those units to right-click the building, however that ended up having both of them not doing anything (they just stand idly next to the constructing building). That's why I had to change the order to Repair (Human) instead :D.
 
Level 4
Joined
Sep 6, 2012
Messages
88
  • Unit Construction Allocation
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitGroup_Constructing and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Less than or equal to (Player 2 (Blue) Food used)
            • Then - Actions
              • Set Temp_Point = (Position of (Picked unit))
              • Set HomeBase_Point = (Position of HomeBase_Unit)
              • For each (Integer A) from 1 to (Custom value of (Picked unit)), do (Actions)
                • Loop - Actions
                  • Unit - Create 1 Orc for Player 2 (Blue) at HomeBase_Point facing Default building facing degrees
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Unit - Order (Last created unit) to Human Peasant - Repair (Picked unit)
                  • Unit - Order (Last created unit) to Right-Click (Picked unit)
                  • Player - Set Player 2 (Blue) Food used to ((Player 2 (Blue) Food used) - 1)
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • Unit - Set the custom value of (Picked unit) to 99
            • Else - Actions
      • Custom script: call RemoveLocation (udg_HomeBase_Point)
Here is the trigger of the problem I mentioned above.

In this trigger, I scan for all units which are in "Constructing" phase (I added all of them to the UnitGroup_Constructing group). Then I check for the amount of workers required to build that building. After getting the number, I created the corresponding number of workers and ordered them to Repair (Human) the picked building.

The result is as I said, if the required amount of workers is only 1, everything's perfect. However if it's more than 1, only 1 worker works and the rest just stands idly next to the building.

So, anyone can help me now ? Thank you so much !
 
Status
Not open for further replies.
Top