I found one :) Trigger with the event set to "Unit uses ability", set the ability to be "return cargo" and then set the stage to "harvest7 - Drop Off". This will fire whenever a unit is setting down the resource at a collector. Huge bonus is that event sets up a number of internal pointers for the rest of the trigger that let you refer to the specific unit that did it and I assume the pointer called 'Triggering ability target point' would then reference the specific collector its dropping off at. The only missing piece is how to determine which resource its dropping off, but depending on when precisely the event handler interrupts you could probably poke the unit's behaviors to see which resource behavior its got.
ED: Damn the event handler fires only after the resource transfer to the collector and the behavior have been stripped off, boo. But hey its a start.
To find out what kind of resource the unit dropped off, you could TRY checking the target of its order after dropoff.
It might be doing harvest targeting mineral field / geyser.
Has anyone found a way to figure out which type of resource has been dropped of when the "Unit uses ability" - "return cargo" - "harvest7 - Drop Off" event fires?
I'm trying to make a trigger that 'steals' an amount of the gathered resource gathered by one player giving it to another player. The amount being stolen would be 2 for minerals and 1 for gas.
Nice necro. Simple answer would be to use the behavior given by the harvest ability. The actual resources harvested are defined by the units from which the resource is being harvested so unless you want to simulate harvesting using a series of behaviours and modify player effects there is no simple answer.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
I managed to get the type of resource by checking if "Target Unit For Order" with an index of 0 for the worker has the behaviour "minerals" or "vespene". It works fine when units are auto-mining but when you re-target the worker after a resource has been handed in, the target will be off.
It's not 100% correct by will do for now. I programmed it in a way that deliberately exploiting this will result in even more minerals stolen.
is there an event that fires when a unit harvests a resource? i'm trying to create a trigger that runs when a unit brings resources to a town hall.
Try 'player property changes'. Although that will also run if you change it with a trigger.
There are things that go off, you can do
Player - Player 1 Minerals changes
event, and see if they increased (aka just harvested) there are other ways, but thats off the top of my head
that will work, but i also need to actually get the unit that returned the resource. any idea how to do that?
I found one :) Trigger with the event set to "Unit uses ability", set the ability to be "return cargo" and then set the stage to "harvest7 - Drop Off". This will fire whenever a unit is setting down the resource at a collector. Huge bonus is that event sets up a number of internal pointers for the rest of the trigger that let you refer to the specific unit that did it and I assume the pointer called 'Triggering ability target point' would then reference the specific collector its dropping off at. The only missing piece is how to determine which resource its dropping off, but depending on when precisely the event handler interrupts you could probably poke the unit's behaviors to see which resource behavior its got.
ED: Damn the event handler fires only after the resource transfer to the collector and the behavior have been stripped off, boo. But hey its a start.
To find out what kind of resource the unit dropped off, you could TRY checking the target of its order after dropoff.
It might be doing harvest targeting mineral field / geyser.
Has anyone found a way to figure out which type of resource has been dropped of when the "Unit uses ability" - "return cargo" - "harvest7 - Drop Off" event fires?
I'm trying to make a trigger that 'steals' an amount of the gathered resource gathered by one player giving it to another player. The amount being stolen would be 2 for minerals and 1 for gas.
Nice necro. Simple answer would be to use the behavior given by the harvest ability. The actual resources harvested are defined by the units from which the resource is being harvested so unless you want to simulate harvesting using a series of behaviours and modify player effects there is no simple answer.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
I managed to get the type of resource by checking if "Target Unit For Order" with an index of 0 for the worker has the behaviour "minerals" or "vespene". It works fine when units are auto-mining but when you re-target the worker after a resource has been handed in, the target will be off. It's not 100% correct by will do for now. I programmed it in a way that deliberately exploiting this will result in even more minerals stolen.