The getNearestZoneWithFlags and getNearestZoneWithFlagsStrict native AI script functions are used to retrieve the nearest zone from a specified point that matches certain criteria. The difference between the two functions is that getNearestZoneWithFlags takes into account the free space of the zones, while getNearestZoneWithFlagsStrict does not.
(Zone: s)getNearestZoneWithFlags(X: f, Y: f, OneOf: s, Mandatory: s) // getNearestZoneWithFlags_ffss_s
(Zone: s)getNearestZoneWithFlags(X: f, Y: f, OneOf: s, Mandatory: s, ExceptProperties: s) // getNearestZoneWithFlags_ffsss_s
(Zone: s)getNearestZoneWithFlagsStrict(X: f, Y: f, OneOf: s, Mandatory: s) // getNearestZoneWithFlagsStrict_ffss_s
(Zone: s)getNearestZoneWithFlagsStrict(X: f, Y: f, OneOf: s, Mandatory: s , ExceptProperties: s] // getNearestZoneWithFlagsStrict_ffsss_s
($zone)getNearestZoneWithFlags(x, y, "food|rest", "invasion|outpost");
This example retrieves the nearest zone from the point (X,Y) that has at least one of the "food" or "rest" flags and both the "invasion" and "outpost" flags.
($zone)getNearestZoneWithFlagsStrict(x, y, "food|rest", "invasion|outpost", "stayaway");
This example retrieves the nearest zone from the point (X,Y) that has at least one of the "food" or "rest" flags and both the "invasion" and "outpost" flags, but the matching zone cannot have the "stayaway" flag.