Hello, I'm having trouble finding a simple way to compare two separate behaviors to eachother. Basically, I have two behaviors, A and B. Lets say I have 3 stacks of behavior A. After casting a certain ability, I want to get 3 stacks of behavior B. I've found that it's possible to do this with switches, and several different effects and validators, but it is very obtuse and you need as many validators+effects as you have potential behavior stacks.
I would like to add that I'm looking for a data-based solution, because obviously there is a very simple trigger-based solution, but I've been trying to code all of the unit effects in the data editor, if possible.
Okay, this solution is untested, so I can't guarantee its success.
-
Validators can't be used to compare the stack count of two behaviors, but requirements can. You can make a requirement that compares the count of two behaviors.
Make a dummy behavior to serve as the conduit for this comparison. Give this dummy behavior the requirement in its Requirements field. Apply this dummy behavior first.
After that, run a create persistent effect. Let's say you want to apply stacks of B. Give this create persistent effect a period count equal to the maximum stacks of A and B. Give it a period effect that applies 1 stack of B.
Now we need a validator. The validator checks that our dummy comparison behavior is on the unit. Put this validator on the apply B effect.
-
Thus, theoretically, the dummy behavior will disable when the number of stacks of B is equal to the number of stacks of A, and the persistent will continue to try to apply more stacks of B, but the validator on the apply effect will stop returning true.
But I don't know if this will work because I don't know if the validator will include requirement-disabled behaviors, or if the requirement will disable the behavior fast enough to prevent the excess period effects.
Data was made for presets. It's good for rts cuz it well organized, it's bad for everything else cuz it's not dynamic. Making something complex in data is routine and no fun at all (basicaly your second work). The best way i found is combination of data and triggers for everything.
simple example: you need to create attachments like helm, shoulders, and weapon from WOW for your character model
in data it means separate actor and model for each attachment, setting up SOps, creation conditions, probably some non-standart animations and stuff. Or model swap event with some condition which wont simplify the case basicaly.
in triggers:
Create a universal function which creates actor in unit's scope and using string as model, Send message to unit's actor Attach ::LastCreated {Weapon,Right} <= you can change this thing dynamicaly. Then you can set host for weapon's actor to missile and make some cool skills like Weapon throw and anything you want, and you can track everything that happens MUCH easier than with data.
And the most important is that you can dynamicaly construct messages for actors, setting speed of animation depending on parameters or variables, which is more precise than "auto scale" flag in data which works like crap.
And any arguments about speed is doubtfull because i rly doubt that data using a direct c+/# code for every object, most likely it uses same in-game language (galaxy) as scripts/gui. In this case there is no speed difference at all, i guess...
Hello, I'm having trouble finding a simple way to compare two separate behaviors to eachother. Basically, I have two behaviors, A and B. Lets say I have 3 stacks of behavior A. After casting a certain ability, I want to get 3 stacks of behavior B. I've found that it's possible to do this with switches, and several different effects and validators, but it is very obtuse and you need as many validators+effects as you have potential behavior stacks.
I would like to add that I'm looking for a data-based solution, because obviously there is a very simple trigger-based solution, but I've been trying to code all of the unit effects in the data editor, if possible.
@zRedFoxz: Go
Okay, this solution is untested, so I can't guarantee its success.
-
Validators can't be used to compare the stack count of two behaviors, but requirements can. You can make a requirement that compares the count of two behaviors.
Make a dummy behavior to serve as the conduit for this comparison. Give this dummy behavior the requirement in its Requirements field. Apply this dummy behavior first.
After that, run a create persistent effect. Let's say you want to apply stacks of B. Give this create persistent effect a period count equal to the maximum stacks of A and B. Give it a period effect that applies 1 stack of B.
Now we need a validator. The validator checks that our dummy comparison behavior is on the unit. Put this validator on the apply B effect.
-
Thus, theoretically, the dummy behavior will disable when the number of stacks of B is equal to the number of stacks of A, and the persistent will continue to try to apply more stacks of B, but the validator on the apply effect will stop returning true.
But I don't know if this will work because I don't know if the validator will include requirement-disabled behaviors, or if the requirement will disable the behavior fast enough to prevent the excess period effects.
-
Or you could just use triggers.
@zRedFoxz: Go
Data was made for presets. It's good for rts cuz it well organized, it's bad for everything else cuz it's not dynamic. Making something complex in data is routine and no fun at all (basicaly your second work). The best way i found is combination of data and triggers for everything.
simple example: you need to create attachments like helm, shoulders, and weapon from WOW for your character model
in data it means separate actor and model for each attachment, setting up SOps, creation conditions, probably some non-standart animations and stuff. Or model swap event with some condition which wont simplify the case basicaly.
in triggers:
Create a universal function which creates actor in unit's scope and using string as model, Send message to unit's actor Attach ::LastCreated {Weapon,Right} <= you can change this thing dynamicaly. Then you can set host for weapon's actor to missile and make some cool skills like Weapon throw and anything you want, and you can track everything that happens MUCH easier than with data.
And the most important is that you can dynamicaly construct messages for actors, setting speed of animation depending on parameters or variables, which is more precise than "auto scale" flag in data which works like crap.
And any arguments about speed is doubtfull because i rly doubt that data using a direct c+/# code for every object, most likely it uses same in-game language (galaxy) as scripts/gui. In this case there is no speed difference at all, i guess...
Check my old choosable attributes demo map for the data solution.
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