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!
So for my map i have all my workers set to orc, so that when they build they go inside the structure to build it. My question is, once they finish building, they always reappear either on the bottom left or the bottom right of the building, I want them to appear on the top left of the building. Does anyone know how to make this happen?
There is no constructing unit. I've looked all over the place and searched the forums top to bottom. There is no way to determine the unit that is doing the construction.
Alright, I threw together a system that seems to work.
When you issue an order to build a structure I add the Peon to a unit group and turn on a timer. This timer periodically checks if the Peon is constructing a structure, which will be true f the Peon is Hidden, Invulnerable, and not being Transported. Once it detects that the Peon is building a structure it looks for every structure within 1.00 range of the Peon, and unless your map has some strange mechanics, this should be the Structure that the Peon is building (Since they're stacked on top of one another). I then use a Unit Indexer to link the Peon to the Structure, so now as long as we can reference the Structure we can also reference the Peon that built it or that is currently building it. With this information we now have our "Constructing Unit" and can make the Move trigger to move the Peon into the correct position.
Track Order
Events
Unit - A unit Is issued an order targeting a point
Conditions
(Unit-type of (Triggering unit)) Equal to Peon
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Issued order) Not equal to (Order(move))
(Issued order) Not equal to (Order(smart))
(Issued order) Not equal to (Order(attack))
(Issued order) Not equal to (Order(patrol))
Then - Actions
Set VariableSet Track_Unit = (Triggering unit)
Set VariableSet UDex = (Custom value of Track_Unit)
Set VariableSet Track_Order[UDex] = (Issued order)
Unit Group - Add Track_Unit to Track_UnitGroup
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Track Timer <gen> is on) Equal to False
Then - Actions
Countdown Timer - Start Track_Timer as a Repeating timer that will expire in 0.10 seconds
Trigger - Turn on Track Timer <gen>
Else - Actions
Else - Actions
Track Timer
Events
Time - Track_Timer expires
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Track_UnitGroup) Greater than 0
Then - Actions
Unit Group - Pick every unit in Track_UnitGroup and do (Actions)
Loop - Actions
Set VariableSet Track_Unit = (Picked unit)
Set VariableSet UDex = (Custom value of Track_Unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Track_Unit is invulnerable) Equal to True
(Track_Unit is hidden) Equal to True
(Track_Unit is being transported) Equal to False
Then - Actions
Set VariableSet Track_Points[1] = (Position of Track_Unit)
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 1.00 of Track_Points[1].) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A structure) Equal to True
((Picked unit) is alive) Equal to True
(Owner of (Picked unit)) Equal to (Owner of Track_Unit)
Then - Actions
Set VariableSet Track_Structure[UDex] = (Picked unit)
Set VariableSet UDex = (Custom value of (Picked unit))
Set VariableSet Track_Worker[UDex] = Track_Unit
Else - Actions
Unit Group - Remove Track_Unit from Track_UnitGroup.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Current order of Track_Unit) Not equal to Track_Order[UDex]
(Track_Unit is dead) Equal to True
Then - Actions
Unit Group - Remove Track_Unit from Track_UnitGroup.
Else - Actions
Else - Actions
Countdown Timer - Pause Track_Timer
Trigger - Turn off Track Timer <gen>
Move Peon
Events
Unit - A unit Finishes construction
Conditions
Actions
Set VariableSet UDex = (Custom value of (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of Track_Worker[UDex]) Equal to Peon
Then - Actions
Set VariableSet Track_Points[1] = (Position of (Triggering unit))
Set VariableSet Track_Points[2] = (Track_Points[1] offset by (-100.00, 100.00))
Set VariableSet Track_X = (X of Track_Points[2])
Set VariableSet Track_Y = (Y of Track_Points[2])
-------- --------
-------- This moves the unit without interrupting it's orders (This is useful since the worker will retain any order it was given while building) --------
This isn't a foolproof system and will require some configuration depending on the mechanics of your map. For instance, if your Peon has an ability that targets a Point (like Shockwave or Blink) you will have to manually add the orders for those abilities to the conditions in the Track Order trigger.
Example:
If - Conditions
(Issued order) Not equal to (Order(move))
(Issued order) Not equal to (Order(smart))
(Issued order) Not equal to (Order(attack))
(Issued order) Not equal to (Order(patrol))
(Issued order) Not equal to (Order(blink))
(Issued order) Not equal to (Order(shockwave))
The reason I do all of this is because the system relies on the "build" order, which is an order that your worker is given when you tell it to build something. The thing is, the build order is different for every single structure. So it's easier to filter out the unwanted orders rather than checking to see if the order was equal to "orbburrow", "orcbarracks", "orcwarmill", etc.. for every single possible structure. Also, custom structures have their own custom orders, so I would need your map in order to figure them out.
Also, I specifically reference "Unit-type equal to Peon", so if your map uses something other than the standard Peon you will have to change this in the Track Order and Move Peon triggers. And if you want multiple types of Workers to use this system then you'll have to add an "OR" to the conditions to check if it's any of the desired Unit-Types.
Example:
Or - Any (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Peon
(Unit-type of (Triggering unit)) Equal to Peasant
Final Note:
These triggers use this system: GUI Unit Indexer 1.4.0.0
If you already have this particular Unit Indexer in your map then you should delete it's folder since you don't want 2 of them. If there are 2 of them, delete the one that has "Copy" at the end of it's name/variable names.
In other words, delete the new one and KEEP the old one, otherwise there will be conflicts with the Variables.
This is really good thanks. I was playing around with it and adjusted some settings and I can't seem to make it work like I want. If there is something blocking the way, i'd like the peon to move one position counterclockwise along building being constructed. so say there was another orc farm to the left blocking the exit, I'd like it to spawn to the nearest available space going counter clock wise.
I tried using the system with polar offsets and it doesn't seem to work either.
That's a fairly complex system seeing as how each structure has it's own collision.
Edit: I tried to create that blocking system in this new version but it was tough to do. It does work, but it depends on the structure's collision/other circumstances.
It checks for cliffs/water/boundaries, but it doesn't check for units/doodads. That's why I check terrain pathability first and then check for nearby structures second.
Is Terrain pathable?
No -> Move on to the next point, skipping this point's structure check.
Yes -> Check for nearby structures.
Did it find a nearby blocking structure?
No -> The point is pathable and safe to use.
Yes -> Move on to the next point.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.