sf2.looks
Looks are armor and helm models the player wears over their gear, picked in the Armory’s Looks mode. A look changes only what is drawn, never stats or how the fighter is hit. Owning an armor or helm unlocks its look; register looks that are not gear, set an item’s look options, and unlock looks with sf2.profile.unlock_look. Get sf2 with local sf2 = require("sf2").
sf2.looks.register
Section titled “sf2.looks.register”Add an armor or helm look the player can wear over their gear without owning it as gear.
Signature: sf2.looks.register { slot, id, display_name, icon, model, hint?, versus?, form?, portrait?, boss? }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
LookDefinition |
Required |
Fields of LookDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
slot |
"armor"|"helm" |
Required | The armor slot draws the whole body (a boss form goes here); the helm slot draws the head. |
id |
string |
Required | Local ID, unique among your mod’s armor (or helms). |
display_name |
string|LocalizationHandle |
Required | The name on the look’s tile. |
icon |
string|SpriteHandle |
Required | The tile’s picture. |
model |
string|ModelHandle |
Required | An armor or helm model for the standard fighter rig. |
hint |
string|LocalizationHandle |
Optional | Shown on the locked tile: how to unlock the look. Default “Locked”. |
versus |
boolean |
Optional | false keeps the look to the campaign; versus play draws the gear. Default true. |
form |
boolean |
Optional | true marks a boss form, also listed under the Looks mode’s FORMS button. Default false. |
portrait |
SpriteHandle|string |
Optional | Sprite handle or built-in portrait name (such as “boss_lynx”) shown on the tile instead of the icon. |
boss |
LocalizationHandle|string |
Optional | Text handle or game text key (such as “NAME_LYNX”) naming the boss; without a hint the locked tile says “Beat LYNX to unlock”. |
Returns: An item handle for the look. Its ID is <your mod>:items/armor/<id> or <your mod>:items/helm/<id>.
When: While your mod loads.
local crowMask = sf2.looks.register { slot = "helm", id = "crow_mask", display_name = sf2.text.register { id = "look.crow_mask", language = "eng", value = "Crow Mask" }, icon = sf2.assets.sprite("sprites/crow_mask_icon"), model = sf2.assets.model("models/mdl_helm_crow_mask"), hint = sf2.text.register { id = "look.crow_mask.hint", language = "eng", value = "Beat the Crow at the gate" },}
sf2.story.on("fight_end", function(event) if event.fight == sf2.mod.id .. ":fights/crow" and event.result == "win" then sf2.profile.unlock_look(crowMask) endend)A look changes only what is drawn. The player’s armor or helm keeps its stats, and the fighter is hit, moves and falls exactly as it does in that gear. See the looks guide for how the Armory shows looks.
| Field | Required | Meaning |
|---|---|---|
slot |
yes | "armor" (the body, including a whole boss form) or "helm". |
id |
yes | Local ID, unique among your mod’s armor (or helms). |
display_name |
yes | Text handle: the name on the look’s tile. |
icon |
yes | Sprite handle: the tile’s picture. |
model |
yes | Model handle: an armor or helm model built for the standard fighter rig. |
hint |
no | Text handle shown on the locked tile, telling the player how to unlock it. Default: “Locked”. |
versus |
no | false keeps the look to the campaign: versus play draws the gear instead. Default true. |
form |
no | true marks a boss form: the look is also listed under the Looks mode’s FORMS button. Default false. |
portrait |
no | Sprite handle, or a built-in portrait name such as "boss_lynx": the tile shows this picture instead of icon. |
boss |
no | Text handle, or a game text key such as "NAME_LYNX": the boss the look belongs to. Without a hint, the locked tile says “Beat LYNX to unlock”. |
A registered look starts locked. Unlock it with sf2.profile.unlock_look. It is never sold, never listed as gear, and never offered as armor in versus. It is still an item underneath, so do not give it with sf2.profile.give_item.
The model must hang on the standard fighter rig. If its edges or node weights name rig points the fighter does not have, or its own points never connect to the rig, it is not drawn and the player sees their gear. Single shapes that name missing points are skipped, as the game does for its own models. Skinned nodes (SkinnedNode) and centre-of-mass nodes in the model are ignored: skins need a character’s proportion rig, and a look never moves the fighter’s weight.
sf2.looks.patch
Section titled “sf2.looks.patch”Set the look options of an existing armor or helm: the locked tile’s hint, keeping its look out of versus, marking it as a boss form with a portrait, or leaving it out of the Looks list.
Signature: sf2.looks.patch { item, hint?, versus?, form?, portrait?, boss?, hidden? }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
LookPatch |
Required |
Fields of LookPatch
| Field | Type | Required | Meaning |
|---|---|---|---|
item |
string|ItemHandle |
Required | An armor or helm. |
hint |
string|LocalizationHandle |
Optional | Shown on the look’s locked tile. |
versus |
boolean |
Optional | false keeps the look to the campaign and leaves the item out of the versus armor or helm lists. Default true. |
form |
boolean |
Optional | true marks a boss form, also listed under the Looks mode’s FORMS button. Default false. |
portrait |
SpriteHandle|string |
Optional | Sprite handle or built-in portrait name (such as “boss_lynx”) shown on the tile instead of the icon. |
boss |
LocalizationHandle|string |
Optional | Text handle or game text key (such as “NAME_LYNX”) naming the boss; without a hint the locked tile says “Beat LYNX to unlock”. |
hidden |
boolean |
Optional | true leaves the item out of the Looks mode’s list, for a copy of a look already listed. Default false. |
Returns: nil.
When: While your mod loads, with an item handle.
sf2.looks.patch { item = sf2.items.get("core:items/armor/body_lynx"), form = true, portrait = "boss_lynx", -- the boss's built-in portrait boss = "NAME_LYNX", -- the locked tile says "Beat LYNX to unlock"}Give item plus at least one of the other fields. The item can be a core armor or helm, another mod’s (declare the dependency), or your own.
| Field | Required | Meaning |
|---|---|---|
item |
yes | Item handle of an armor or helm. |
hint |
no | Text handle shown on the look’s locked tile. |
versus |
no | false keeps the look to the campaign. Versus play then draws the gear, and the item is also left out of the versus armor or helm lists. Default true. |
form |
no | true marks a boss form: the look is also listed under the Looks mode’s FORMS button. Default false. |
portrait |
no | Sprite handle, or a built-in portrait name such as "boss_lynx": the look’s tile shows this picture instead of the item icon. |
boss |
no | Text handle, or a game text key such as "NAME_LYNX": the boss the look belongs to. Without a hint, the locked tile says “Beat LYNX to unlock”. |
hidden |
no | true leaves the item out of the Looks mode’s list, for a copy of a look that is already listed. Default false. |
All of an item’s options go in one call. A form patched with versus = false is still listed under FORMS; it just draws the gear in versus play.
Each item takes one set of look options. A second sf2.looks.patch (or sf2.looks.register) for the same item fails the later mod.