Do custom values assigned via triggers stay with the unit even when it morphs? I assign a custom value to a larva based on who owns it before making it a neutral unit. I then assign the custom value to it so I can see who created it later. But when the larva morphs into a zergling and I check the value, its 0 again...Any advice?
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
I assume the custom value is linked to the unit ID. So when a unit changes its actor, I guess the ID is different and the custom values are dropped. In the case of a merged/morphed unit, I think any custom value is lost or it could cause errors. Imagine 2 units with a custom value when they merge: which custom value are you supposed to keep then? It's logically impossible, so I'm pretty sure the custom values are reset to 0 in that case.
The only option I can think of is using banks instead of custom values (or both combined, maybe), but since I don't have a clue on how they work yet, I can't tell you accurately. I just tried using them today and I'm not totally sure how they can be used, but I'm convinced they have huge potential...
Banks are for storing information between maps. So if you want the map to start and be like "Oh, this player got to lv 90 last time he played. I'll load his old charactor up" you use banks. Its how maps like debates or NWW stores your points between games.
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
Damn... That won't be of any help to you, I guess...
Maybe you can store both custom values in a temporary variable, and each time a larva is morphed you will run a bunch of scripts that will determine which custom value to keep, and assign it to the new unit. It's kind of complicated for almost nothing, and I assume it will be a real hell to make it happen for each larva in the map (considering some might morph at the same time), but it's my best shot so far...
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Do custom values assigned via triggers stay with the unit even when it morphs? I assign a custom value to a larva based on who owns it before making it a neutral unit. I then assign the custom value to it so I can see who created it later. But when the larva morphs into a zergling and I check the value, its 0 again...Any advice?
@zeldarules28: Go
I assume the custom value is linked to the unit ID. So when a unit changes its actor, I guess the ID is different and the custom values are dropped. In the case of a merged/morphed unit, I think any custom value is lost or it could cause errors. Imagine 2 units with a custom value when they merge: which custom value are you supposed to keep then? It's logically impossible, so I'm pretty sure the custom values are reset to 0 in that case.
The only option I can think of is using banks instead of custom values (or both combined, maybe), but since I don't have a clue on how they work yet, I can't tell you accurately. I just tried using them today and I'm not totally sure how they can be used, but I'm convinced they have huge potential...
Banks are for storing information between maps. So if you want the map to start and be like "Oh, this player got to lv 90 last time he played. I'll load his old charactor up" you use banks. Its how maps like debates or NWW stores your points between games.
Damn... That won't be of any help to you, I guess...
Maybe you can store both custom values in a temporary variable, and each time a larva is morphed you will run a bunch of scripts that will determine which custom value to keep, and assign it to the new unit. It's kind of complicated for almost nothing, and I assume it will be a real hell to make it happen for each larva in the map (considering some might morph at the same time), but it's my best shot so far...