I guess this question is more about how the Effects: Validators field works for a Search Area effect, but maybe I'm just looking at things the wrong way.
I have a Search Area effect that currently returns a list of structures controlled by any player, sorted by distance. When a structure is found, the source of the effect is given an Issue Order effect that issues a move order targetting it. (I got this working a couple days ago thanks to the help of SC2Mapster!) This works fine, but I'd like to narrow the criteria so that the unit finds all neutral and enemy structures as well as allied structures with less than 5 stacks of a specific buff behavior.
As things are now, my Search Area effect will return any structure but does not consider how many stacks of the buff are on allied structures. I'm validating the Issue Order effect with a Combine validator that checks if the target is allied and lacks the specific buffs, but it only appears to be yielding allied targets for the move command occasionally and arbitrarily, and even then certainly not based on the TSDistanceToTarget sort filter in the Search Area effect. Should I be doing validation somewhere else?
edit: Sorry about my huge topic titles! I've been figuring they help other people looking for similar information find things more easily in search results, but if they're too disruptive do let me know.
I'd like to narrow the criteria so that the unit finds all neutral and enemy structures as well as allied structures with less than 5 stacks of a specific buff behavior.
Avoiding the wall. you could try combine validator and use other combined in it. Like (A OR B OR (C AND D)). It follows the same rules as programming because validators are really just bool checks in code
Yes, but I'm not sure where where that validator should be specifically. Should I put it in the Search Area effect, or the Issue Order effect? If it goes in the former, should I remove the existing filters and do the entire thing through a validation tree?
if your current validator works than replace it. If i misread and you simply search area than yea put it in search area to eliminate unnecessary storage
validator either returns true or false. if you current returns true to allied unit comparison than there's nothing wrong in simply expanding the condition
EDIT: Actually you just want to check if (target != ally OR (stacks > 0 AND stacks < 5 ))
Enemy -> (target != ally) = true. Add. Result of next doesn't mater because only 1 needs to be true due OR
Neutral -> (target != ally) = true. Add
Ally -> (target != ally) = false. Checking (stacks > 0 AND stacks < 5 ). if true Add. if false than it means that ally either does not have any stacks or have more than 5
if ally without stacks is also ok than remove 'stacks > 0' and simply do (target != ally OR stacks < 5)
Hmm... is there a way to validate if the target is owned by a specific player? For example, could I say:
(Owner of unit == 5)
in a Validator? I know how to validate (Owner of unit == Ally / Enemy / Neutral / Player) but not a specific player. Is this possible?
If it is, I think I can solve this problem. I wasn't entirely clear in my opening post; I am actually using two stackable behaviors here, each associated with a player, and when one stack reaches 5 the target flips to ownership of the player associated with it. To fix the bug I have, the validator check I need to be making is
Not having much luck validating ownership by a specific player. I may to take a different approach, then! I don't think I can do this one in triggers at all due to everything else that it interacts with, but maybe I can make a temporary buff appear on valid allied targets when the right conditions are met and the Issue Order effect just validates whether or not the target has that buff, or something along those lines.
i don't see player index comparison but if it's really important (you didn't mention that before) you you could create dummy behavior per player index. Name their ids for example. Player_0_Flag, Player_1_Flag, Player_2_Flag etc
unit enter region (playable map area)
add behavior to triggering unit . behavior = "Player_"+IntToString(EventPlayer())+"_Flag" in custom script section
then just compare behavior count Player_0_Flag == 1 etc
other less efficient way is to use 1 dummy behavior and just add Triggering Player() amount of stacks. and then compare the stacks to identify player index
Just use a Combine validator set to And that combines a Unit Filter for enemy and neutral, a Unit Compare Behavior Count validator that requires equal or less than 5 of buff and second Combine validator. For the second Combine validator have it set to Or and use several Unit Type validators for the various valid target structures. Finally put the first combine into the Issue Order effect validators.
Have no validators in your search unless you do not want it to even try searching on some conditions and set the Target - Target Sorts - Sorts field to TSDistance.
You cannot validate individual players without triggers or a buff/trigger combo.
The reason this works is because, whenever a structure has 5 of one of the buffs it also has 0 of the other buff, and as such it is either under enemy control (always a valid target) or under secure allied control (never a valid target). When one of the buffs is less than 5, though, the structure is contested and therefore a valid target regardless of its current owner. I probably should have made it more clear how the two types of buffs interact with each other; in short, the structure can never have more than 5 buffs total, and adding one buff removes one of the opposing one.
Thanks for the help! Even though I didn't use any of the suggestions, the clarification is always appreciated and helps me understand how things work in the data editor.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I guess this question is more about how the Effects: Validators field works for a Search Area effect, but maybe I'm just looking at things the wrong way.
I have a Search Area effect that currently returns a list of structures controlled by any player, sorted by distance. When a structure is found, the source of the effect is given an Issue Order effect that issues a move order targetting it. (I got this working a couple days ago thanks to the help of SC2Mapster!) This works fine, but I'd like to narrow the criteria so that the unit finds all neutral and enemy structures as well as allied structures with less than 5 stacks of a specific buff behavior.
As things are now, my Search Area effect will return any structure but does not consider how many stacks of the buff are on allied structures. I'm validating the Issue Order effect with a Combine validator that checks if the target is allied and lacks the specific buffs, but it only appears to be yielding allied targets for the move command occasionally and arbitrarily, and even then certainly not based on the TSDistanceToTarget sort filter in the Search Area effect. Should I be doing validation somewhere else?
edit: Sorry about my huge topic titles! I've been figuring they help other people looking for similar information find things more easily in search results, but if they're too disruptive do let me know.
Avoiding the wall. you could try combine validator and use other combined in it. Like (A OR B OR (C AND D)). It follows the same rules as programming because validators are really just bool checks in code
Yes, but I'm not sure where where that validator should be specifically. Should I put it in the Search Area effect, or the Issue Order effect? If it goes in the former, should I remove the existing filters and do the entire thing through a validation tree?
if your current validator works than replace it. If i misread and you simply search area than yea put it in search area to eliminate unnecessary storage
validator either returns true or false. if you current returns true to allied unit comparison than there's nothing wrong in simply expanding the condition
EDIT: Actually you just want to check if (target != ally OR (stacks > 0 AND stacks < 5 ))
if ally without stacks is also ok than remove 'stacks > 0' and simply do (target != ally OR stacks < 5)
Hmm... is there a way to validate if the target is owned by a specific player? For example, could I say:
(Owner of unit == 5)
in a Validator? I know how to validate (Owner of unit == Ally / Enemy / Neutral / Player) but not a specific player. Is this possible?
If it is, I think I can solve this problem. I wasn't entirely clear in my opening post; I am actually using two stackable behaviors here, each associated with a player, and when one stack reaches 5 the target flips to ownership of the player associated with it. To fix the bug I have, the validator check I need to be making is
I am certain this will work, but I just need to figure out how to validate a specific player number.
Not having much luck validating ownership by a specific player. I may to take a different approach, then! I don't think I can do this one in triggers at all due to everything else that it interacts with, but maybe I can make a temporary buff appear on valid allied targets when the right conditions are met and the Issue Order effect just validates whether or not the target has that buff, or something along those lines.
i don't see player index comparison but if it's really important (you didn't mention that before) you you could create dummy behavior per player index. Name their ids for example. Player_0_Flag, Player_1_Flag, Player_2_Flag etc
then just compare behavior count Player_0_Flag == 1 etc
other less efficient way is to use 1 dummy behavior and just add Triggering Player() amount of stacks. and then compare the stacks to identify player index
Just use a Combine validator set to And that combines a Unit Filter for enemy and neutral, a Unit Compare Behavior Count validator that requires equal or less than 5 of buff and second Combine validator. For the second Combine validator have it set to Or and use several Unit Type validators for the various valid target structures. Finally put the first combine into the Issue Order effect validators.
Have no validators in your search unless you do not want it to even try searching on some conditions and set the Target - Target Sorts - Sorts field to TSDistance.
You cannot validate individual players without triggers or a buff/trigger combo.
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
I ended up getting the result I wanted through an even more basic validation check:
The reason this works is because, whenever a structure has 5 of one of the buffs it also has 0 of the other buff, and as such it is either under enemy control (always a valid target) or under secure allied control (never a valid target). When one of the buffs is less than 5, though, the structure is contested and therefore a valid target regardless of its current owner. I probably should have made it more clear how the two types of buffs interact with each other; in short, the structure can never have more than 5 buffs total, and adding one buff removes one of the opposing one.
Thanks for the help! Even though I didn't use any of the suggestions, the clarification is always appreciated and helps me understand how things work in the data editor.