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.
Development > Triggers
Detect when Custom Value is changed?
- 4 posts
-
Ahli634 Regular Shmoe
- Battle.net
- Ahli
- #634 EU
- Join date
- Apr 04, 2011
- Location
- Germany
- Reputation
- 60
- Posts
- 832
- Online now!
-
watterboy1 Regular Shmoe
- Join date
- Nov 01, 2011
- Location
- United States
- Reputation
- 0
- Posts
- 44
- Last login
- Jan 08, 2013
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 :)
Last edited Dec 10, 2012 by watterboy1 -
BasharTeg Author
- Battle.net
- Miles
- #152 NA
- Join date
- Sep 15, 2010
- Location
- United States
- Reputation
- 31
- Posts
- 1,141
- Projects
- 4
- Last login
- Jun 19, 2013
@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.)
My Projects:
Malum Ruina: SC2Mapster
Eternal Exile: SC2Mapster
Spine Crawler Madness: SC2Mapster
Xeno Crisis: SC2Mapster
- 4 posts

watterboy1 Regular ShmoeI'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!