Using triggers, how do I get the number of workers that are harvesting gas from a refinery? Like for example, if there are 2 workers mining at the refinery, I want to get 2.
Using triggers, how do I get the number of workers that are harvesting gas from a refinery? Like for example, if there are 2 workers mining at the refinery, I want to get 2.
(Given there's no 'workers mining resource' function we've overlooked) I can think of two ways to do this:
1. Calculate the time of one period of a worker mining a mineral source and turning it in to a building. Every time a worker puts minerals in a building, (event - ability used - idk the stage), modify the custom value 0 (arbitrary) on the building to be +1, then wait the time of one period that you calculated, then put custom value 0 on the building to be -1. This only works if the distances from the resources to the nearest buildings are the all the same globally. Return the custom value 0 on a building to get the worker count.
2. Create an indexed unit group variable of dimensions 100 (arb.). Whenever a worker is ordered to or starts mining a resource via AI, add the worker to the unit group variable at the index of the nearest building's tag ID and set the worker's custom value 0 (arb.) to the nearest building's tag ID. When a worker is given any order or dies, remove it from the unit group variable at the index of the custom value 0 of the worker.
Tried bothering to look?
There is a current harvest count as well as another gas related function in the advanced ui section. Blizzard has already implemented these functions in standard melee maps so why bother. Either way Charysmatic's suggestions are decent alternatives as well.
Rollback Post to RevisionRollBack
When I want your opinion...I'll give it to you!
To post a comment, please login or register a new account.
Using triggers, how do I get the number of workers that are harvesting gas from a refinery? Like for example, if there are 2 workers mining at the refinery, I want to get 2.
Seriously? Nothing?
@Chris97Ong: Go
That comes across as a bit entitled to me. The word "bump" would suffice.
(Given there's no 'workers mining resource' function we've overlooked) I can think of two ways to do this:
1. Calculate the time of one period of a worker mining a mineral source and turning it in to a building. Every time a worker puts minerals in a building, (event - ability used - idk the stage), modify the custom value 0 (arbitrary) on the building to be +1, then wait the time of one period that you calculated, then put custom value 0 on the building to be -1. This only works if the distances from the resources to the nearest buildings are the all the same globally. Return the custom value 0 on a building to get the worker count.
2. Create an indexed unit group variable of dimensions 100 (arb.). Whenever a worker is ordered to or starts mining a resource via AI, add the worker to the unit group variable at the index of the nearest building's tag ID and set the worker's custom value 0 (arb.) to the nearest building's tag ID. When a worker is given any order or dies, remove it from the unit group variable at the index of the custom value 0 of the worker.
@Chris97Ong: Go
Tried bothering to look? There is a current harvest count as well as another gas related function in the advanced ui section. Blizzard has already implemented these functions in standard melee maps so why bother. Either way Charysmatic's suggestions are decent alternatives as well.