Weapons
A weapon has a name, a picture for the shop, a 3D model, a subtype (the family of moves it fights with), a shop listing, starting damage and, if you like, perks and enchantments. There are three ways to describe one. They produce the same result, so pick the one that suits you.
| Way | Choose it when | You need |
|---|---|---|
| Weapon Workshop (in game) | You want to see the weapon on a live fighter and a shop card while you work. You prefer clicking to typing. | The Unity project or a development build on desktop, with mouse and keyboard. Release builds do not include it yet. |
Weapon file (weapons/*.json) |
You want a data-only mod, or to write many weapons quickly. No script is needed. | A text editor. |
Lua (sf2.items) |
The weapon needs a script, such as a special ability, or you are making armor, helms, ranged or magic. | A script and the core dependency if you borrow core assets. |
Whatever you pick, a weapon needs a shop listing or a reward before a player can get it. A weapon with neither exists in the game but nobody can obtain it.
The Weapon Workshop edits weapons for a mod and saves them as an ordinary data-only mod (a weapon file plus any models and pictures you add). You can still edit the saved files by hand later.
For now the Workshop is only in the Unity project and in development builds; release builds of the game do not show it. In a release build, use a weapon file or Lua instead.
Open it from Multiplayer > WEAPON WORKSHOP (or press W) on the title screen, from Mods > Weapon Workshop, or with WEAPONS in the Moveset Lab. It is a desktop tool: phones and tablets do not offer it.
The screen. The top bar shows the mod you are editing (MOD, NEW), MOVES to open the Moveset Lab on the selected weapon, and UNDO, REDO, SAVE, TEST, EXPORT and CLOSE. On the left, MY WEAPONS lists what your mod adds and GAME WEAPONS lists the game’s own (a gold dot marks one your mod changes). In the centre a fighter holds the selected weapon: TRY A MOVE (or Space) plays the next attack, and HITTING PARTS shows the parts an attack hits with. Beneath it a shop card shows your latest edits. The right side holds the fields.
Make a weapon.
- Choose MY WEAPONS and press + NEW.
- Pick the weapon’s class, such as katana or nunchaku. The class decides which moves it fights with.
- Edit the fields, then press SAVE (F5). To start from one particular game weapon, pick it under GAME WEAPONS and press NEW FROM THIS.
The fields.
| Field | What it does |
|---|---|
| Name | The English name players see (up to 64 characters). |
| Moves | The class whose moves the weapon uses. |
| Model | GAME MODEL… borrows a game weapon’s look. IMPORT… uses your own .obj, .stl, .gltf or .glb file, or Eclipse geometry. BOTH HANDS doubles a model for dual weapons. |
| Shop icon | GAME ICON…, or IMPORT PNG… for your own picture. |
| Shop level | 1 to 52: the player level at which the shop offers it. |
| Paid in, Price | Coins or gems, and the amount. |
| Weapon damage | The damage a newly bought copy starts with. Left on automatic, it follows the shop level. RESET returns to automatic. |
| Perks | Always-on abilities while equipped. + PERK… lists the game’s perks. |
| Enchantments | What a newly bought copy comes with. + ENCHANTMENT… lists the weapon enchantments. |
| Names in other languages | One name per language; empty means the English name. |
A new class. To make a weapon that fights its own way, press + NEW and
choose NEW CLASS… at the top of the list. Give it a name (letters, digits
and _, starting with a letter), pick a class to start from, and choose whether
to COPY ALL moves of that class or start with NONE YET. Each copied move
belongs to the new class alone, so you can edit it in the Moveset Lab without
touching the original. See Moves.
Import a 3D model. The importer shows your weapon flat, the way the game
draws every weapon, with the weapon it replaces in grey for size. Set which axis
runs from handle to tip, the length, where the hand holds it and where it hits.
Colours and textures do not carry over. Moves find a weapon’s hitting parts by
name (such as WEAPON_KATANA-Blade), and the importer names them to match.
Change a game weapon. Under GAME WEAPONS, pick a weapon and change its model, picture, shop level, prices, damage, perks or enchantments. Every field starts at the game’s value; a changed value gets a gold dot and a RESET button. Set one of the two prices to 0 to remove that way of paying (at least one must stay above 0). The changes are saved as a patch.
Save, test, share. SAVE writes the mod to its folder, for example
Mods/local.heavy-katana/. TEST (T) saves and starts a training fight
with the weapon. EXPORT writes a ZIP to an Eclipse mods folder on your
desktop, ready to install elsewhere. The shop and
campaign see weapon changes after the game restarts.
Limits. The Workshop edits data-only mods, so mods with a Lua entry script do not appear in its list. Damage and default enchantments show in the campaign, not in training. Perks are the game’s own; a new ability needs Lua. Names of game armor, helms and other gear cannot be edited here. Online versus is unavailable while the Workshop is open.
A weapon file describes weapons as data and needs no script. Put one or more
.json files in a weapons/ folder next to mod.toml. A mod with only data
files can leave out entrypoint.
Mods/yourname.heavy-blade/ mod.toml weapons/weapons.json assets/models/heavy_blade.xml assets/sprites/heavy_blade_icon.asset assets/textures/heavy_blade_icon.pngThis file adds a heavy katana with a German name, a starting damage, a thorns perk and a bleeding enchantment, and makes the game’s Knives cheaper and stronger:
{ "schema": 1, "kind": "eclipse.weapons", "weapons": [ { "id": "heavy_blade", "name": "Heavy Blade", "names": { "ger": "Schwere Klinge" }, "subtype": "Katana", "model": "models/heavy_blade", "icon": "sprites/heavy_blade_icon", "damage": 140, "shop": { "level": 12, "price": 2400, "currency": "coins" }, "innate_perks": [ { "perk": "core:perks/perk_magic_thorns", "parameters": { "Duration": 240 } } ], "default_enchantments": [ { "perk": "core:perks/perk_item_special_bleeding_weapon", "aspect": 80 } ] } ], "patches": [ { "item": "core:items/weapon/weapon_knives", "shop": { "level": 3, "price": 400, "currency": "coins", "secondary_price": 20 }, "damage": 30 } ]}Because it names core perks and a core weapon, mod.toml needs the core
dependency. The file’s top level is:
| Field | Required? | Meaning |
|---|---|---|
schema |
Yes | Always 1. |
kind |
Yes | Always "eclipse.weapons". |
weapons |
One of these two | Up to 256 new weapons. |
patches |
One of these two | Up to 256 changes to existing weapons. |
Every field name is checked. A misspelled or unknown field stops the mod from loading, with a message naming the file and the field.
A new weapon (an entry of weapons):
| Field | Required? | Default | Meaning |
|---|---|---|---|
id |
Yes | 1 to 48 lowercase letters, digits or _. The item becomes <mod id>:items/weapon/<id>. Never change it once players own the weapon. |
|
name |
Yes | The English name, 1 to 64 characters. | |
names |
No | none | Names in other languages, such as { "ger": "Schwere Klinge" }. Up to 16 languages. Do not repeat English here. |
subtype |
Yes | The move family, such as "Katana". See the item subtypes. |
|
tactic_subtype |
No | the subtype | Which group of AI tables computer fighters use. |
model |
Yes | "models/<name>" for a model in your mod, or a core model ID. |
|
icon |
No | no picture | A sprite for the shop: "sprites/<name>" or a core sprite ID. |
damage |
No | the level’s normal damage | Starting damage, a whole number from 0 to 1,000,000. Upgrades raise it from there. |
shop |
No | level 1, price 100 coins | level (1 to 52), price (0 or more) and currency ("coins" or "gems"). Every new weapon is listed in the weapon shop. |
innate_perks |
No | none | Perks that work whenever the weapon is equipped, even on copies players already own. |
default_enchantments |
No | none | Enchantments a copy gets when a player buys or receives it. |
A perk entry is { "perk": "<id>", "parameters": { ... } } for innate perks (the
parameter names the perk understands, as numbers) or { "perk": "<id>", "aspect": 80 }
for enchantments. Each perk can appear once per list. Perk IDs are in the
perk catalog, and their owner needs a dependency.
A weapon’s name is stored as the translation key weapon_name_<id>. Name it in
one place only: if a localizations/*.toml file also sets that key for a
language the weapon file already sets, the mod does not load. A translation file
may add a language the weapon file does not mention.
Changing an existing weapon (an entry of patches): give item (the
weapon’s ID) and at least one of shop, damage, icon, model,
innate_perks or default_enchantments. The weapon keeps its ID, so players
keep their copies. A shop patch can set level, price, currency and
secondary_price. A price replaces both of the weapon’s prices; to keep a
second way of paying, add secondary_price in the other currency. An
innate_perks: [] removes every innate perk; leaving the field out keeps them.
Patches change weapons only (not armor, helms, ranged or magic) and cannot change
the subtype.
The in-game Moveset Lab and Workshop rewrite weapon files in a fixed layout. JSON cannot hold comments.
In Lua, the whole job is done by sf2.items.register
and sf2.items.patch. This is the same
heavy katana as the JSON tab:
local sf2 = require("sf2")-- Needs the core dependency in mod.toml.
local blade = sf2.items.register { category = "weapon", id = "heavy_blade", display_name = sf2.text.register { id = "weapon_name_heavy_blade", language = "eng", value = "Heavy Blade" }, icon = sf2.assets.sprite("sprites/heavy_blade_icon"), model = sf2.assets.model("models/heavy_blade"), subtype = "Katana", initial_stats = { weapon_damage = 140 }, shop = { level = 12, price = { coins = 2400 } },}
sf2.items.patch { item = blade, perks = { { perk = "core:perks/perk_magic_thorns", parameters = { Duration = 240 } }, }, enchantments = { { perk = "core:perks/perk_item_special_bleeding_weapon", aspect = 80 }, },}
sf2.items.patch { item = "core:items/weapon/weapon_knives", price = { coins = 400 }, secondary_price = { gems = 20 }, initial_profile = { level = 3, upgrade_level = 300, initial_stats = { weapon_damage = 30 } },}Registering. register takes a table whose category picks the shape:
| Field | Required? | Meaning |
|---|---|---|
category |
Yes | "weapon", "armor", "helm", "ranged", "magic", "consumable", "free", "seal" or "set". |
id |
Yes | A short local ID such as heavy_blade. Do not add your mod name. |
display_name |
Yes | A text handle from sf2.text.get or sf2.text.register. |
icon, model |
Yes for equipment | A sprite and a model (handles or ID strings). |
subtype |
By category | The move family. Weapons default to "Katana". Ranged and magic require one (such as "Skull" or "MagicAsteroid"). Armor and helms take none. |
tactic_subtype |
No | Weapons only. The AI table group, if it should differ from the subtype. |
initial_stats |
No | Exact starting stats (see below). Leave it out for the normal stats of the shop level. |
shop |
No | { level, price } to list the item in its own shop. |
perk |
No | One permanent perk written inline, or a perk handle. |
The shop levels each category accepts, and the stat names:
| Category | Shop | Levels | initial_stats fields |
|---|---|---|---|
weapon |
"weapons" |
1 to 52 | weapon_damage |
armor |
"armor" |
2 to 52 | body_defense, head_defense, unarmed_damage |
helm |
"helmets" |
2 to 52 | head_defense |
ranged |
"ranged" |
6 to 52 | ranged_damage, weapon_damage |
magic |
"magic" |
6 to 52 | magic_damage |
A price is a table with exactly one currency: { coins = 500 } or
{ gems = 10 }, a whole number up to about 2.1 billion. A price only describes a
cost; it never spends anything. initial_stats values are whole numbers from 0
to 1,000,000. Giving initial_stats = {} leaves every starting stat absent, and
giving a table replaces the whole snapshot, so list every stat you want.
consumable, free and seal make non-equipment items such as an entry ticket
for a mode. set groups items into a named set with title, text, brief and
a list of members. Neither adds a shop listing or an effect on its own. A
consumable with a stack is the exception: the shop can sell it by the piece
(see Consumables sold by the piece).
An item with its own ability. Write the perk inside the item. It is registered for you under the item’s ID:
sf2.items.register { category = "weapon", id = "storm_blade", display_name = sf2.text.get("item.storm_blade"), icon = sf2.assets.sprite("sprites/storm_blade"), model = sf2.assets.model("core:gamedata/models/mdl_weapon_katana_ritual"), shop = { level = 10, price = { coins = 2500 } }, perk = { description = sf2.text.get("perk.storm_blade"), behavior = { on_damage_dealt = function(_, fighter, event) fighter:add_magic_charge(1) end, }, },}See Perks and enchantments for what a behaviour can
do. An item with an inline perk cannot also be given the perks list of a
patch; use that list alone when you need several perks.
Patching. sf2.items.patch changes
an item that exists. Give item plus at least one of:
| Field | Changes |
|---|---|
price, secondary_price |
The shop price (the first replaces both prices; the second is a price in the other currency). |
shop |
Adds a shop listing. |
icon, model |
The shop picture and the fighter model, for copies made from now on. |
subtype, tactic_subtype |
The move family and AI group. A new subtype does not create moves; choose one whose moves, model parts and projectiles already exist. |
initial_profile |
Starting level and upgrade_level with a full initial_stats snapshot. |
perks |
Replaces the permanent perks (an empty list removes them). |
enchantments |
Replaces the default enchantments of newly acquired copies. |
visibility, required_group, minimum_level |
Who can see it in the shop: "inherit", "force_visible" or "force_hidden", plus an optional required_group and level. required_group is a shop group the save has unlocked: the game unlocks ZONE_2 to ZONE_6, ZONE_7, ZONE_7_2, ZONE_7_3 and ZONE_IM (the Intermission) as the story reaches each act. Leave it out for anything sold from Act 1. Any other name is never unlocked, so the item never shows. |
Another patch of the same field of the same item conflicts, including one from another mod; the later mod fails to load. Patches to different fields coexist. Patches change what new copies and new fighters get. They never rewrite items in a player’s save.
Stable IDs. If you must remove a published item, call
sf2.items.retire so saved copies still
resolve:
sf2.items.retire { id = "weapon/old_blade", replaced_by = blade }Reuse the game’s equipment
Section titled “Reuse the game’s equipment”A weapon, model and icon from the base game each have their own ID and their own
lookup (sf2.items.get, sf2.assets.model, sf2.assets.sprite), and the handles
are not interchangeable. To make a new katana that looks like the game’s, pass
the katana’s model to your own item rather than the katana item. Core IDs, and
the catalog that lists them, are explained in
Reskin the game. Looking an item up copies
nothing and changes no price or stat.
Consumables sold by the piece
Section titled “Consumables sold by the piece”A stackable consumable is an item the player uses up, such as a healing
elixir. The player holds it as a count of pieces, up to its stack. The shop
sells it one piece at a time, fights can drop it, and your script spends a
piece and applies its effect when the player uses it. It needs Lua.
1. Register it with category = "consumable", a stack and an icon.
Add shop to sell it; leave shop out for an item that only comes from fights
or story events:
local elixir = sf2.items.register { category = "consumable", id = "healing_elixir", display_name = sf2.text.register { id = "item.healing_elixir", language = "eng", value = "Healing Elixir" }, description = sf2.text.register { id = "item.healing_elixir.description", language = "eng", value = "Restores a quarter of your health." }, icon = sf2.assets.sprite("sprites/healing_elixir"), stack = 9, -- the most a player can carry shop = { price = { coins = 250 } }, -- the price of one piece}In the shop it sits in the tab with the chests. Its tile shows how many the
player holds (x3) and the price, and each purchase adds one piece until the
player holds a full stack.
2. Hand out more pieces as a fight reward, with count on the reward’s
item, or from a story event with
sf2.profile.give_item. Neither
goes past the stack.
rewards = { [1] = { gems = 5, items = { { item = elixir, count = 2 } } } }
sf2.profile.give_item(elixir, 3)3. Use a piece.
sf2.profile.take_item spends
it and returns true only when the player had one;
sf2.profile.item_count says
how many are left. Menu buttons have no combat authority, so a button in a fight
menu takes the piece and a battle rule on the player applies the effect on its
next tick:
local drink_pending = false
local function drink_button(view) if sf2.profile.take_item(elixir) then drink_pending = true sf2.ui.update(view, "elixirs", { text = "x" .. sf2.profile.item_count(elixir) }) endend
local elixir_rule = { on_tick = function(_, fighter) if drink_pending then drink_pending = false fighter:change_health(0.25) end end,}Add elixir_rule to your fight as a behavior rule that targets the player (see
Battle rules). The count is saved with the player’s
inventory, and a save keeps it while your mod is turned off. Every field is in
sf2.items.register.
Turn on the weapon lab mechanics
Section titled “Turn on the weapon lab mechanics”Eclipse has five experimental weapon mechanics, the weapon lab. They are all
off unless a mod switches them on. A mod turns them on for every fight it runs
in, online included, with sf2.game.enable:
-- Every mechanic; list only the ones you want.sf2.game.enable { "charge_attacks", "polearm_tip", "scythe_execute", "kusarigama_pull", "katars_point_first" }| Name | What it does |
|---|---|
charge_attacks |
Holding the forward slash charges it for up to a second (Kusarigama: the up slash; Glaivebow and Rifle: the super slash). Not for heavy weapons. From half charge it knocks down. |
polearm_tip |
Spear, Glaive, Naginata and Staff hits at the weapon’s tip deal more and stun longer; close hits are weaker. |
scythe_execute |
A scythe hit on an opponent under 10% health knocks them out. |
kusarigama_pull |
The Kusarigama’s forward slash pulls the opponent in, blocked or not. |
katars_point_first |
Katars win weapon clashes against every weapon except the heavy ones. |
Options has no switches for them: a player turns them off by turning your mod off. Online, both players must run the same mods anyway, so both fight with the same mechanics. Replays record the mechanics a fight used and play them back without the mod.
The weapon file and Lua line up
Section titled “The weapon file and Lua line up”If you start with one way and later need the other, the fields map directly.
| Weapon file | Lua |
|---|---|
id, subtype, tactic_subtype, model, icon |
The same fields of sf2.items.register with category = "weapon". |
name, names |
sf2.text.register with the ID weapon_name_<id>, once per language. |
damage |
initial_stats = { weapon_damage = ... }. |
shop |
The shop field. |
innate_perks |
The perks field of sf2.items.patch. |
default_enchantments |
The enchantments field of sf2.items.patch. |
Patch shop.price, currency, secondary_price |
price and secondary_price. |
Patch shop.level and damage |
initial_profile. |
Limits
Section titled “Limits”- Weapon files and the Workshop load when the game starts. Restart to see a change in the campaign shop.
- Starting damage, levels and default enchantments apply to copies acquired after the mod loads. Copies players already own keep theirs; innate perks work on them too.
- Removing a weapon or changing its
idmakes the copies players own unavailable. A weapon file cannot keep an old ID alive; Lua can, withsf2.items.retire. - None of this checks game balance. Test a new weapon’s strength in a fight.
- A new weapon’s attacks hit with the edges named in its model. A model of your own needs edges with the same names as the subtype’s models. See Moves.