Skip to content

Menus, settings and locations

This guide covers everything a mod can add to the game’s menus and places: settings switches players can flip and choices they can pick from, your own screens (menus, pop-ups and fight HUDs), the dojo (the player’s home screen) with its buttons and picker, locations (arenas) and languages.

New to mods? Read How mods work first.

A settings switch is an on/off option your mod adds under Options > Mod settings. Use it to let players turn off an effect, choose a variant, or enable a challenge without disabling your whole mod.

local sf2 = require("sf2")
local trails = sf2.settings.toggle {
id = "weapon_trails",
label = "Weapon trails",
description = "Short trails behind fast weapon swings.",
default = true,
}
Field Required? Meaning
id Yes 1-64 lowercase letters, digits, _ or -, unique within your mod. It keeps the player’s choice stable across versions, so never rename it.
label Yes 1-48 characters shown in the Options row. A string, or a text handle so it shows in the player’s language (see translated settings).
description No Up to 160 characters, shown beside the Back button while the switch has focus.
default No (false) The value used until the player changes it.
group No A heading (1-32 characters) to list the switch under on your mod’s page, such as "Lighting".
excludes No A switch of your mod registered earlier (or a list of up to 8) that can never be on together with this one.
heavy No (false) Set it to true for a switch whose effects cost a lot of GPU time. Under the player’s Performance effects preset, the game treats the switch as off; see heavy switches.

sf2.settings.toggle returns a setting handle. Pass it as setting to a visual effect (see the effects cookbook) so the effect runs only while the switch is on, or read it any time with sf2.settings.get:

local sf2 = require("sf2")
-- Two looks that should never stack: turning one on turns the other off.
local rim = sf2.settings.toggle { id = "rim_light", label = "Rim light", group = "Lighting", default = true }
local wrap = sf2.settings.toggle { id = "light_wrap", label = "Light wrap", group = "Lighting", excludes = rim }
-- Later, inside any callback:
if sf2.settings.get(rim) then
-- the player has the rim light on
end

Give label, description and group a text handle from sf2.text.get instead of a string, and the switch shows in whatever language the player picks, including after they change it. A string always shows as written.

local sf2 = require("sf2")
-- localizations/eng.toml: weapon_trails.label = "Weapon trails"
-- localizations/rus.toml: weapon_trails.label = "Следы оружия"
local trails = sf2.settings.toggle {
id = "weapon_trails",
label = sf2.text.get("weapon_trails.label"),
description = sf2.text.get("weapon_trails.description"),
group = sf2.text.get("group.effects"),
default = true,
}

The length limits apply to the English text. Choice labels and per-save options take text handles the same way.

When a setting has more than two values, such as which of three music themes plays in the dojo, make it one choice with sf2.settings.choice instead of several switches that exclude each other. The player sees one row with a < value > picker and steps through your choices with a click or tap on either half of the picker, or with Left and Right.

local sf2 = require("sf2")
local theme = sf2.settings.choice {
id = "dojo_theme",
label = "Dojo theme",
group = "Audio",
choices = {
{ id = "normal", label = "Normal" }, -- the game's own music
{ id = "remastered", label = "Remastered" },
{ id = "night", label = "Night" },
},
default = "normal",
}
-- Each swap names the choice it belongs to; "normal" has no swap, so the game's track plays.
sf2.assets.replace {
music = "menu",
replacement = sf2.assets.audio("audio/menu_remastered"),
setting = theme, choice = "remastered",
}
sf2.assets.replace {
music = "menu",
replacement = sf2.assets.audio("audio/menu_night"),
setting = theme, choice = "night",
}
-- In a callback, sf2.settings.get returns the id of the picked choice.
if sf2.settings.get(theme) == "night" then
-- the player picked Night
end

Each choice has an id and a label. The player’s pick is saved as the id, so you can reword a label in a later version, but keep the ids. A choice works as setting (with choice beside it) on music, sound, stage and preview swaps; visual effects follow switches only. The reference lists every field and the limits (2 to 8 choices).

Replacing switches with a choice. If an earlier version of your mod had separate switches for the same thing, stop registering them and name each one as from_switch on its choice, for example { id = "night", label = "Night", from_switch = "night_music" }. Players who had that switch on start on that choice instead of losing their setting.

Full-screen effects cost a lot of GPU time, most of all on phones. Players choose between two effects presets under Options > Display > Effects:

  • Performance aims for the highest frame rate. It is the default only in the 32-bit Android build, or when the player turns on low memory mode. It draws cheaper versions of the built-in effects (described in the effects cookbook), turns off anti-aliasing, and turns off every switch marked heavy.
  • Quality, the default on computers and 64-bit phones, draws everything. On a phone it also draws fights at 70% of the screen’s resolution and caps the frame rate at 60 FPS.
local sf2 = require("sf2")
-- Light streams across the whole picture: expensive, and the look survives without it.
local rays = sf2.settings.toggle {
id = "god_rays",
label = "God rays",
description = "Light streams across the picture from the sun.",
default = true,
heavy = true,
}

Under Performance, effects that use a heavy switch stop and sf2.settings.get returns false for it. Because the switch does nothing there, Options > Mod settings shows it as Off, faded, and the player cannot change it; its description says why, and the All switches row leaves it alone. The player’s own choice is kept: under Quality the switch shows it again and works as before. Mark every switch whose effects draw over the whole picture every frame, such as god rays, bloom, colour grades, fog, reflections or depth of field. Leave unmarked the cheap ones that make fights read well, such as rim light, hit sparks, a short impact flash, small particles or a flash every few seconds. A grade your script holds at neutral values until something happens (a heartbeat at low health) costs nothing until then, so its switch can stay unmarked too. Keep an always-on colour cast on a switch of its own, so the particles around it can stay light.

Options > Mod settings lists every mod that has settings; choosing a mod opens its page: one scrolling list of its switches and choices under their group headings, a search field that filters them by name, description or group, and an All switches row that turns every switch on, then off, then back to defaults. That row leaves choices as the player set them, and a mod with only choices does not show it. Register settings at load time, before the effects and swaps that use them. A setting’s value is stored per installation, not in the save.

A change takes effect at once, even with a save loaded: swaps and effects check the setting as they play or draw, and when a swapped music track is playing (the dojo theme in the example above) the old track fades out and the new one starts. If your script reads a setting only while it loads, for example to decide what to register, add restart = true to it. Its description under Options > Mod settings then tells the player that a change shows after a restart.

sf2.ui.open shows a layout that you describe as a table. Lua functions handle clicks and do the calculations. You get back a view handle that identifies the live screen; keep it to update or close the screen later.

Here is a complete mod that adds a dojo button which opens a small counter:

local sf2 = require("sf2")
-- A button in the dojo's side menu (see "The dojo" below).
local button = sf2.ui.dojo_button {
id = "counter",
image = sf2.assets.sprite("sprites/counter_button"),
}
sf2.story.on("dojo_button", function(event)
if event.button ~= button then return end
local count = 0
sf2.ui.open {
mount = "modal",
root = { kind = "column", width = 320, height = 160, gap = 8,
children = {
{ id = "count", kind = "text", width = 320, height = 40, text = "0" },
{ id = "add", kind = "button", width = 320, height = 48, text = "Add one",
on_click = function(view)
count = count + 1
sf2.ui.update(view, "count", { text = tostring(count) })
end },
{ id = "done", kind = "button", width = 320, height = 48, text = "Close",
on_click = function(view) sf2.ui.close(view) end },
} },
}
end)

mount chooses what kind of screen it is:

Mount Use for Behaviour
menu A full menu Blocks input outside it; Back closes it.
modal A pop-up or dialog Wins over menus; blocks and captures input; Back closes it.
hud A fight overlay Transparent. Buttons use pointer input. A text field in a HUD captures fighter controls only while it has focus. It darkens with the fight HUD under the pause menu, and hides in photo mode.

Opening a screen does not pause combat unless you ask it to (see the next section). Newer screens sit on top of older ones; only the foreground one accepts input. Closing the scene closes the screen, and the title screen and native dialogs suspend mod screens. A script may have 8 open views.

Some screens only make sense while the fight stands still, such as a “Prepare” pop-up where the player catches their breath and swaps gear halfway through a boss. Open a modal with pause_fight = true and the fight freezes until the pop-up closes. This example adds a Prepare button to the fight HUD; it opens a pop-up that lists the player’s Armory loadouts:

local sf2 = require("sf2")
-- The pop-up. The fight waits while it is open.
local function open_prepare()
local rows = {}
for _, loadout in ipairs(sf2.profile.loadouts()) do
rows[#rows + 1] = {
id = "loadout_" .. loadout.index,
kind = "button", width = 360, height = 48,
text = loadout.name,
enabled = #loadout.items > 0, -- an empty Armory slot
on_click = function(view)
sf2.profile.equip_loadout(loadout.index)
sf2.ui.close(view) -- the fight resumes in the new gear
end,
}
end
rows[#rows + 1] = { id = "resume", kind = "button", width = 360, height = 48,
text = "Back to the fight", on_click = function(view) sf2.ui.close(view) end }
sf2.ui.open {
mount = "modal",
pause_fight = true,
root = { kind = "column", width = 360, height = 56 * #rows, gap = 8, children = rows },
}
end
-- A button in the corner of the fight. Open this HUD while the fight runs, for example
-- from a battle rule's on_round_begin.
local function open_prepare_button()
return sf2.ui.open {
mount = "hud",
placement = { anchor = "top_right", x = -24, y = 104 },
root = { kind = "stack", width = 160, height = 48, children = {
{ id = "prepare", kind = "button", width = 160, height = 48, text = "Prepare",
on_click = function() open_prepare() end },
} },
}
end

While a pausing pop-up is open:

  • The fight freezes exactly as under the game’s own pause menu: fighters, the round timer and the opponent’s AI stop, fight callbacks such as on_tick do not run, and hit effects, stage animation and sounds hold still.
  • Your pop-up works as usual: its on_click, on_change and on_back handlers run.
  • Back (Escape, or B on a gamepad) goes to the pop-up’s on_back, or closes it. The game’s pause menu cannot open on top of it.
  • The fight resumes as soon as the pop-up closes, however it closes: sf2.ui.close, Back, an error in a handler, or leaving the scene. With several pausing pop-ups open, it resumes when the last one closes.

Only single-player fights pause. Outside a fight (the map, the shop, the dojo, or a fight that is already over) pause_fight does nothing. In a versus or online fight, opening the pop-up is an error, and so is pause_fight on a menu or hud view.

sf2.profile.loadouts lists the three loadouts the player saved in the Armory, and sf2.profile.equip_loadout puts one on exactly as the Armory’s Equip button does: pieces the player has sold since are skipped. Outside a fight it simply changes the player’s gear for the next fight. During a fight it works only while a pausing pop-up is open and a round is being fought; the player’s fighter is rebuilt in the new gear as the fight resumes, keeping its share of health, its place on the stage and its magic charge.

A boss fight does not need menus built from widgets. The game can draw three screens of its own, in the art of its shop scroll and raid screens, so they sit naturally beside the game’s own menus. You give them your text, pictures and handlers; you do not lay them out. Keys, pads and touch all work on them.

sf2.ui.challenge is the screen before the fight: the boss’s stages listed on a paper scroll, and a card with its portrait, its health bar, the consumables the player holds, their Armory loadouts and a Fight! button. Open it from the map, for example when the player picks the boss’s battle:

local sf2 = require("sf2")
local portrait = sf2.assets.sprite("ui/warden")
local seal = sf2.assets.sprite("ui/seal")
local elixir = sf2.items.get(sf2.mod.id .. ":items/consumable/healing_elixir")
local text = {
name = sf2.text.get("warden.name"),
stages = { sf2.text.get("warden.first"), sf2.text.get("warden.second"), sf2.text.get("warden.last") },
}
-- `broken`: how many of the three seals the player has already broken.
local function open_warden(broken)
local stages = {}
for index, name in ipairs(text.stages) do
local state = "upcoming"
if index <= broken then state = "done" elseif index == broken + 1 then state = "next" end
stages[index] = { name = sf2.text.read(name), icon = seal, state = state }
end
return sf2.ui.challenge {
title = sf2.text.read(text.name),
portrait = portrait,
victories = sf2.profile.fight(sf2.mod.id .. ":fights/warden/1").wins, -- a red hanko per win, a ring before
bar = { value = 30 - 10 * broken, max = 30, marks = { 10, 20 } },
stages = stages,
items = { { item = elixir, count = sf2.profile.item_count(elixir) } },
loadouts = true,
on_fight = function(view) sf2.story.start_fight("warden") end,
}
end

The screen stays open until the fight starts (the scene change closes it), the player presses Back, or you call sf2.ui.close. Pressing a loadout equips it on the spot. The screen cannot open during a fight.

The screen can also take choices before the fight. Add a few small buttons to the card with buttons and on_button (a difficulty picker, say), put a small spending control at the end of a stage row with its action and on_action (to swap a stage for another, for a price), or make the item slots pressable with on_item (to brew one from materials). Your handler changes what it needs to, then calls sf2.ui.refresh with the new content, and the screen shows it at once without unrolling again.

Anything that costs the player something should ask first. A stage action always takes two presses: the first arms it and the card’s info line shows your confirm words, the second runs on_action. Give an item confirm and it works the same way. When the player cannot afford it, set enabled = false and a reason: the control looks unavailable and a press only explains. Give the things on the card an info = { title, text } too, so that selecting one tells the player what it is; the info line is the place for explanations, which keeps the card itself to pictures.

Prefer pictures to sentences on this screen. A collection’s progress fits in a tally strip (pressed to open the collection as a grid page on the scroll), what is at stake fits in stakes (a picture and “+50%”), a pick among a few options fits in choices tiles, a recipe fits in an item’s cost, and materials fit in a pouch. Use note for the answer to the last press (“Healing elixir brewed.”); it shows on the info line.

A screen like this is a lot to take in on the first visit, so you can walk new players through it. Add a guide with a few steps, each naming a part of the screen ("stages", "stakes", "choices", "buttons"…) and saying in a sentence or two what it is for. Once the screen has unrolled, the game dims everything but that part, frames it in gold and shows your words beside it; a press goes on, and Back skips. The screen’s own controls do nothing until the guide ends, so a player clicking through it never spends anything by accident. Save that the guide was seen in your own state (the screen does not remember) and give guide only while it is due:

local function open_warden_first_time(content)
if not sf2.state.get("warden_guide_seen") then
content.guide = {
steps = {
{ target = "stages", title = "Seals", text = "Break each seal to bring the Warden down." },
{ target = "items", title = "Elixirs", text = "Drink these between seals." },
{ target = "buttons", title = "Ready?", text = "Nothing starts until you press FIGHT!" },
},
}
sf2.state.set { warden_guide_seen = true }
end
return sf2.ui.challenge(content)
end

The guide reference lists every part a step can frame. To test a guide again without a fresh save, add a debug button for it with sf2.debug.action.

sf2.ui.prepare pauses a single-player fight under the game’s Prepare screen: your consumables as rows the player presses to use, the Armory loadouts, and a Continue button. It pauses the fight exactly as a pause_fight pop-up does, and the fight resumes when it closes. Open it from a fight HUD button, like the Prepare button above, or from your round controller when a stage ends.

Pressing a row calls your on_use, which returns the row’s new count and whether it can still be used. The fight is paused, so no fighter can be changed from there: remember what the player used and apply it from the round controller once the fight resumes:

local elixir = sf2.items.get(sf2.mod.id .. ":items/consumable/healing_elixir")
local text = { title = sf2.text.get("prepare.title"), healing = sf2.text.get("elixir.healing.short") }
local heal_next_tick = false
local function open_prepare()
return sf2.ui.prepare {
title = sf2.text.read(text.title),
items = {
{ id = "healing", item = elixir, count = sf2.profile.item_count(elixir),
text = sf2.text.read(text.healing), enabled = not heal_next_tick },
},
loadouts = true,
on_use = function(view, id)
if sf2.profile.take_item(elixir, 1) then
heal_next_tick = true
return sf2.profile.item_count(elixir), false -- one per Prepare
end
end,
}
end
-- The round controller (a behavior rule with controls_outcome = true):
local controller = {
on_tick = function(self, fighter, tick)
if heal_next_tick then
heal_next_tick = false
fighter:change_health(0.3) -- the elixir's effect, now that the fight runs
end
end,
}

A loadout pressed on the Prepare screen goes on as the fight resumes, as described in the section above. To mark the moment a boss’s stage ends before opening Prepare, see a seal breaking.

sf2.ui.results replaces the game’s result tally for your fight with a screen of its own: your stages as the fight left them, a heading such as “Victory”, and the coins, gems, experience and items the fight paid, counted up by the game. If your round controller gives a reward bonus with fighter:set_reward_bonus, name it with bonus and the screen shows the amounts climbing by it.

Ask for it from the round controller’s on_fight_end. The game opens it later, once the rewards are counted and paid, where the tally would have been:

local controller = {
on_fight_end = function(self, fighter, event)
local won = event.player_result == "win"
sf2.ui.results {
title = sf2.text.read(won and text.won or text.lost),
subtitle = won and sf2.text.read(text.all_broken) or nil,
portrait = portrait,
stages = stages_as_they_ended(won), -- rows as for sf2.ui.challenge
bonus = sf2.text.read(text.momentum),
}
end,
}

Continue takes the player back to the map, as the tally’s OK does. The screen only shows what the fight paid, so saving progress stays where it was, for example in a battle_result story handler. A surrender still goes straight to the map.

Layouts use a 1280x720 reference canvas, centred in the safe area. Add placement = { anchor = "top_right", x = -24, y = 104 } to pin a screen to an edge (x and y are offsets in reference units; positive x is right and positive y is down). A node is a table:

Field Meaning
kind Required. stack, row, column, scroll, grid, text, button, progress, toggle, slider, image or text_input.
id Required on buttons, toggles, sliders and text inputs (and any widget you will update later). 1-64 letters, digits, _ or -, unique in the view.
width, height Reference units. The root needs both. Zero in a row or column means flexible size.
children Child nodes. Only containers have children; scroll has exactly one.
text Label text, or a text input’s starting value. Plain text only.
value, checked A progress or slider position (0 to 1); a toggle’s state.
sprite An image widget’s picture, from sf2.assets.sprite.
visible, enabled Both default to true; a hidden or disabled parent affects its children.
style Optional: font_size, text_align, text_color, background_color, fill_color and (for a scroll root) frame = "scroll". Colours are "#RRGGBB" or "#RRGGBBAA".

Menus and modals use the game’s parchment look, buttons use its white beveled sprites and progress bars use the combat bar textures. Prefer these defaults so your screen feels native. A view can have up to 256 nodes and 16 levels. Text wraps inside its box, so leave room for translations.

A grid arranges buttons in fixed columns (columns, cell_width, cell_height, gap). Put a tall grid or column inside a scroll node to get clipping and scrolling. A text_input is an editable field (placeholder, max_chars up to 8192, multiline).

Handler Where Runs when
on_click On a button That button is clicked: function(view)
on_change On a toggle, slider or text input The user changes it: function(view, value)
on_click, on_change On the whole view A widget without its own handler fires: function(view, widget_id[, value])
on_back On the view Back is pressed on a menu or modal; replaces the default close, so close the view yourself
on_close On the view The view closed: function(view, reason) with reason one of script, back, scene, error or destroyed

A handler that errors closes its view and logs the problem. Handlers have no combat authority: store the choice in a Lua variable and act on it from a combat callback. on_close is for releasing references; do not rely on it to grant rewards, and do not open another screen from inside it.

Change a widget with sf2.ui.update (it merges text, sprite, value, checked, visible and enabled), read a label or input with sf2.ui.text, and test or close with sf2.ui.is_open and sf2.ui.close. update never triggers on_change. Closing twice, or closing nil, is harmless.

The dojo is the player’s home screen, between fights.

sf2.ui.dojo_button adds a button to the dojo’s side menu once the player has finished the story tutorial. It needs a sprite (image, and optionally pressed_image at the same size). A mod can add four. React to clicks with sf2.story.on("dojo_button", ...) as in the counter example above; the event’s button is the name the function returned.

sf2.world.dojo_picker declares a ready-made, animated picker: a large 16:9 view of each dojo with a strip of previews below. You only describe the choices; no Lua runs while it is open.

local sf2 = require("sf2")
local choices = {}
for _, name in ipairs({ "dojo", "dojo_india24", "haloween_dojo_2019" }) do
choices[#choices + 1] = {
location = "core:locations/" .. name,
name = sf2.text.register { id = "dojo_name." .. name, language = "eng", value = name },
preview = sf2.assets.sprite("sprites/dojos/" .. name),
}
end
sf2.world.dojo_picker {
id = "dojo_picker",
button = sf2.assets.sprite("sprites/dojos/button"),
button_pressed = sf2.assets.sprite("sprites/dojos/button_pressed"),
title = sf2.text.register { id = "dojo_picker.title", language = "eng", value = "Choose your dojo" },
choices = choices,
}
Field Required? Meaning
id Yes The dojo-menu button is named <mod id>.<id>; it counts toward your four dojo buttons.
button Yes Sprite for the dojo-menu button.
button_pressed No Sprite while held; defaults to a darkened button.
title No A text handle for the heading.
choices Yes 1-64 entries in display order, each with location (a core:locations/<name> ID or a dojo location your mod registered), name (text handle) and preview (sprite shown only if the game cannot draw the location; 16:9 art fits best).

The picker shows a picture of each location. Pictures of the game’s own dojos ship with the game and appear at once. A dojo your mod registers is drawn the first time the picker needs it, which can cause a brief stutter, and is then saved for later. If a choice’s location is currently redirected by sf2.world.replace, the picker shows the replacement, because that is the dojo the player will get.

A mod can declare one picker. Choices whose location is not installed are left out. The game draws each picture itself the first time it is needed and keeps it.

To choose the dojo from your own code instead, use sf2.world.select_dojo(location) (with no argument it restores the player’s own choice) and read it back with sf2.world.selected_dojo(). The new backdrop shows on the next dojo or shop visit.

sf2.world.open_scene sends the player to the "map", "shop", "profile" or "dojo" screen from your own button. It returns true when the game accepts, and false when it cannot right now (during a fight, a scene change or a lock screen). Do not call it from an on_close handler.

local sf2 = require("sf2")
local function on_click(view, id)
if id == "shop" and sf2.world.open_scene("shop") then
sf2.ui.close(view)
end
end

A location is an arena: its background layers and where fighters stand. Register one with sf2.world.register:

local sf2 = require("sf2")
local arena = sf2.world.register {
id = "training_arena",
color = "#1b2230",
dojo = true, -- also offer it as a dojo choice
tags = { "night", "lamps" },
layers = {
{ -- behind the fighters
images = { {
sprite = sf2.assets.sprite("core:textures/locations/battlefield/battlefield_bg1.back_1"),
width = 1936, height = 1024,
} },
},
{ fighters = { player_x = 868, enemy_x = 1068 } }, -- the fighters' layer
},
}
-- Use it in a fight with: location = sf2.world.name(arena)

Layers are listed back to front. The layer with a fighters table is the one the fighters stand in; layers before it are behind them and layers after it are in front. factor controls parallax (1 moves with the fighters; the recovered backdrops use about 0.1 to 0.4 for distant scenery). Defaults: width 1936, height 512, wall 200, floor 80. The recovered arenas vary, so set these when your art is a different size. Check both fighter positions and camera framing in the game.

An image takes a sprite plus optional x, y, width, height, flip_x, flip_y. Give an image motion_x, motion_y, rotation or opacity curves to animate it: each is { points = { { period = 1, value = -8 }, { period = 1, value = 8 } } }, looping from the last point back to the first. The curves are decorative; they add no collision, damage or hazard timing.

Give a location music or music_choices to set the fight music (see Sound and music).

To show another stage wherever the game would load one, without patching every fight, use sf2.world.replace. Pair it with a settings switch so players can turn it off. This example uses the Special Edition stages that ship with the game (their IDs end in _se):

local se = sf2.settings.toggle {
id = "se_locations",
label = "Special Edition locations",
default = false,
}
for _, stage in ipairs({ "arena", "autumn", "sakura" }) do
sf2.world.replace {
location = "core:locations/" .. stage,
replacement = "core:locations/" .. stage .. "_se",
setting = se,
}
end

The swap covers every fight except versus, plus the default dojo’s backdrop. Versus players still pick their arena themselves.

Tags describe what a stage looks like, so visual effects can pick stages without listing names. Every stage has exactly one light tag; the others are optional.

Tag Meaning
day, dusk, night, dark The light: open daylight, low sun, night sky, or almost no light
indoor Under a roof or inside a cave
raid A raid boss arena
fire, lamps, otherworld Flames or lava, lanterns and candles, an unnatural magical glow
rain, snow, mist, heat Weather: rain, snow or ice, fog or drifting dust, shimmering hot air
foliage, petals, water Trees, blossoms, a lake or waterfall
Tags of the built-in stages
Stage Tags
american_event_24 day, snow
arena dusk, mist
arkhos_raid raid, dark, fire
autumn day, foliage
bamboo_grove day, foliage, mist
battlefield dusk, mist
blackness_raid raid, dark, otherworld, water
bridge day, petals, water, mist
burning_town night, fire, heat
capsules dark, otherworld, mist
castle_and_bridge day, foliage, water, mist
cave dusk, indoor, mist
chess_yard day, mist
dark_room day, indoor
dock day, water, mist
dojo day, indoor, petals
dojo_8_march day, indoor, petals
dojo_american_event day, indoor
dojo_american_event_22 day, indoor
dojo_american_event_26 day, indoor
dojo_cny25 dusk, lamps
dojo_hw21 dusk, indoor
dojo_hw22 night, indoor, lamps, otherworld
dojo_hw24 dusk, indoor, lamps
dojo_india24 dusk, indoor, lamps
dojo_india25 dusk, indoor, lamps
dojo_indian_event day, indoor, petals
dojo_indian_event_22 dusk, indoor, petals
dojo_new_year_22 night, indoor, snow
eggs dark, otherworld, mist
emerald_forest day, foliage, mist
factory day, otherworld, mist
fall_event_24 night, foliage, mist
fatum_raid raid, dark, fire, mist
fear_raid raid, dark, otherworld
flooded_village day, rain, water, mist
flowers_field day, foliage, petals
flying_rocks dusk, mist
flying_rocks_small dusk, mist
fuji day, snow
fungus_raid raid, dark, otherworld, mist
gatekeeper_raid raid, dark, indoor, lamps, otherworld
graveyard_ships day, heat
haloween_dojo night, indoor
haloween_dojo_2019 night, indoor
heaven day
hoaxen_raid raid, day, otherworld, mist
hunger_raid raid, dark, fire
hunter_raid raid, day, otherworld
hw24_ancient_temple night, lamps, foliage, otherworld
hw24_village_night night, lamps
hw24_waterfall_night night, lamps, water, mist
ice_cave day, indoor, snow
lamps_on_water night, lamps, water, mist
magic_rocks dusk, fire, heat
megalith_raid raid, day, indoor
moon night, mist
mountain dusk, foliage, mist
mountains_ny_25 day, snow, foliage
neural_network dusk, otherworld
new_year_china_dojo day, indoor, lamps, petals
night_bridge night, lamps, foliage, water, mist
pink_lake dusk, water, mist
ritual_battle_raid raid, day, indoor
ritual_fungus_raid raid, dark, otherworld, mist
ritual_hunger_raid raid, dark, fire
ritual_vulcan_raid raid, dark, fire, heat
road day, foliage, petals
ruins_village dusk, mist
ruins_village_small dusk, mist
sakura dusk, petals, mist
saturn_raid raid, night, otherworld
shadow_gate dusk, mist
ships dusk, water
skyport dark, indoor, lamps, otherworld
snowy_peak day, snow
spaceship dusk, otherworld, mist
spaceship_thorny dusk, otherworld, mist
statue dusk, lamps, foliage, mist
stone_dragon day, mist
stone_forest day, water, mist
stone_forest_thorny day, mist
swamp day, rain, foliage, water, mist
two_faced_city night, lamps
village day, foliage
volcano dusk, fire, heat
vortex_raid raid, day, indoor, otherworld, water, mist
vulcan_raid raid, dark, fire, heat
war_raid raid, dusk, fire, heat
waterfall dusk, water, mist
waterfall_small dusk, water, mist
whisper_raid raid, night, indoor, lamps

Add tags to a location you register (up to 16). To tag a stage that already exists, call sf2.world.tag; tags only add to what the stage and other mods already have:

-- The dock is lit by harbour lanterns in this mod's art.
sf2.world.tag("dock", { "lamps" })

The Core catalog lists every stage in the game. Tags are presentation only; they are never saved.

The game ships English (localizations/eng.toml) and the other languages it has text for, such as Russian (rus.toml). The player picks one under Options. Text your mod shows through text handles follows that choice; see translated settings and sf2.text.languages.

To add another language the player can select, register a locale. It adds only the choice in the language menu; the translated text itself comes from text entries (see Reskin the game for text patches and sf2.text).

local sf2 = require("sf2")
sf2.locales.register {
id = "custom_english",
name = "Custom English", -- shown in the language menu
locale = "eng", -- the locale code your text entries use
}

Optional fields choose icons, loader images and fonts; font and image names must be ones the game already has, because this function does not import a font file. See sf2.locales.register.

  • Mod screens use the game font, parchment and button art. Custom fonts, arbitrary stylesheets and virtualised lists are not supported.
  • Mod screens cannot hold a fighter handle; they pass choices to combat callbacks through Lua variables. A handler starts a fight with sf2.story.start_fight, as the challenge screen’s on_fight does.
  • Keep screens inside the safe area and test with a controller and with keyboard navigation (Tab, arrows, Enter).
  • Settings switches, choices and the dojo selection are local to the device; they are not part of the save.