Map
The Map object represents the current map. Provides access to entities such as mobs, NPCs, drops, portals, and map terrain data.
Always Validate
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 |
|---|---|---|
position | table | Table with x and y coordinates |
type | number | Portal type identifier |
target_map_id | number | Destination map ID |
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.
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
end