In game, when a refinery, extractor or assimilator is selected, in the info panel their is an information about « Current harvesters : x »
Do anyone know how i can access this information via GUI ?
I have tried to select nearby workers and then unselect workers based on « target unit order » (if the target is not the geyser, i remove the workers from the group). But some workers go inside the geyser, and some other just go back to the town, so it doesn't work as intended.
The scv, inside the refinery, are hidden. So i just had to unselect the filter to get them as they still target the geyser.
But, for now, i can't filters the scv who are going returning to town, to know wich one is coming from which refinery. The information is stored somewhere since a scv which is stopped, moved and then ordered to « return cargo » will always return to its original refinery.
Is there a way to have access to the unit (refinery) which gave an order to a unit (scv) ? As i guess the refinery order the scv to return after it has gathered gas.
No, you can't get the refinery from the return cargo order as far as I know. That reference must be stored internally as part of the harvest ability, but it's not available to triggers.
Yes, you can get the unit which cast a behavior on a unit with the Unit Behavior Effect Unit function, but in this case it turns out that the caster is the SCV itself, so it's unhelpful.
I'm trying to work out a solution using dummy behaviors as a way of keeping a reference to the refinery on the SCV and vice versa, but it's a little tricky when to remove the behaviors. You'll hear from me later this week if I can figure it out and no one else beats me to it, or you can try to take a stab at it yourself.
I added a search effect to the "CarryHarvestableVespeneGeyserGas" behavior (there's 1 for each race) on the initial effect. This searches for the refinery and adds a behavior to it. The behavior lasts 10 seconds, with a limit of 1 stack per caster.
This won't tell you how many workers are harvesting immediately, it takes time to sort itself out. I only use this for a fake AI to tell whether a geyser has too many or too few workers.
Thank you very much for your answers, and for time you are spending on this.
I will continue to search for a solution, and let you know if i find something.
Alright, here's what I got... it's not a flexible solution and it isn't even 100% accurate, although it should suffice for typical melee gameplay conditions, and it's the best I could do.
Unfortunately there's no simple built-in function to count the number of harvesters on a resource, and even though it's possible to access attribute values via triggers when (and only when) such attributes change, the harvester count shown in the unit info panel seems to be a special attribute that isn't detected by triggers. This is an area that Blizzard really ought to improve...
My solution consists of 2 behaviors, 18 validators for those behaviors (4 per worker, including MULE, to check harvesting status, plus two Combine validators - I tried to make a pun on "combine harvester" in the names, but couldn't think of anything funny), 1 trigger to apply the behaviors, and 4 functions to get harvesting information.
The first behavior, Harvester, is applied to harvesters and acts as a reference to the resource being harvested via the Unit Behavior Effect Unit function. The second behavior, Harvested, is basically the same, except it's applied to the resource from the harvester unit. The validators make sure that the behaviors are removed when necessary (I tried doing this through triggers at first, but it was much more convoluted – and probably also slower).
The Harvested behavior is allowed to stack up to 65,535 times (more than the amount of units that can be on the map at any given time, just in case you were worried), and the stack count simply gives you the number of harvesters via the Stack Count Of Behavior On Unit function.
To add a new harvest ability to this system, you'd have to:
Duplicate the following validators, rename them and update the (Basic) Validator: Ability fields:
Caster Is Gathering Target (Drone)
Caster Is Returning Cargo (Drone)
Target Is Gathering Caster (Drone)
Target Is Returning Cargo (Drone)
Add the first two to the Caster Is Harvesting validator, and add the last two to the Target Is Harvesting validator.
Duplicate one of the Unit Uses Ability events from the trigger and update the Ability parameter.
This is assuming that no unit has multiple harvest abilities (otherwise you'd need more behaviors and more validators and more complicated triggers and functions).
A test map is attached to this post and if you want to check it out, there's a little debug inspector showing the number of harvesters on a resource. You can choose a different resource to inspect by pinging on it.
Hi
Is there a way to have the number of workers gathering a specific gas geyser ?
Thank you !
In game, when a refinery, extractor or assimilator is selected, in the info panel their is an information about « Current harvesters : x »
Do anyone know how i can access this information via GUI ?
I have tried to select nearby workers and then unselect workers based on « target unit order » (if the target is not the geyser, i remove the workers from the group). But some workers go inside the geyser, and some other just go back to the town, so it doesn't work as intended.
The scv, inside the refinery, are hidden. So i just had to unselect the filter to get them as they still target the geyser.
But, for now, i can't filters the scv who are going returning to town, to know wich one is coming from which refinery. The information is stored somewhere since a scv which is stopped, moved and then ordered to « return cargo » will always return to its original refinery.
Is there a way to have access to the unit (refinery) which gave an order to a unit (scv) ? As i guess the refinery order the scv to return after it has gathered gas.
Need help, please !
SCV who are coming back from refinery have an order : SCVHarvest(1) and a behaviour CarryHarvestableVespeneGeyserGas.
Is there a way, in the trigger editor, to know which unit did ordered them this order, or which unit did give them this behaviour ?
Thank you in advance !
I'm trying to work out a solution using dummy behaviors as a way of keeping a reference to the refinery on the SCV and vice versa, but it's a little tricky when to remove the behaviors. You'll hear from me later this week if I can figure it out and no one else beats me to it, or you can try to take a stab at it yourself.
I added a search effect to the "CarryHarvestableVespeneGeyserGas" behavior (there's 1 for each race) on the initial effect. This searches for the refinery and adds a behavior to it. The behavior lasts 10 seconds, with a limit of 1 stack per caster.
This won't tell you how many workers are harvesting immediately, it takes time to sort itself out. I only use this for a fake AI to tell whether a geyser has too many or too few workers.
Thank you very much for your answers, and for time you are spending on this. I will continue to search for a solution, and let you know if i find something.
Alright, here's what I got... it's not a flexible solution and it isn't even 100% accurate, although it should suffice for typical melee gameplay conditions, and it's the best I could do.
Unfortunately there's no simple built-in function to count the number of harvesters on a resource, and even though it's possible to access attribute values via triggers when (and only when) such attributes change, the harvester count shown in the unit info panel seems to be a special attribute that isn't detected by triggers. This is an area that Blizzard really ought to improve...
My solution consists of 2 behaviors, 18 validators for those behaviors (4 per worker, including MULE, to check harvesting status, plus two Combine validators - I tried to make a pun on "combine harvester" in the names, but couldn't think of anything funny), 1 trigger to apply the behaviors, and 4 functions to get harvesting information.
The first behavior, Harvester, is applied to harvesters and acts as a reference to the resource being harvested via the Unit Behavior Effect Unit function. The second behavior, Harvested, is basically the same, except it's applied to the resource from the harvester unit. The validators make sure that the behaviors are removed when necessary (I tried doing this through triggers at first, but it was much more convoluted – and probably also slower).
The Harvested behavior is allowed to stack up to 65,535 times (more than the amount of units that can be on the map at any given time, just in case you were worried), and the stack count simply gives you the number of harvesters via the Stack Count Of Behavior On Unit function.
To add a new harvest ability to this system, you'd have to:
This is assuming that no unit has multiple harvest abilities (otherwise you'd need more behaviors and more validators and more complicated triggers and functions).
A test map is attached to this post and if you want to check it out, there's a little debug inspector showing the number of harvesters on a resource. You can choose a different resource to inspect by pinging on it.
Thank you very much, temhawk ! I am very busy with work this week, but i will use your work as soon as next week !