Skip to content

Persistence

What can be saved

Two separate things, controlled separately:

lua
Config.Persistence = {
    Placed = false,      -- lanterns standing in the world
    Settings = true,     -- each character's colour and brightness
    Mode = 'json',       -- 'json' or 'mysql'
    SaveInterval = 120,  -- seconds between saves
}
Default
SettingsonColour and brightness per character, restored on login
PlacedoffPlaced lanterns survive a restart

Placed lantern persistence is off by default deliberately. Most servers want a clean map after a restart, and leaving it off means there is nothing to maintain.

JSON mode

lua
Config.Persistence.Mode = 'json'

Writes two files into the resource folder:

rm_Lantern/placed_lanterns.json
rm_Lantern/lantern_settings.json

No dependency, nothing to set up. Saves every SaveInterval seconds and once more when the resource stops.

Escrow builds may not be able to write there

On an escrow protected build, the resource folder is not a normal writable directory on every host. If saved data comes back empty after a restart, this is almost certainly why. Switch to MySQL.

MySQL mode

lua
Config.Persistence.Mode = 'mysql'

Requires oxmysql running. Nothing else — the table is created automatically on first start:

sql
CREATE TABLE IF NOT EXISTS rm_lantern_placed (
    id INT PRIMARY KEY,
    model BIGINT NOT NULL,
    weapon BIGINT DEFAULT 0,
    x FLOAT NOT NULL, y FLOAT NOT NULL, z FLOAT NOT NULL,
    heading FLOAT DEFAULT 0, pitch FLOAT DEFAULT 0, roll FLOAT DEFAULT 0,
    colour INT DEFAULT 1, brightness INT DEFAULT 0,
    owner VARCHAR(80)
)

There is no .sql file to import.

Start oxmysql before the resource:

cfg
ensure oxmysql
ensure rm_Lantern

If oxmysql cannot be reached, the resource warns in the console and carries on without persistence rather than failing to start.

Mode only applies to placed lanterns

Player settings are stored as JSON regardless. If your host blocks writes to the resource folder entirely, settings will not persist across restarts — players simply pick their colour again.

How ownership survives

Placed lanterns are tagged with a character identifier, not a server ID, so ownership survives a relog and a restart:

FrameworkIdentifier
VORPvorp:<charIdentifier>
RSGrsg:<citizenid>
QBRqbr:<citizenid>
RedEM:RPredemrp:<charid>
StandaloneThe player's license

This is what makes Config.AllowForeignPickup = false work properly — a player can still pick up their own lantern tomorrow.

On VORP and RSG the identifier is resolved fresh on every use, so switching characters without reconnecting does not carry the previous character's ownership over.

Housekeeping

MaxPlacedGlobal applies to restored lanterns too, so a saved registry cannot grow past your cap.

To wipe everything:

/lanternclear

Or delete placed_lanterns.json, or truncate rm_lantern_placed, with the resource stopped.

Documentation for RedMorrow. Scripts are licensed per server — redistribution is not permitted.