Hey, so trying to move a negative region via triggers, but not having any luck. Is there a trick behind this, or am I going nuts and it is really easy, or? Overly complex workarounds welcome!
Well, if you're a fan of overly complicated workarounds, you could probably move a normal region to where you want the negative to be and just exclude that region in your triggers.
For example, if you wanted to add all the units in a region to a unit group, but not a "negative" region within it, you could:
Pick each unit in region "Primary Region"
If picked unit is in region "Negative Region" Then Nothing
It makes sense, but not exactly what I am wanting to do. Although I didn't know you could do is in region comparisons, I could just use positive regions to verify a point is not inside certain regions when spawning units that way. Thanks for helping me reach a solution of sorts.
Of course, the ideal solution for me is to have a large region, with 8 circle negative regions where the players hero units are, and to spawn at a random point in the large region, just not those 8 negative regions. It needs to be dynamic, and I've heard bad things about creating regions via triggers performance wise. This may well be spawning 50-60 units in an interval, so I'm looking to keep my iterations as low as possible.
If anyone knows how to do it that way, I'm all ears :)
Negative area applied to regions is dominant and permanent. There is no way to make a negative area positive once it is added to the region. As such your only solution is to periodically re-create the region and apply new negative regions to it.
If your positive region is a complex shape (many small positive areas) then you can improve performance by storing the only positive region as a template. Every time you want to move the negative areas you can then create a new empty region, add the positive template region to it and then go ahead and place your negative regions on it. This simplifies the positive region fill to a single function call as opposed to having to iteratively adding each positive area. Performance wise the process should not be too demanding and do not concern yourself about leaks as regions are automatically garbage collected.
Do note that highly complicated regions likely perform worse than simple regions. Also complex regions might return random points that are null in the case of it not being able to find a point randomly so care should be taken to handle such an error case, even if it is virtually impossible to occur.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey, so trying to move a negative region via triggers, but not having any luck. Is there a trick behind this, or am I going nuts and it is really easy, or? Overly complex workarounds welcome!
Well, if you're a fan of overly complicated workarounds, you could probably move a normal region to where you want the negative to be and just exclude that region in your triggers.
For example, if you wanted to add all the units in a region to a unit group, but not a "negative" region within it, you could:
Pick each unit in region "Primary Region"
If picked unit is in region "Negative Region" Then Nothing
Else Add picked unit to Unit Group "These Guys"
Does that make sense?
@rutegar: Go
It makes sense, but not exactly what I am wanting to do. Although I didn't know you could do is in region comparisons, I could just use positive regions to verify a point is not inside certain regions when spawning units that way. Thanks for helping me reach a solution of sorts.
Of course, the ideal solution for me is to have a large region, with 8 circle negative regions where the players hero units are, and to spawn at a random point in the large region, just not those 8 negative regions. It needs to be dynamic, and I've heard bad things about creating regions via triggers performance wise. This may well be spawning 50-60 units in an interval, so I'm looking to keep my iterations as low as possible.
If anyone knows how to do it that way, I'm all ears :)
Negative area applied to regions is dominant and permanent. There is no way to make a negative area positive once it is added to the region. As such your only solution is to periodically re-create the region and apply new negative regions to it.
If your positive region is a complex shape (many small positive areas) then you can improve performance by storing the only positive region as a template. Every time you want to move the negative areas you can then create a new empty region, add the positive template region to it and then go ahead and place your negative regions on it. This simplifies the positive region fill to a single function call as opposed to having to iteratively adding each positive area. Performance wise the process should not be too demanding and do not concern yourself about leaks as regions are automatically garbage collected.
Do note that highly complicated regions likely perform worse than simple regions. Also complex regions might return random points that are null in the case of it not being able to find a point randomly so care should be taken to handle such an error case, even if it is virtually impossible to occur.