Skip to content

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 IDName
100000000Henesys
101000000Ellinia
102000000Perion
103000000Kerning City
211000000El Nath
220000000Ludibrium

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

PropertyTypeDescription
idnumberDrop item ID
positiontableTable with x and y coordinates
typenumberType identifier

map:get_drops() -> table<drop>

Returns all drops available to the player (shared and personal).


Portal Object Structure

PropertyTypeDescription
positiontableTable with x and y coordinates
typenumberPortal type identifier
target_map_idnumberDestination 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

PropertyTypeDescription
x1numberStarting X coordinate
y1numberStarting Y coordinate
x2numberEnding X coordinate
y2numberEnding Y coordinate

map:get_footholds() -> table<foothold>

Returns all footholds (platforms) on the map.


Ladder Object Structure

PropertyTypeDescription
xnumberX coordinate
y1numberTop Y coordinate
y2numberBottom Y coordinate

map:get_ladders() -> table<ladder>

Returns all ladders and ropes on the map.

Example

lua
-- 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