I'm trying to figure out how to make a trigger say:
Pick unit from workers.
If picked unit doesn't have mineral and not building a building/on the way to build a building
then
issue order to build new building X
So far, the only thing I can figure out is:
Unit Group - Pick each unit in Builders[1] and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
((Picked unit) has Carry Mineral Field Minerals) == false
Anyone know how to add a condition that says unit is not currently building a building or on the way to build one?
Have a trigger that does this
Event: Unit uses an ability
Condition: ability is <build ability>
actions:
if Triggering Ability Stage == Build Complete or triggering ability stage == build pause:
workers_building_unit_group remove triggering unit
else:
workers_building_unit_group add triggering unit
workers building unit group is a unit group variable that will contain all workers currently building
Unit Currently Building
Events
Unit - Any Unit uses SCV - Build (SCV) at Generic3 - Execute stage (Ignore shared abilities)
Local Variables
Conditions
(Owner of (Triggering unit)) == 2
Actions
Unit Group - Remove (Triggering unit) from Builders[1]
Unit Group - Add (Triggering unit) to Builder is Building
Unit Finished Building
Events
Unit - Any Unit construction is Completed
Local Variables
Conditions
(Owner of (Triggering unit)) == 2
Actions
Unit Group - Pick each unit in (Any units in (Region((Position of (Triggering unit)), 6.0)) owned by player 2 matching Required: Worker, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
((Picked unit) is in Builder is Building) == true
Then
Unit Group - Remove (Picked unit) from Builder is Building
Unit Group - Add (Picked unit) to Builders[1]
Else
Thanks for creating this thread, Zero. I'm able to remove a bug from my map that I was planning on looking into later, but now I have an answer right here instead. (In about 10% of my maps, one of the two bases would spontaneously stop building, pretty major bug that doesn't happen consistently.) This thread made me realize that I wasn't removing the Drone from the worker group, which I assume selecting a Drone that is already building a structure caused the bug.
No problem man. Ya it is a royal pain to get the AI to work correctly. Like, for instance, getting the computer to ONLY have 3 workers getting gas was the HARDEST thing to get to work. Ridiculous amount of bs. Glad I could help :)
I'm trying to figure out how to make a trigger say:
So far, the only thing I can figure out is:
Anyone know how to add a condition that says unit is not currently building a building or on the way to build one?
@Zero0018:
Here's one way:
Have a trigger that does this
Event: Unit uses an ability
Condition: ability is <build ability>
actions:
if Triggering Ability Stage == Build Complete or triggering ability stage == build pause:
workers_building_unit_group remove triggering unit
else:
workers_building_unit_group add triggering unit
workers building unit group is a unit group variable that will contain all workers currently building
Works like a charm. Thanks for the idea :D
@Zero0018: Go
Thanks for creating this thread, Zero. I'm able to remove a bug from my map that I was planning on looking into later, but now I have an answer right here instead. (In about 10% of my maps, one of the two bases would spontaneously stop building, pretty major bug that doesn't happen consistently.) This thread made me realize that I wasn't removing the Drone from the worker group, which I assume selecting a Drone that is already building a structure caused the bug.
No problem man. Ya it is a royal pain to get the AI to work correctly. Like, for instance, getting the computer to ONLY have 3 workers getting gas was the HARDEST thing to get to work. Ridiculous amount of bs. Glad I could help :)