Changing radius of Area of Effect trait in-game

Hello all!

I am working on my first module. Everything works fine so far, but I stumbled upon something (actually 2 similar things) I couldn’t solve by myself. I hope you can help me.

I have several counters, that have an area of affect trait, which activates a map shader with a certain radius. Everything works fine until here. Now at a certain point during the game, this radius has to be increased temporarily. I would like to be able to activate/deactivate this increased radius through the movement of a different counter into a specific zone. Is that possible?

Similar to above. I have several counters that have an area of effect trait with a certain radius. Now, if a certain marker is placed upon this unit, the radius has to be decreased/increased, as long as the marker is placed on the counter.

Both changes to the radius of the area of effect should be activated/deactivated instantly just through the placement of the third counter into a specific zone (in the first case) and through the presence of the marker onto of the counter (in the second case).

Are these problems solvable with the regular vassal functions without having to use code?

Thanks in advance!

Just off the top of my head, you could use a “Replace with Other” trait and define a copy of the same piece with a larger radius of effect. Switching between the two shouldn’t be too difficult.

Thanks for the fast reply !

I forgot to mention in my post, that I am aware of the Replace with other trait. That would obviously a fast and simple solution at first glance, but as I have hundreds of counters, I would have several hundred copies with different traits, as every counter has different ranges that could de- or increase. So it would be best if the solution does not include copies of the counters with different values for the radius, but rather have changes in the traits itself.

Another approach would be to define multiple Area of Effect traits for those pieces - one for each possible radius. Each AoE trait would define a unique command to toggle it on/off, allowing Trigger “logic” in your module to only enable at most one AoE at a time.

Thanks for the answer!

I have a global key command set up, that’s lets me activate all AoEs of all counters in the map that have this trait. In my example, it just triggers Ctrl+A for all units that have the aoe trait.
I would have to set up different AoEs with different ranges (but all with the same keystroke), but only one aoe should be enabled at a time.

Setting up different AoEs with different ranges for each counter with different keystrokes would not work, as the GKC would trigger only one type then, which may not be the one I need. Hard to describe…

You just need to provide a different Trigger Action for each different Area of Effect, all with the same Key Command (from your GKC) activating them. Each would have a different Trigger when properties match field to ensure only the currently correct one triggered.

Not sure if I am missing something, but is there a reason you can’t just unclick the ‘Fixed Radius’ option in AoE trait and specify a Dynamic (Unit case) or Global Property (Zone case) that you maintain the range in?

1 Like

Oops. I checked the Reference Manual page for Area Effect before replying, but didn’t notice the option to turn off “Fixed Radius”, as it isn’t mentioned at all in the text.

So I managed the first problem by assigning a dynamic property to the game piece and setting up a global property to the map. The radius is calculated by summing up the dynamic and the global property. Only problem now is that I have to change the global property though a mouse click or keystroke. Is there a possibility that automatically changes the global property if I move a game piece in a specific zone. For example I create a zone on the map for “activated abilities”. Then I create a game piece representing the ability to increase the radius. As long as the game piece is outside the zone, the global property is 0, as soon as I drag the game piece into the zone, it automatically changes to the global property to 1. How can I achieve that?

In the Map properties, add a Key Command to apply to all units ending movement on this map (if you don’t already have one). Add a Trigger Action to the pieces with a Trigger when properties match of {CurrentZone == "name_of_zone" && CurrentZone != OldZone} (replace name_of_zone with the actual name of your zone), and have that trigger a Set Global Property trait to change your GP. Another Trigger Action with the reverse condition: {OldZone == "name_of_zone" && CurrentZone != OldZone} should trigger another Set Global Property to reset the GP.

(Edited to correct a logic error in the reverse condition; see my next comment below.)

2 Likes

Doh! You beat me by seconds, I only worked this out the other day myself. Your answer is more concise than mine was though.

Thanks very much to both of you! It works now l!

Glad it works, but I just realized there’s a slight error in the condition for my second trigger action (to reset the GP): it should be {OldZone == "name_of_zone" && CurrentZone != OldZone}, so it only fires when the piece leaves the special zone, not whenever the piece changes zones anywhere. The code I gave will still work if you only have 2 zones or if you set the GP to a specific value (rather than adding or subtracting to it), but it will be firing when it doesn’t need to.

1 Like