I'm using custom values within triggers to store custom unit data like health and magic in a special system I'm working on.
Is there any way to detect when a unit's custom value changes? I thought it was with "unit property changes" but apparently it isn't. I need to be able to change a unit's custom value in one trigger, and then have a second trigger that detects that the custom value changed, and then respond accordingly.
Oh god, I didn't even know these existed in sc2 and have no idea what they are. Any good tutorials for these? I found one, but I didn't understand what he was trying to even do with his trigger :S
EDIT: Oh wait a minute.. I THINK I understand the concept. For example: when the custom value representing the health for my unit changes in an action, I COULD create a bunch of actions following that that would be like "if this units custom value 'health' is less than zero, kill the unit", and then I would have to do this everywhere health changes.
OR
You create the response for health changing inside of the action definition, and then you just put that action after a unit is damaged so you dont have to do all the actions every single time.
Is that the main gist of it?
DOUBLE EDIT: Sorry for editing twice, but YES.. action definitions are bad-ass, and your recommendation worked like a charm! Thanks :)
Yep, action definitions are basically the same as putting duplicate actions in every trigger, except that they save both time (for you) and memory (for the map.)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm using custom values within triggers to store custom unit data like health and magic in a special system I'm working on.
Is there any way to detect when a unit's custom value changes? I thought it was with "unit property changes" but apparently it isn't. I need to be able to change a unit's custom value in one trigger, and then have a second trigger that detects that the custom value changed, and then respond accordingly.
Thanks!
Create an action definition that has the unit as parameter that reacts to it accordingly and call it after every change that needs to be handled.
@Ahli634: Go
Oh god, I didn't even know these existed in sc2 and have no idea what they are. Any good tutorials for these? I found one, but I didn't understand what he was trying to even do with his trigger :S
EDIT: Oh wait a minute.. I THINK I understand the concept. For example: when the custom value representing the health for my unit changes in an action, I COULD create a bunch of actions following that that would be like "if this units custom value 'health' is less than zero, kill the unit", and then I would have to do this everywhere health changes.
OR
You create the response for health changing inside of the action definition, and then you just put that action after a unit is damaged so you dont have to do all the actions every single time.
Is that the main gist of it?
DOUBLE EDIT: Sorry for editing twice, but YES.. action definitions are bad-ass, and your recommendation worked like a charm! Thanks :)
@watterboy1: Go
Yep, action definitions are basically the same as putting duplicate actions in every trigger, except that they save both time (for you) and memory (for the map.)