How do I determine the presence of a piece in a zone?

In the The Burning Blue module, air unit readiness operations are halted for an airfield if an airfield disruption marker is present in the airfield. How do I determine of such a marker is present?

The airfield is represented as a zone on a map. Can I get a list of prices in that zone? Can I query directly for the presence of the marker?

The only way that I can think of at the moment is rather roundabout: I can look for all airfield disruption markers, and get their location. Then I can set a Global Property for the current airfield, and query that one

I generally use CountZone() in a Beanshell expression to meet this type of requirement.

Here’s an example fragment that counts pieces on which the Marker tcMkr is defined.
CountZone(zone, "Main Map", "tcMkr")

Note - the Marker name must be unique to the pieces in the Zone. It should not be defined as a Map or Map Global Property.

Thanks, Mark, that seems a great solution! I can’t wait to implement it.

The help page dedicated to the Sum and Count functions is incredibly useful.

1 Like