Cannot toggle off zone highlighting when zones are not in original area

After my success getting zone highlighting to toggle on and off at the press of a button, I decided I wanted to do one more thing. There’s an optional Union Flotilla that can lend support to units, but only in certain coastal areas. I thought it would be nice to highlight those areas by clicking on the flotilla icon.

What I did was essentially the same as what I did in Dynamic Zone Highlighting - #11 by djberg96. The zones have an “AreaHighlight” global property, and at the click of a button it highlights the relevant zones. The main difference is that instead of highlighting areas in its own zone, the button is highlighting multiple named zones outside where it lives:

Here’s one of the Set Global Properties, which are all identical except for the zone name:

The prompt is set to:

{AreaHighlight != "FlotillaArea" ? "FlotillaArea" : "None"}

The button is pretty straightforward:

The good news is that the “on” switch works. I can click the button and the areas highlight as expected. What’s strange is that the “off” switch doesn’t work. Clicking the button again doesn’t do anything, the areas stay highlighted, and I don’t understand why.

Do I have some bug in my prompt?

The module is available at if anyone wants to poke into it. Just start a game and click on the Union Flotilla near the bottom.

Ok, the reason you can’t change the property back is that your Flotilla piece is not sitting in any of those zones, so the AreaHighlight in your Set Global Property is always returning nothing, since it isn’t actually in any zone.

You will need to specifically access the Global Property in the matching zone in each Set Global Property expression like this:

{GetZoneProperty("AreaHighlight","Area 23 (Charles City Court House)") != "FlotillaArea" ? "FlotillaArea" : "None"}

Set Piece Property works differently (the way you would logically expect it to work), properties referenced in the set value expression refer to properties in the target pieces. Set Piece Property is new in 3.7.

Set Global Property is a much older trait and has no concept of using the target zone or map to satisfy properties, you have to do that yourself. We would not be able to change that without breaking loads of modules.

1 Like

I updated the existing prompts as you suggested and it works. Excellent, thank you!

However, are you saying I could implement all those Set Global Property objects as Set Piece Property objects? Or perhaps a single Set Piece Property?

If so, I must be missing something because I couldn’t make it work.

Sorry, my explanation was unnecessarily confusing. I was just trying to explain the difference between how Set Piece Property and Set Global Property work in this situation in case you where familiar with it, not implying that you should be using Set Piece Property. Just ignore that.