Map
The Map object represents the current map. Provides access to entities such as mobs, NPCs, drops, portals, and map terrain data.
Call map:is_valid() before using any other methods. Map objects can become invalid at any time.
Functions
Validation & Basic Info
map:is_valid() -> boolean
Validates the object exists in the game world. Always call this first.
map:get_id() -> number
Returns the map ID.
Common Map IDs
| Map ID | Name |
|---|---|
100000000 | Henesys |
101000000 | Ellinia |
102000000 | Perion |
103000000 | Kerning City |
211000000 | El Nath |
220000000 | Ludibrium |
map:is_town() -> boolean
Returns true if the map is a town (safe zone).
map:get_burning_stage() -> number | nil
Returns the burning XP stage (0-10) or nil if unavailable.
Drops & Portals
Drop Object Structure
| Property | Type | Description |
|---|---|---|
id | number | Drop item ID |
position | table | Table with x and y coordinates |
type | number | Type identifier |
map:get_drops() -> table<drop>
Returns all drops available to the player (shared and personal).
Portal Object Structure
| Property | Type | Description |
|---|---|---|
name | string | Portal name (e.g. "in00", "out00") |
position | table | Table with x and y coordinates |
type | number | Portal type identifier |
target_map_id | number | Destination map ID |
target_name | string | Name of the matching portal on the destination map |
map:get_portals() -> table<portal>
Returns all portals on the map.
Entities
map:get_mobs() -> table<Mob>
Returns all mobs on the map. See Mob.
map:get_bosses() -> table<Mob>
Returns all boss mobs on the map. See Mob.
map:get_mob_count() -> number
Returns the number of alive mobs. More efficient than iterating get_mobs().
map:get_npcs() -> table<NPC>
Returns all NPCs on the map. See NPC.
Reactor Object Structure
Reactors (interactive map objects — switches, boxes, gathering nodes) currently in the field. Each entry is a plain table — not a bound object, so it has no methods.
| Property | Type | Description |
|---|---|---|
id | number | Runtime object ID, unique per spawn |
template_id | number | WZ reactor template ID (Reactor.wz/<template_id>.img) |
name | string | Reactor name |
state | number | Current state index; advances as the reactor is hit/triggered |
flipped | boolean | Whether the reactor is horizontally flipped |
position | table | Table with x and y coordinates |
map:get_reactors() -> table<reactor>
Returns all reactors currently in the field.
Rune Object Structure
The active runestone on the field. Maps only ever have one rune at a time, so this is a single plain table (or nil) rather than a list — not a bound object, so it has no methods.
| Property | Type | Description |
|---|---|---|
position | table | Table with x and y coordinates |
solvable | boolean | false while the rune-solved cooldown is active (a rune was solved recently); true when it can be solved |
map:get_rune() -> rune?
Returns the active rune on the map, or nil if there is none.
Player Object Structure
Other players (remote characters) currently in the field. Each entry is a plain table — not a bound object, so it has no methods.
| Property | Type | Description |
|---|---|---|
id | number | Character ID |
name | string | Character name |
position | table | Table with x and y coordinates |
map:get_players() -> table<player>
Returns all other players currently in the field. Excludes your own character — see Local Player.
Terrain Data
Foothold Object Structure
| Property | Type | Description |
|---|---|---|
x1 | number | Starting X coordinate |
y1 | number | Starting Y coordinate |
x2 | number | Ending X coordinate |
y2 | number | Ending Y coordinate |
map:get_footholds() -> table<foothold>
Returns all footholds (platforms) on the map.
Ladder Object Structure
| Property | Type | Description |
|---|---|---|
x | number | X coordinate |
y1 | number | Top Y coordinate |
y2 | number | Bottom Y coordinate |
map:get_ladders() -> table<ladder>
Returns all ladders and ropes on the map.
Example
-- Map and mob monitoring
function on_tick()
local map = core.object_manager.get_current_map()
if not map or not map:is_valid() then return end
-- Check map type
if map:is_town() then
core.log("In town - safe zone")
return
end
-- Check burning field
local burning = map:get_burning_stage()
if burning and burning > 0 then
core.log("Burning field stage: " .. burning)
end
-- Monitor mob count
local mob_count = map:get_mob_count()
if mob_count < 5 then
core.log_warning("Low mob count: " .. mob_count)
end
-- List reactors in the field
for _, reactor in ipairs(map:get_reactors()) do
core.log(string.format(
"reactor %d (%s) state=%d at (%d, %d)",
reactor.template_id, reactor.name, reactor.state,
reactor.position.x, reactor.position.y))
end
-- Check for a solvable rune
local rune = map:get_rune()
if rune and rune.solvable then
core.log(string.format(
"solvable rune at (%d, %d)",
rune.position.x, rune.position.y))
end
end