I'm regenerating my command center's energy a little when ever a unit brings minerals to it. I only have one building per player that needs this so it can be a very broad trigger.
I've been playing around with player property in the event, but that only leads to whether or not it changes. In conditions, it lets you define how much a player has but not by how much it changed or whether it was a positive or negative change.
I tried looking for something with the mining unit. Maybe, miner returns minerals, but I can't find anything like this. I'm going to try cargo, but I don't know what that does.
You could store the Old mineral value in a variable, and then in the actions subtract the old value from the current value to get the change.
In this example I have a global variable called OldMinerals. Just add the actions into the Then or else(The last Set Variable is not in the else statement). There is probably also a way to do it in the trigger editor, but I wasn't able to find it with a quick look, perhaps someone else would know.
Events
Player - Player 1 Minerals changes
Local Variables
MineralChange = 0 <Integer>
Conditions
Actions
Variable - Set MineralChange = ((Player 1 Minerals) - OldMinerals)
General - If (Conditions) then do (Actions) else do (Actions)
If
MineralChange > 0
Then
Else
Variable - Set OldMinerals = (Player 1 Minerals)
I'm regenerating my command center's energy a little when ever a unit brings minerals to it. I only have one building per player that needs this so it can be a very broad trigger.
I've been playing around with player property in the event, but that only leads to whether or not it changes. In conditions, it lets you define how much a player has but not by how much it changed or whether it was a positive or negative change.
I tried looking for something with the mining unit. Maybe, miner returns minerals, but I can't find anything like this. I'm going to try cargo, but I don't know what that does.
If anybody knows of a way to do this let me know.
No ideas?
Well, I don't have any, but Cargo probably wouldn't work because Cargo generally refers to what's in a Medivac/Overlord/Nydus Worm/Warp Prism. :/
Other than that, I have no clue. But I'm sure it's possible.
You could store the Old mineral value in a variable, and then in the actions subtract the old value from the current value to get the change.
In this example I have a global variable called OldMinerals. Just add the actions into the Then or else(The last Set Variable is not in the else statement). There is probably also a way to do it in the trigger editor, but I wasn't able to find it with a quick look, perhaps someone else would know.
Events
Player - Player 1 Minerals changes
Local Variables
MineralChange = 0 <Integer>
Conditions
Actions
Variable - Set MineralChange = ((Player 1 Minerals) - OldMinerals)
General - If (Conditions) then do (Actions) else do (Actions)
If
MineralChange > 0
Then
Else
Variable - Set OldMinerals = (Player 1 Minerals)
Worked a charm, thanks.