Violet

Map

On this page

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
namestringPortal name (e.g. "in00", "out00")
positiontableTable with x and y coordinates
typenumberPortal type identifier
target_map_idnumberDestination map ID
target_namestringName 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.

PropertyTypeDescription
idnumberRuntime object ID, unique per spawn
template_idnumberWZ reactor template ID (Reactor.wz/<template_id>.img)
namestringReactor name
statenumberCurrent state index; advances as the reactor is hit/triggered
flippedbooleanWhether the reactor is horizontally flipped
positiontableTable 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.

PropertyTypeDescription
positiontableTable with x and y coordinates
solvablebooleanfalse 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.

PropertyTypeDescription
idnumberCharacter ID
namestringCharacter name
positiontableTable 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

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

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