Appearance
Lua protection-zone support
Use the high-level SDK for the local character:
lua
local Engine = require("sdk.engine")
local in_pz = Engine.IsInProtectionZone()
if in_pz == true then
-- Inside a protection-zone tile.
elseif in_pz == false then
-- The current tile is not protected.
else
-- Logged out, or neither live state nor map data is available yet.
endThe equivalent object APIs are:
lua
local me = Engine.GetLocalPlayer()
local in_pz = me and me:isInProtectionZone()
local same_answer = me and me:isInPz() -- compatibility aliasThe SDK trusts the server's PlayerState PZ bit first. If the script was injected after that packet and the state is still unknown, it falls back to the current mapped tile. The result is deliberately tri-state: nil is not treated as false.
For an arbitrary mapped coordinate, query the tile flags directly:
lua
local flags, err = game.map.flags(32369, 32241, 7)
if flags and flags.has_tile then
print("protected tile", flags.protection)
endme:isPzLocked() is separate. PZ lock means the character cannot enter a protection zone after PvP combat; it does not mean the character is currently inside one. Protection is defined per tile (for example temples, depots, and houses), not by generic distance to a town.
Farmer 09 records in_protection_zone in its status. While it is true, the farmer cancels and clears combat, suppresses aggressive spells and looting, and continues travel/search movement so a route can leave town normally.
For the action broker, combat safety, CaveBot graph, analytics, alerts, and equipment-rule APIs, see Lua bot services.