• 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.

Help with buildings!

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
133
Help! I want to code a building being built.

I order the units to interact with it, but no matter what, even if I set it as a variable, the unit's won't interact with it for no reason. I mean, I can still right click it and stuff, just not trigger units to interact with it.

Why? How can I fix this?
 
Level 6
Joined
Aug 12, 2007
Messages
133
  • build
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Unit Group - Add (Constructing structure) to BuildingsBeingBuiltP1
      • Trigger - Turn on buildvillager <gen>
This is the one that selects the building...

  • buildvillager
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in BuildingsBeingBuiltP1) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set villagerisbuilding = True
          • Set builder = (Random unit from idlep1builders)
          • Unit - Remove Wander (Neutral) from builder
          • Unit - Order builder to Board (Random unit from hallsp1)
This is a second one, that activates, works fine...

  • Else - Actions
    • Unit - Order voillagerinhall to Attack Once repairedbuilding*
    • Unit Group - Remove voillagerinhall from idlep1builders
    • Unit Group - Add voillagerinhall to P1builders
*The one that fails for no good reason


Off topic: Is there a way to make a trigger aknowledge the closest units to a structure?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
By the way why not give a unit the Repair ability and simply do:
  • Unit - Order Your_Builder to Human Peasant - Repair Your_Structure
Davy Jones said:
Off topic: Is there a way to make a trigger aknowledge the closest units to a structure?

  • (Your_Unit is in (Units within 512.00 of (Position of Your_Structure))) Equal to (==) True
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
It won't even repair the building...

So... When a unit begins a construction, you set a variable to be the Constructing structure.
Then you order your builder to repair that structure which is not working?
Are you sure the builder has the repair ability?

And how do I make it do an action? Triggering unit?

Wait.. what? What are you asking?
Triggering unit is the unit that caused the trigger to be executed through the event.
For example:
  • Unit - A unit Begins construction
Triggering unit would be the unit beginning the construction.

Let's recap: what exactly do you want to do?
You have a group of builders?
And when one of the builders creates a building, you want other builders to help building the structure?
Do all other builders need to help building the structure?
Or just one of all the builders you have?

Also, could you tell us where you've set the following variables or unit groups:

voillagerinhall
repairedbuilding
idlep1builders
P1builders

I have no idea what you are trying to accomplish with all these unit groups :S
Tell us exactly what you want and we'll help you out.
 
Level 6
Joined
Aug 12, 2007
Messages
133
So... When a unit begins a construction, you set a variable to be the Constructing structure.
Then you order your builder to repair that structure which is not working?
Are you sure the builder has the repair ability?



Wait.. what? What are you asking?
Triggering unit is the unit that caused the trigger to be executed through the event.
For example:
  • Unit - A unit Begins construction
Triggering unit would be the unit beginning the construction.

Let's recap: what exactly do you want to do?
You have a group of builders?
And when one of the builders creates a building, you want other builders to help building the structure?
Do all other builders need to help building the structure?
Or just one of all the builders you have?

Also, could you tell us where you've set the following variables or unit groups:

voillagerinhall
repairedbuilding
idlep1builders
P1builders

I have no idea what you are trying to accomplish with all these unit groups :S
Tell us exactly what you want and we'll help you out.

voillagerinhall - the Worker (not the same that is ordered to build the building though) that is ordered to repair the building
repairedbuilding - building being built
idlep1builders - some group used for other triggers, mostly finding a idle worker
P1builders - group of assigned workers

I want units to interact (right click/attack/move to) target building. I tried but it just doesn't work. Builder won't attack/right click/guard/repair/etc it.

Also is there a way to make something make aknowledge the closest unit to it, not any unit
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I want units to interact (right click/attack/move to) target building. I tried but it just doesn't work. Builder won't attack/right click/guard/repair/etc it.

You have to add a small wait inbetween. If you put a 1 second wait before repairing/attacking to the building it does work.
I know it's odd, for some reason the building is not yet recognized when using order to a unit :S
Moving to the position of the unit does work, but repairing/attacking etc doesn't for some strange reason.
I'm gonna find that out soon...

Also is there a way to make something make aknowledge the closest unit to it, not any unit

As I said before, use this:
  • (Your_Unit is in (Units within 512.00 of (Position of Your_Structure))) Equal to (==) True
 
Level 6
Joined
Aug 12, 2007
Messages
133
You have to add a small wait inbetween. If you put a 1 second wait before repairing/attacking to the building it does work.
I know it's odd, for some reason the building is not yet recognized when using order to a unit :S
Moving to the position of the unit does work, but repairing/attacking etc doesn't for some strange reason.
I'm gonna find that out soon...

Nope. Still doesn't work...
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Strange, for me it does work. Would you mind posting the map or sending it through PM so I can take a look at it?
 
Status
Not open for further replies.
Top