sf2.fx
Visual effects: colour grades, lights, particles, trails, shadows and more, drawn during fights and on stages. Most functions register an effect while your mod loads and return its name. You can then change or trigger it at run time with sf2.fx.set, sf2.fx.play and sf2.fx.on_frame. Get sf2 with local sf2 = require("sf2").
sf2.fx.screen
Section titled “sf2.fx.screen”Create a screen colour grade: saturation, contrast, tint, vignette, camera push-in and optional slow motion.
Signature: sf2.fx.screen { id = "...", trigger = "always", saturation = 1, contrast = 1, brightness = 0, tint = "#RRGGBB", tint_strength = 0, vignette = 0, ... }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxScreenDefinition |
Required |
Fields of FxScreenDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
saturation |
number |
Optional | 0-2, default 1. |
contrast |
number |
Optional | 0-2, default 1. |
brightness |
number |
Optional | -1 to 1, default 0. |
tint |
string |
Optional | #RRGGBB multiply colour. |
tint_strength |
number |
Optional | 0-1, default 0. |
vignette |
number |
Optional | 0-1, default 0. |
vignette_x |
number |
Optional | -1 to 1 vignette centre, default 0. |
vignette_y |
number |
Optional | -1 to 1 vignette centre, default 0. |
trigger |
"always"|"hit"|"critical"|"block"|"shock"|"guard_break"|"clash"|"perk"|"ko"|"final_ko"|"land"|"knockdown"|"wall"|"wall_break"|"wall_break_land"|"round"|"outro"|"outro_land"|"finisher"|"replay"|"replay_1"|"replay_2"|"replay_3"|"interval"|"script" |
Optional | When the effect fires. Default always. |
duration |
number |
Optional | 0.02-10 seconds fade of a triggered grade, default 0.25. |
hold |
number |
Optional | 0-10 seconds at full strength, default 0. |
time_scale |
number |
Optional | 0.05-1 game speed while a triggered grade is active, default 1. |
grain |
number |
Optional | 0-1, default 0. |
halation |
number |
Optional | 0-2, default 0. |
halation_threshold |
number |
Optional | 0-2, default 0.75. |
halation_color |
string |
Optional | #RRGGBB halation colour. |
flicker |
number |
Optional | 0-1 brightness wobble, default 0. |
flicker_speed |
number |
Optional | 0.1-30, default 6. |
accent |
string |
Optional | #RRGGBB hue kept through desaturation. |
accent_strength |
number |
Optional | 0-1, default 0. |
accent_width |
number |
Optional | 0.01-0.5 hue tolerance, default 0.08. |
sound |
AudioHandle|string|FxSound|(AudioHandle|string|FxSound)[] |
Optional | Triggered grades only. Audio handle, sound name, table, or up to 16 of these. |
perks |
string|PerkHandle|(string|PerkHandle)[] |
Optional | guard_break and perk only. Up to 16 perks (core name such as “PERK_BLOCK_BREAKER”, perk ID or handle): a guard_break effect fires only for a guard break one of them caused, a perk effect only when one of them (or a copy made from it) shows or pulses its icon. Default: every guard break or perk. |
muffle |
number |
Optional | 0-1 low-pass on the other game audio while the grade is active, default 0. Effect sounds skip a triggered grade’s muffle; an always-on grade’s muffle covers them too. |
zoom |
number |
Optional | 1-3. Triggered grades only: camera push-in factor. Default 1. |
zoom_offset_y |
number |
Optional | -400 to 400. Triggered grades only: camera pan; positive raises framing. Default 0. |
zoom_attack |
number |
Optional | 0-2. Triggered grades only: seconds the zoom push takes to reach full, counted inside hold; a restart eases on from where it was. Default 0 (a cut). |
close_up |
number |
Optional | 1-4. Hit triggers only (hit, critical, block, shock, guard_break, clash, perk, ko, final_ko): the camera snaps in this many times on the point where the blow landed (where blades crossed, or the fighter a perk acts on), holds for hold and eases out over duration. Default 1 (off). |
camera_dolly |
number |
Optional | 0-0.6. Triggered grades only: the cinematic camera pushes toward the stage by this share of its distance; nearer layers grow faster, so the backdrop parts from the floor. Default 0. |
camera_lens |
number |
Optional | 1-3. Triggered grades only: cinematic lens zoom, every layer alike. Default 1. |
camera_vertigo |
number |
Optional | 0-1. Triggered grades only: dolly zoom; the camera pulls back while the lens holds the fighters’ size, so the backdrop swells behind them. Default 0. |
camera_roll |
number |
Optional | -30 to 30. Triggered grades only: tilts the picture this many degrees, positive clockwise; the view zooms in enough to keep its corners covered. Default 0. |
camera_x |
number |
Optional | -400 to 400. Triggered grades only: moves the cinematic camera sideways in stage units, positive right; limited by the room a push-in leaves. Default 0. |
camera_y |
number |
Optional | -400 to 400. Triggered grades only: moves the cinematic camera up (positive) or down in stage units; limited by the room a push-in leaves. Default 0. |
camera_focus |
number |
Optional | 0-1. Triggered grades only: how far the cinematic camera turns toward the blow (hit triggers) or the fighter involved. Default 0. |
camera_attack |
number |
Optional | 0-5. Triggered grades only: seconds the camera_* move takes to reach full; count it inside hold. Default 0 (a cut). |
camera_with_blow |
number |
Optional | 0 or 1. Triggered grades only: 1 makes camera_x, camera_pan, camera_roll and camera_turn follow the blow (hit triggers) or the wall (wall): positive moves the camera the way the blow travels and tips the horizon toward it. Default 0. |
camera_drift |
number |
Optional | 0-0.3. Triggered grades only: extra camera_dolly added each second while the shot runs, up to 0.6. Default 0. |
camera_pan |
number |
Optional | -400 to 400. Triggered grades only: moves the cinematic camera sideways this many stage units each second while the shot runs, positive right; follows the blow with camera_with_blow. Default 0. |
camera_rise |
number |
Optional | -400 to 400. Triggered grades only: moves the cinematic camera up (positive) or down this many stage units each second while the shot runs. Default 0. |
camera_turn |
number |
Optional | -30 to 30. Triggered grades only: degrees of camera_roll added each second while the shot runs; follows the blow with camera_with_blow. Default 0. |
camera_swell |
number |
Optional | -1 to 1. Triggered grades only: camera_vertigo added each second while the shot runs, within 0-1. Default 0. |
camera_orbit |
number |
Optional | -180 to 180. Knockout finisher and replay only (trigger finisher, replay or replay_1 to replay_3): degrees the camera swings around the fighters, positive to the right: out fast over camera_attack, a glide through hold, back fast over duration; the stage blurs behind them and slides past until the stop or pass ends. Default 0. |
camera_sweep |
number |
Optional | -90 to 90. Knockout finisher and replay only: degrees of camera_orbit added each second while the grade runs. Default 0. |
chromatic |
number |
Optional | 0-1 colour fringing toward the frame edges, default 0. |
radial_blur |
number |
Optional | 0-1 zoom blur toward the centre, default 0. |
letterbox |
number |
Optional | 0-0.3 height of each cinema bar as a fraction of the screen, default 0. |
shake |
number |
Optional | 0-1 triggered grades only: camera shake, default 0. |
shake_speed |
number |
Optional | 1-60 how fast the shake moves, default 22. |
split_tone |
number |
Optional | 0-1 split-toning strength, default 0; the strongest grade colours win. |
shadow_tint |
string |
Optional | #RRGGBB overlay colour for the shadows; mid grey is neutral. Default a cool teal. |
highlight_tint |
string |
Optional | #RRGGBB overlay colour for the highlights; mid grey is neutral. Default a warm amber. |
god_rays |
number |
Optional | 0-2 light streaming from bright areas toward a point, default 0. |
god_rays_x |
number |
Optional | -1 to 1 screen position of the ray source, default -0.6. |
god_rays_y |
number |
Optional | -1 to 1 screen position of the ray source, up is positive, default 0.8. |
god_rays_follow |
number |
Optional | 0-1. Turns the rays toward the stage light. Default 0. |
god_rays_threshold |
number |
Optional | 0-2 brightness where rays start, default 0.7. |
god_rays_length |
number |
Optional | 0.1-1 how far rays reach, default 0.6. |
god_rays_color |
string |
Optional | #RRGGBB ray colour, default warm white. |
distortion |
number |
Optional | 0-1 heat-haze or underwater wobble, default 0. |
distortion_speed |
number |
Optional | 0.1-20, default 3. |
distortion_height |
number |
Optional | 0.05-1 share of the screen, from the bottom, that wobbles. Default 1. |
sharpen |
number |
Optional | 0-1 crisps edges, default 0. |
monochrome |
number |
Optional | 0-1 black and white after every other colour change, default 0. |
hide_arrows |
number |
Optional | 0-1. Hides the ground arrows while the grade is active. Default 0. |
light_wrap |
number |
Optional | 0-1 bright picture spills over fighters’ edges, default 0. |
light_wrap_width |
number |
Optional | 1-32 pixels (1080-line picture) light wrap reaches in. Default 8. |
interval |
number |
Optional | 0.5-120 seconds between firings for trigger = interval, default 8. |
interval_jitter |
number |
Optional | 0-1 random variation of the interval either way, default 0.5. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
-- On the knockout hit: grey, slow motion, a muffled fight and a sound.sf2.fx.screen { id = "knockout_fade", trigger = "ko", saturation = 0, contrast = 1.15, hold = 1.2, duration = 1.6, time_scale = 0.3, sound = { sound = "snd_time_shift", volume = 0.8 }, muffle = 0.75,}
-- Lightning every nine seconds or so on rainy stages.sf2.fx.screen { id = "lightning", tags = { "rain" }, trigger = "interval", interval = 9, interval_jitter = 0.6, brightness = 0.55, contrast = 1.3, hold = 0.04, duration = 0.45, sound = { "snd_hermit_lightning", "snd_hermit_lightning2" },}When several grades are active, saturation and contrast multiply, brightness adds,
tints layer in load order, and for most other fields the strongest wins. The
whole-picture pass that draws them runs only while they change something: an always-on
grade that sf2.fx.set holds at its neutral values (saturation and contrast
1, everything else 0) costs nothing until it moves.
Triggers. always is permanent. Any other trigger keeps the grade off until it
fires, applies it fully for hold seconds, then eases it out over duration;
each new trigger restarts it. Both are real time, so slow motion does not stretch
them, but they stand still while the fight is paused for a menu and carry on after it. hit, critical and ko fire on matching hits and block on a blocked hit;
shock on a hit that staggers the victim and knocks its weapon away (with hit);
guard_break on a hit the victim was guarding that a perk such as Block Breaker, or a
script, let through (it fires together with hit, so use it to layer on top; perks
limits it to guard breaks caused by the listed perks, see below); clash when two weapon
attacks meet blade on blade and neither lands (no hit, block or critical fires for it);
perk when a perk shows or pulses its icon over a fighter, as an enchantment takes effect
(perks picks which, see below); final_ko only on the knockout that decides the fight (a deciding knockout fires ko as well); land, knockdown and
wall on movement by either fighter (see
contact particles); round as each round begins (the stage shows
behind the “Round” banner and the fighters appear when it ends; see below for camera shots);
outro and outro_land with the knockout close-up (both
end when the next round starts, so a long hold covers the whole close-up);
wall_break as a wall break (local versus and training) sends a fighter through the wall
(the camera’s camera_focus turns to where they come out) and wall_break_land at
the first landing or knockdown after it, the arrival in the new arena;
finisher as the knockout finisher stops the fight on the blow
that wins it (it ends as the fight moves again, so give it a hold longer than the stop
and a short duration);
replay as the knockout replay starts and replay_1,
replay_2 and replay_3 as each of its passes does (each ends with its pass, or the
replay, at once, so give them a hold longer than that and a short duration);
interval every interval seconds, the first one interval into the fight (paused time does not count); script
when your Lua calls sf2.fx.play. Triggered grades run in real
fights only, not title-screen sparring; there only the sound of hit, block,
critical, shock, guard break, knockout and interval triggers plays, faded with the
title’s sparring sounds (clash and perk grades stay silent there too).
Sound and muffle. sound plays each time the trigger fires. Give an array of up
to 16 to pick one at random, each choice with its own volume. Trim silence from the start
of your files, since it delays the sound. A hit and a block sound pair well
with a move sound swap that quiets the game’s own strike sounds. muffle low-pass filters the other game
sounds. Effect sounds skip a triggered grade’s muffle, so a knockout sting stays clear. An
always-on grade (no trigger) muffles effect sounds too, so a steady look such as an old
cinema speaker covers every sound of the fight.
Guard breaks from chosen perks. With trigger = "guard_break", perks takes one
perk or an array of up to 16: a core perk name such as "PERK_BLOCK_BREAKER", a
qualified ID such as "core:perks/PERK_BLOCK_BREAKER", or a perk handle. The effect then
fires only when one of those perks pushed the hit through the guard, not for other perks
or for a script’s set_hit_blocked. Without perks it fires for every guard break.
Enchantments and perks. With trigger = "perk", perks takes the same names and the
grade fires only when one of those perks shows or pulses its icon. A name also covers the
copies made from it, so "PERK_ITEM_SPECIAL_STUN" matches the weapon, ranged and magic
versions. Without perks it fires for every perk icon, not only enchantments. close_up and camera_focus turn to the fighter the icon is over.
sf2.fx.screen { id = "block_breaker_crunch", trigger = "guard_break", perks = "PERK_BLOCK_BREAKER", sound = sf2.assets.audio("audio/guard_crunch"),}Close-up on the blow
Section titled “Close-up on the blow”close_up (1 to 4, default 1 for off) snaps the camera in that many times on the exact
point where the triggering blow landed, holds it for hold and eases back out over
duration, like a fighting game’s finishing close-up. Unlike zoom, it may leave the
fighters’ edges off screen, and it never shows anything outside the normal view. It needs
a hit trigger: hit, critical, block, shock, guard_break, clash, perk, ko or
final_ko (a clash closes in on where the weapons crossed, a perk on the fighter’s body). The
HUD stays where it is. When several close-ups run at once the strongest wins.
-- Snap in on a shock and hold through the game's half-second freeze.sf2.fx.screen { id = "shock_close_up", trigger = "shock", close_up = 2.4, hold = 0.45, duration = 0.3 }Cinematic camera
Section titled “Cinematic camera”The camera_* fields film a moment with a perspective camera. Every stage layer sits at its
own depth, worked out from how much it scrolls when the view pans (its parallax), so the
camera’s moves show real depth: push in and the floor and fighters grow faster than the
far backdrop, move sideways and the layers slide past each other. The sky and other
layers that never scroll stay at the horizon. With every field at its default the picture
is the normal one, so a shot starts and ends without a cut.
| Field | Range | Default | What it does |
|---|---|---|---|
camera_dolly |
0 to 0.6 | 0 | Moves the camera toward the stage by this share of its distance to the fighters. 0.3 makes the fighters about 1.4 times bigger. |
camera_lens |
1 to 3 | 1 | Zooms the lens. Unlike a dolly, every layer grows by the same amount. |
camera_vertigo |
0 to 1 | 0 | Dolly zoom: the camera pulls back while the lens zooms in to keep the fighters the same size, so the backdrop swells behind them. |
camera_roll |
-30 to 30 | 0 | Tilts the picture by this many degrees, positive clockwise. The view zooms in just enough to keep the corners covered. |
camera_x, camera_y |
-400 to 400 | 0 | Moves the camera right (positive x) or up (positive y), in stage units. |
camera_focus |
0 to 1 | 0 | How far the camera turns toward the blow (hit triggers) or the fighter involved (land, knockdown, wall, outro, and the x given to sf2.fx.play). |
camera_attack |
0 to 5 | 0 | Seconds the move takes to reach full strength. 0 cuts straight to it. |
camera_drift |
0 to 0.3 | 0 | Extra camera_dolly added every second while the shot runs, for a slow creep in. The total stops at 0.6. |
camera_with_blow |
0 or 1 | 0 | 1 makes camera_x, camera_pan, camera_roll and camera_turn follow the moment instead of the screen: positive moves the camera the way the blow travels and tips the horizon down toward that side. For hit triggers that is the direction of the blow; for wall it is the wall the fighter hits. Other triggers keep the screen directions. |
camera_pan |
-400 to 400 | 0 | Moves the camera sideways by this many stage units every second while the shot runs, positive right, for a tracking shot. |
camera_rise |
-400 to 400 | 0 | Moves the camera up (positive) or down by this many stage units every second, for a crane shot. |
camera_turn |
-30 to 30 | 0 | Adds this many degrees of camera_roll every second, so a tilted horizon can level out or tip further. |
camera_swell |
-1 to 1 | 0 | Adds this much camera_vertigo every second, so the backdrop keeps swelling (or shrinking) while you watch. |
The shot then follows the grade’s timing: it holds for hold and eases back over
duration. camera_attack counts inside hold, so give hold at least as long. The
fields need a trigger. When several shots run at once, the strongest one is used; with
sf2.fx.smooth_camera the camera glides from one to the next,
except at the start of a round, which cuts to the round’s shot.
A round shot takes its first position as the round begins, on the stage behind the
“Round” banner, and holds it still until the fighters appear. Its hold, duration and
per-second moves count from then, so the whole move is seen and the camera does not jump
when the fighters arrive. camera_attack still counts from the start of the round: with
one, the camera glides into its first position behind the banner instead of cutting to it.
The per-second moves (camera_drift, camera_pan, camera_rise, camera_turn and
camera_swell) start with the shot and keep going while it eases back, and each total
stays inside its own field’s range. To land a moving shot on the fight’s own framing
instead of past it, start it on one side and move it back toward the middle: for example
camera_x = -175 with camera_pan = 95 crosses the middle a little under two seconds in,
about when a hold = 1.1, duration = 1.2 shot has almost eased back.
The camera never shows anything outside the stage art. A sideways move or camera_focus
only goes as far as the push-in leaves room for, so with no camera_dolly, camera_lens
or camera_vertigo the camera cannot move sideways at all. The stage is made of flat
pictures, so in the fight itself the camera only moves and tilts. Only the knockout finisher
and replay, which stop the fight, can swing it around the fighters (see the next section).
The ground arrows fade out during a shot, and the HUD stays where it is. The shot is drawn
over the fight’s own camera, so zoom, close_up and a script’s camera still work with it.
-- The blow that wins the fight: dolly in on the impact with a Dutch tilt,-- still creeping in as the moment holds.sf2.fx.screen { id = "finisher_cam", trigger = "final_ko", camera_dolly = 0.3, camera_focus = 0.75, camera_roll = -7, camera_attack = 0.6, camera_drift = 0.05, hold = 1.3, duration = 1.6,}
-- A heavy blow carries the camera with it and tips the horizon the way the body flies,-- whichever way the fight faces.sf2.fx.screen { id = "carried", trigger = "ko", camera_dolly = 0.14, camera_focus = 0.4, camera_x = 25, camera_roll = 2, camera_with_blow = 1, camera_attack = 0.35, hold = 0.5, duration = 1,}
-- The winner's close-up: the stage swells and leans in behind them.sf2.fx.screen { id = "winner_vertigo", trigger = "outro", camera_vertigo = 0.7, camera_roll = 2.5, camera_attack = 1.6, hold = 10, duration = 0.8,}
-- A round opens close on one side and tracks across to the other while the fighters take-- their stance, then settles on the fight as it begins.sf2.fx.screen { id = "round_track", trigger = "round", camera_dolly = 0.46, camera_x = -175, camera_y = 20, camera_pan = 95, hold = 1.1, duration = 1.2,}Orbiting the finishing blow
Section titled “Orbiting the finishing blow”The knockout finisher stops the fight dead on the blow that wins it,
and the knockout replay stops it to play the blow again, so during either the camera can
swing around the fighters like a fighting game’s finishing shot. Give a grade with
trigger = "finisher", or a replay trigger (replay, or replay_1 to replay_3 for one
pass), camera_orbit, camera_sweep or both:
| Field | Range | Default | What it does |
|---|---|---|---|
camera_orbit |
-180 to 180 | 0 | Swings the camera around the fighters by this many degrees. Positive swings it to the right, so the fighter on the right comes nearer; negative swings it to the left. |
camera_sweep |
-90 to 90 | 0 | Adds this many degrees of camera_orbit every second while the grade runs, so the camera keeps circling. The total stops at 180 either way. |
The fighters turn about the point where the finishing blow landed (in the replay, the point between them at the knockout), both set on the same plane through it, and are drawn as solid shapes in depth. Their bodies and gear are drawn for the side view, so the gear thins as the angle grows: up to about 45 degrees holds up well, and near 90 degrees the fighters are seen edge-on. Past 90 the fighters swap sides on screen. The fighter coming nearer grows and the one going away shrinks, as through a camera lens (about a seventh each at 55 degrees), with their feet kept on the floor. The farther fighter also takes a little of the stage’s horizon colour, so the two stay apart as shapes. Weapon trails hold their shape and turn with the fight’s plane. In the finisher the game’s own hit spark stays where the blow landed; in the replay its hit effects and blood follow the blow. Skinned mod models turn flat, and projectiles do not turn.
The stage is made of flat pictures and cannot turn, so while the swing runs it is replaced by
a soft, out-of-focus copy of itself, taken as the swing starts. The copy leaves out the
stage’s foreground (anything drawn in front of the fighters), which would otherwise slide in
behind them. It slides sideways the opposite way to the near fighter as the camera goes
round, about a screen width every 80 degrees, the way a distant background sweeps past in a
real camera move. A soft light hangs in the air behind the fighters so they read against a
dark stage (glow in sf2.fx.knockout_finisher, orbit_glow in
sf2.fx.knockout_outro for the replay). Below the floor the
stage’s ground colour hides what hangs below the fighters’ feet, and it follows a push-in
with them. The stage comes back when the finisher ends, or the replay pass, on the cut to what
follows. The swing has a speed of its own, fast, slow, fast: it leaves fast and settles over
camera_attack, glides through the rest of hold moved only by camera_sweep, then swings
back gathering speed over duration and reaches the side view still moving. End hold plus
duration when the stop or pass ends, so the cut back to the stage falls on that move; one
that ends sooner waits side-on for the cut. camera_sweep keeps adding while the swing comes
back, as the other per-second moves do. When several orbiting grades run, the strongest one
is used. The orbit can share a grade with the other camera fields, which ease in and out as
usual: a push-in or tilt alongside the swing helps it feel like a camera moving. The far
stage does not grow with a camera_dolly push-in while the fighters do, which reads as the
camera closing on them. On the finisher trigger camera_focus turns the shot to the point
where the blow landed, in height as well as sideways.
Keep the camera moving through the hold. With a small camera_sweep the middle of the swing
looks like a still picture: 15 to 20 degrees a second, with a camera_drift push-in, keeps
it alive. beat in sf2.fx.knockout_finisher holds the swing
back for a moment so the blow is seen landing first; the swing, and the other camera fields
on the same grade, then start that much later.
These two fields need the finisher trigger or a replay trigger; any other trigger is
refused when the mod loads, and by sf2.fx.set.
-- Time stops on the deciding blow for 1.85 seconds. The camera is flung round the fighters,-- keeps circling while it pushes in, and whips back side-on as the fight moves again.sf2.fx.knockout_finisher { hold = 1.85 }sf2.fx.screen { id = "finisher_orbit", trigger = "finisher", camera_orbit = 34, camera_sweep = 18, camera_attack = 0.45, hold = 1.25, duration = 0.6, camera_dolly = 0.3, camera_drift = 0.06, camera_focus = 0.8, camera_roll = 2.5,}Camera push-in
Section titled “Camera push-in”A triggered grade with zoom above 1 or a nonzero zoom_offset_y moves the camera
while active, then eases back. It moves toward the struck fighter for hit,
critical, block, shock, guard_break and ko, the moving fighter for land, knockdown and wall, and the
x given to sf2.fx.play for script. The strongest push wins
(zooms do not multiply), both fighters stay in view so far-apart fighters limit the
zoom, and always-on grades cannot push. Strong zoom crops the top of the picture:
zoom_offset_y of -40 to -70 keeps heads in view at zoom 1.3 to 1.7.
A push cuts straight in unless you give it zoom_attack (0 to 2 seconds, default 0):
it then eases in over that time, counted inside hold. A push that fires again while it
still shows eases on from where it was instead of starting over.
-- Lean in on a critical over a twentieth of a second rather than cutting.sf2.fx.screen { id = "crit_push", trigger = "critical", zoom = 1.1, zoom_offset_y = -35, zoom_attack = 0.05, hold = 0.08, duration = 0.3 }god_rays, halation and bloom all fade on very bright stages; see
sf2.fx.bloom.
sf2.fx.overlay
Section titled “sf2.fx.overlay”Draw a sprite or flat shape on the stage, between its layers or over the whole screen.
Signature: sf2.fx.overlay { id = "...", placement = "background", depth = 0.3, sprite = handle, color = "#RRGGBB", alpha = 1, ... }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxOverlayDefinition |
Required |
Fields of FxOverlayDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
placement |
"background"|"front"|"screen" |
Optional | Default background. screen sits above the fight and below the HUD. |
trigger |
"always"|"hit"|"critical"|"ko"|"final_ko"|"land"|"knockdown"|"wall"|"wall_break"|"wall_break_land"|"round"|"outro"|"outro_land"|"finisher"|"replay"|"replay_1"|"replay_2"|"replay_3" |
Optional | Screen overlays only. Default always. |
hold |
number |
Optional | 0-10 seconds a triggered screen overlay stays at full strength, default 0. |
duration |
number |
Optional | 0.02-10 seconds it then takes to leave, default 0.6. |
reveal |
number |
Optional | 0-5 seconds to draw it on from the left, default 0. |
slide |
number |
Optional | 0-1: 1 sweeps it off to the left instead of fading, default 0. |
blend |
"alpha"|"additive" |
Optional | — |
sprite |
string|SpriteHandle |
Optional | — |
color |
string |
Optional | #RRGGBB or #RRGGBBAA. |
alpha |
number |
Optional | 0-1, default 1. |
depth |
number |
Optional | 0-1 for background placement, default 0.3. |
x |
number |
Optional | Offset from the location centre. |
y |
number |
Optional | Offset from the location centre, up is positive. |
width |
number |
Optional | 0 covers the view. |
height |
number |
Optional | 0 covers the view. |
shape |
"rect"|"shaft"|"glow"|"band"|"slash"|"wash"|"reflection"|"blur" |
Optional | Built-in art used when no sprite is set. reflection mirrors what is drawn above the box; blur softens what is drawn behind it. Default rect. |
ripple |
number |
Optional | 0-1 reflection only: how much the mirror image wobbles, default 0.3. |
ripple_speed |
number |
Optional | 0.05-10 reflection only: wobbles per second, default 1. |
fade |
number |
Optional | 0-1 reflection only: how much it fades toward the far edge, default 0.7. |
reach |
number |
Optional | 1-8 reflection only: how much taller a slice of the scene it mirrors, squeezed into the box like streaks on a wet floor. Default 1. |
blur |
number |
Optional | 0-1 reflection and blur only: softness; blur 1 is about 14 pixels of a 1080-line picture. Default 0.3. |
sway |
number |
Optional | 0-2000 units the overlay drifts to either side, default 0. |
sway_speed |
number |
Optional | 0.01-10 sways per second, default 0.1. |
pulse |
number |
Optional | 0-1 slow breathing of the overlay size, default 0. |
pulse_speed |
number |
Optional | 0.01-10 breaths per second, default 0.5. |
angle |
number |
Optional | -180 to 180 degrees, default 0. |
flicker |
number |
Optional | 0-1 opacity waver, default 0. |
flicker_speed |
number |
Optional | 0.1-30, default 6. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
-- A fog bank drifting in front of the fighters' feet.sf2.fx.overlay { id = "fog_bank", match = { "swamp" }, placement = "front", shape = "band", color = "#D8E2EA", y = -215, width = 3600, height = 150, alpha = 0.16, sway = 160, sway_speed = 0.025,}In the background the overlay shares the parallax of the layer nearest depth; in
front it moves with the fighters’ layer and sits over them; placement = "screen"
sits above the fight and below the HUD. Without a sprite, shape picks built-in
art: rect, shaft, glow, band (good for fog), and for screen overlays
slash and wash. Positions are offsets from the location centre, up positive; a
width or height of 0 covers the whole view.
Reflections and depth of field
Section titled “Reflections and depth of field”Two shapes show the stage itself instead of drawing art. They read what has already been drawn behind the overlay, so where you place them decides what they show.
reflectionfills its box with an upside-down copy of what is drawn just above the box’s upper edge, like still water or a polished floor. In the background (on a lake’s layer) it reflects the scenery behind that layer but not the fighters, who are drawn later. Withplacement = "front"it draws after the floor and the walls in front of the fighters, so a box just below the floor line mirrors the fighters on a wet or polished floor.rippleandripple_speedmake it wobble,fadethins it toward the far edge,blursoftens it,colortints it andalphasets its strength. Stage floors are usually dark silhouettes, where a plain mirror of dark fighters and grass shows nothing. There, useblend = "additive"so only light reflects (lightning, glowing magic, lit edges) andreachof 3 to 5 so the short floor band mirrors a tall slice of the scene as long wet streaks.blursoftens everything drawn behind it, as a camera focused on the fighters would. Leave outwidthandheightto cover the whole view. Stack two at differentdepthvalues to blur the far scenery more than the near.
-- The lake mirrors the castle and sky behind it.sf2.fx.overlay { id = "lake_mirror", stages = { "castle_and_bridge_se" }, placement = "background", depth = 0.875, shape = "reflection", x = 0, y = -110, width = 2400, height = 90, alpha = 0.45, color = "#C8E0F0", ripple = 0.4, fade = 0.8, blur = 0.3,}-- Rain-soaked dark stone: lightning and glowing crystals streak across it.sf2.fx.overlay { id = "wet_floor", stages = { "chess_yard_se" }, placement = "front", shape = "reflection", blend = "additive", y = -216, width = 2600, height = 80, alpha = 0.6, reach = 4, color = "#9FB8E8", ripple = 0.3, blur = 0.5,}-- Distant layers drift out of focus.sf2.fx.overlay { id = "far_focus", placement = "background", depth = 0.85, shape = "blur", blur = 0.35, alpha = 1 }Each reflection or blur overlay reads the picture again when it draws, so use a few per
stage rather than dozens. They take no sprite and cannot be screen overlays.
Screen overlays
Section titled “Screen overlays”Sizes are in HUD units: the screen is 1536 tall and as wide as its aspect ratio
needs (2731 at 16:9). sf2.fx.screen grades do not affect screen
overlays, so colours survive a black-and-white knockout.
With a trigger, the overlay is hidden until it fires, shows for hold seconds,
then leaves over duration real seconds. reveal draws it on from the left;
slide = 1 sweeps it off to the left instead of fading.
sf2.fx.overlay { id = "knockout_slash", placement = "screen", trigger = "ko", shape = "slash", color = "#0A0606", alpha = 0.92, angle = -10, y = 40, reveal = 0.12, hold = 0.55, duration = 0.9,}More recipes in visual effects.
sf2.fx.sway
Section titled “sf2.fx.sway”Make painted stage pictures move: trees and grass bend in the wind, banners flutter, water ripples.
Signature: sf2.fx.sway { id = "...", images = { "..." }, anchor = "bottom", amount = 6, speed = 0.25, waves = 1, gust = 0.4, stages = { ... } }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxSwayDefinition |
Required |
Fields of FxSwayDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
images |
string[] |
Required | 1-64 stage picture names (as the stage layout names them) to move. |
anchor |
"bottom"|"top"|"left"|"right"|"none" |
Optional | The edge held still: bottom for trees and grass, top for hanging things, left or right for flags on a pole, none for water. Default bottom. |
amount |
number |
Optional | 0-400 stage units the free end moves, default 6. |
speed |
number |
Optional | 0.01-10 sways per second, default 0.25. |
waves |
number |
Optional | 0-40 ripples running along the picture, default 1. |
gust |
number |
Optional | 0-1 how unevenly the wind blows, default 0.4. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
-- The bamboo either side of the grove bends gently from its roots.sf2.fx.sway { id = "bamboo_wind", stages = { "bamboo_grove_se" }, images = { "_0010_bamboo_left", "_0009_bamboo_right" }, anchor = "bottom", amount = 10, speed = 0.18, gust = 0.5,}-- A banner held by its pole on the left ripples outward.sf2.fx.sway { id = "banner", stages = { "arena_se" }, images = { "_0028_banner_left" }, anchor = "left", amount = 4, speed = 0.6, waves = 1.5 }images are picture names as the stage layout writes them (its ClassName values); a
stage’s layout lists them. Every picture with one of those names on a matching stage
moves. Use stages, tags or match to say which stages.
anchor is the edge held still: bottom for trees, grass and bamboo, top for things
hanging from above, left or right for a flag on its pole, and none to move the whole
picture alike, as water does. amount is how far the free end travels, in stage units;
speed is sways per second; waves adds ripples running along the picture (0 bends it
as one piece); gust makes the wind rise and fall.
The picture is redrawn shifted, not reshaped, so keep amount small next to the picture’s
size: a few units for grass, about 10 for a tree. Only pictures that fill their own image
can sway; a picture cut from a shared atlas is left still, with a warning in the log. The
motion follows game time, so it slows in slow motion. Turning the effect’s setting off
puts the pictures back as they were.
sf2.fx.particles
Section titled “sf2.fx.particles”Create a particle effect, such as sparks, embers or falling leaves, behind or in front of the fighters.
Signature: sf2.fx.particles { id = "...", placement = "behind", color = "#RRGGBBAA", count = 100, ... }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxParticlesDefinition |
Required |
Fields of FxParticlesDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
placement |
"background"|"behind"|"front"|"node"|"hit"|"contact" |
Optional | Where particles appear: background (far scenery), behind or front (of the fighters, across the stage), node (follows a fighter node), hit (bursts where a hit lands), contact (bursts at landings, knockdowns, skids and wall impacts). Default behind. |
trigger |
"always"|"hit"|"critical"|"block"|"shock"|"guard_break"|"clash"|"perk"|"ko"|"final_ko"|"land"|"knockdown"|"slide"|"wall" |
Optional | Hit or contact placement. Default hit (or land). |
perks |
string|PerkHandle|(string|PerkHandle)[] |
Optional | guard_break and perk only. Up to 16 perks (core name such as “PERK_BLOCK_BREAKER”, perk ID or handle): a guard_break effect fires only for a guard break one of them caused, a perk effect only when one of them (or a copy made from it) shows or pulses its icon. Default: every guard break or perk. |
x |
number |
Optional | Location placements: area centre offset. |
y |
number |
Optional | Location placements: area centre offset, up is positive. |
speed |
number|{ [1]: number, [2]: number } |
Optional | -5000 to 5000 burst speed: number or { min, max }; negative speeds start on the ring at radius and fly in to the centre. Default 0. |
gravity |
number |
Optional | -5000 to 5000 downward pull on hit or contact particles, default 0. |
shape |
"dot"|"glow"|"ring"|"star"|"smoke"|"shard" |
Optional | Built-in particle art without a sprite, default dot. Not allowed together with sprite. |
stretch |
number |
Optional | 0-4: stretches each particle along its velocity (sparks, rain), default 0. |
grow |
number |
Optional | 0-8. End size as a multiple of start size. Default 1. |
interval |
number |
Optional | 0-30. Puffs count particles every interval seconds. Default 0. |
facing |
number |
Optional | Node particles: 1 makes velocity_x point the way the fighter faces, default 0. |
emit |
number |
Optional | Node particles: 0-1 share of the stream emitted, read every frame so sf2.fx.set can turn it off and on without clearing particles in the air. Default 1. |
node |
string |
Optional | Fighter node for placement = “node”, e.g. “Weapon-Node2_1”. |
fighters |
"both"|"player"|"opponent" |
Optional | — |
scenes |
"fights"|"everywhere" |
Optional | — |
blend |
"alpha"|"additive" |
Optional | — |
sprite |
string|SpriteHandle |
Optional | — |
color |
string |
Optional | #RRGGBB or #RRGGBBAA start colour. |
end_color |
string |
Optional | Colour at the end of each particle’s life. |
count |
number |
Optional | 1-1000, default 100. |
lifetime |
number|{ [1]: number, [2]: number } |
Optional | 0.05-60 seconds: number or { min, max }. Default { 6, 10 }. |
size |
number|{ [1]: number, [2]: number } |
Optional | 0.1-400: a number, or { min, max }. Default { 3, 6 }. |
velocity_x |
number|{ [1]: number, [2]: number } |
Optional | -2000 to 2000: number or {min,max}. Default {-10,10}. |
velocity_y |
number|{ [1]: number, [2]: number } |
Optional | -2000 to 2000: number or {min,max}. Default {-10,10}. |
noise |
number |
Optional | 0-500, default 5. |
spin |
number |
Optional | 0-1, default 0. |
depth |
number |
Optional | 0-1 for background placement, default 0.3. |
area_width |
number |
Optional | 0-2 x location width, default 1.1. |
area_height |
number |
Optional | 0-2 x location height, default 1.1. |
radius |
number |
Optional | Node emitter radius, default 20. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
-- Sparks thrown from the contact point of every unblocked hit.sf2.fx.particles { id = "hit_sparks", placement = "hit", trigger = "hit", blend = "additive", color = "#FFD27A", end_color = "#FF5A1E00", count = 10, lifetime = { 0.18, 0.35 }, size = { 2, 5 }, speed = { 250, 700 }, gravity = 900, radius = 4,}placement decides where particles appear:
background,behind,front: fill the location, on the layer nearestdepth, just behind the fighters, or in front of them.node(or justnode = "..."): stream from one skeleton node of each selected fighter and trail behind it. Menu previews show them only withscenes = "everywhere".hit: a burst ofcountparticles from the contact point of a hit, flying out atspeedand falling withgravity.fightersselects the fighter struck. A negativespeed(for example{ -400, -300 }) starts every particle on the ring atradiusand draws it in toward the centre instead; setlifetimeto aboutradius / speedso the particles fade as they arrive.contact: a burst where a fighter meets the floor or a wall.fightersselects the fighter that is moving.
A range field takes one number or { min, max }, picked per particle (the first
must not exceed the second). Take a sprite or a shape, not both. velocity_x
and velocity_y add to speed.
Node particles also take emit (0 to 1, default 1): the share of their stream they
give off. It is read every frame, so sf2.fx.set can turn an emitter
off and on again while particles already in the air finish their lives. That is
smoother than switching the whole effect off with enabled = false, which clears them.
-- Smoke off a fighter's shoulders while their shadow energy is full.sf2.fx.particles { id = "aura", node = "NNeck", fighters = "player", emit = 0, shape = "smoke", color = "#1A0C26A0", end_color = "#1A0C2600", count = 16, radius = 18, lifetime = { 0.9, 1.5 }, size = { 8, 16 }, grow = 2.6, velocity_y = { 35, 75 } }sf2.fx.on_frame(function(view) local ready = view.round_active and view.player and view.player.magic_ready sf2.fx.set("aura", { emit = ready and 1 or 0 })end)Hit triggers
Section titled “Hit triggers”With placement = "hit", trigger is hit, critical, block, shock, guard_break, clash, perk, ko or final_ko. shock fires on a hit that staggers the victim and knocks its weapon away, and guard_break on a hit the victim was guarding that a perk or a script let through; both fire together with hit. With guard_break, perks (one perk or up to 16: a core name such as "PERK_BLOCK_BREAKER", a perk ID or a handle) limits it to guard breaks those perks caused. final_ko fires on the knockout that decides the fight: the blow that empties a health bar when that round is the winner’s last one needed (every knockout in a one-round fight, the second round’s in a best-of-three). It never fires in Survival, and rounds ending on time or by a rule do not fire it. A deciding knockout fires ko too, so ko effects still play.
clash fires when two weapon attacks meet blade on blade and neither lands; the burst
comes from where the weapons crossed, and no hit, block or critical effect fires
for it. fighters selects the first of the two.
perk fires when a perk shows or pulses its icon over a fighter, which is the moment an
enchantment or perk takes effect; the burst comes from that fighter’s body, and fighters
selects it. Each enchantment shows its icon over the fighter it works on: Lifesteal,
Frenzy, Overheat and Shielding over their owner, Intoxication, Stun and Bleeding over the
opponent. List perks to pick which ones. A name also covers the copies made from it,
so "PERK_ITEM_SPECIAL_LIFESTEAL" matches the weapon, ranged and magic versions. With no
perks, every perk that shows an icon fires it, not only enchantments.
-- Stolen life drawn in from all round into the thief.sf2.fx.particles { id = "lifesteal", placement = "hit", trigger = "perk", perks = "PERK_ITEM_SPECIAL_LIFESTEAL", shape = "smoke", color = "#B01010C0", end_color = "#60080000", count = 16, radius = 140, speed = { -460, -320 }, lifetime = { 0.3, 0.42 }, size = { 6, 12 }, grow = 0.4 }Contact triggers
Section titled “Contact triggers”| Trigger | Fires when |
|---|---|
land (default) |
A fall of more than about 45 units ends on the floor. |
knockdown |
The body drops low while falling fast; at most once per 0.6 s per fighter. |
slide |
The feet skid along the floor; repeats about every 0.07 s, so keep count small. |
wall |
A wall-hit recoil starts. Fights only, not menu previews. |
sf2.fx.ambient_particles
Section titled “sf2.fx.ambient_particles”Choose the drifting background particles (dust, snow and so on) for each kind of stage.
Signature: sf2.fx.ambient_particles { density = 1, default_style = "dust", locations = { { tags = { "snow" }, match = { "word", ... }, style = "snow" } }, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
AmbientParticlesDefinition |
Required |
Fields of AmbientParticlesDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
density |
number |
Optional | 0-4, default 1. |
default_style |
"none"|"dust"|"snow"|"embers"|"petals" |
Optional | — |
locations |
ParticleLocationRule[] |
Optional | Up to 32 rules; the first match wins. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
sf2.fx.ambient_particles { default_style = "dust", locations = { { tags = { "snow" }, style = "snow" }, { match = { "autumn" }, style = "petals" }, }, setting = particles,}The first rule that fits the stage picks the style. A rule fits when the stage has
one of its stage tags, or one of its match
words is in the stage name. Names are lowercased and split on _, -, :, /,
spaces and digits, so new_year_24_china_dojo gives new, year, china, dojo.
Other stages use default_style.
sf2.fx.light
Section titled “sf2.fx.light”Create a coloured light that follows a weapon or fighter, glows and lights nearby surfaces.
Signature: sf2.fx.light { id = "...", source = "weapon", weapons = { "fire" }, color = "#FFB061", radius = 320, intensity = 1, fighter_light = 0.8, glow = 0.3, glow_size = 380, flicker = 0.15, flicker_speed = 8, fighters = "both", scenes = "fights", tags = { ... } }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxLightDefinition |
Required |
Fields of FxLightDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
source |
"weapon"|"magic"|"location"|"stage"|"sky"|"hit" |
Optional | What carries the light: weapon (equipped weapons), magic (while casting), location (a fixed point you place), stage (the stage’s own light), sky (sun or moon), hit (a flash where hits land). Default weapon. |
trigger |
"hit"|"critical"|"block"|"shock"|"guard_break"|"clash"|"perk"|"ko"|"final_ko" |
Optional | Hit lights only. Default hit. |
perks |
string|PerkHandle|(string|PerkHandle)[] |
Optional | guard_break and perk only. Up to 16 perks (core name such as “PERK_BLOCK_BREAKER”, perk ID or handle): a guard_break effect fires only for a guard break one of them caused, a perk effect only when one of them (or a copy made from it) shows or pulses its icon. Default: every guard break or perk. |
duration |
number |
Optional | 0.02-2 seconds a hit light takes to fade, default 0.12. |
x |
number |
Optional | Location lights: offset from the stage centre. |
y |
number |
Optional | Location lights: offset from the stage centre, up is positive. |
weapons |
string[] |
Optional | Weapon lights: lowercase words found in glowing weapon names. |
fighters |
"both"|"player"|"opponent" |
Optional | — |
scenes |
"fights"|"everywhere" |
Optional | — |
color |
string |
Optional | #RRGGBB light colour. Stage lights default to the stage’s own light colour. |
body_light |
number |
Optional | 0-1 shading of whole bodies, default 0. |
aim |
number |
Optional | 0-1 turns fighters’ lit edge to face this light, default 0. |
height |
number |
Optional | Sky lights: 10-2000 height above the floor of full strength, default 260. |
radius |
number |
Optional | 10-5000 reach in fighter units, default 320. |
intensity |
number |
Optional | 0-2, default 1. |
fighter_light |
number |
Optional | 0-1, default 0.8. |
glow |
number |
Optional | 0-1 stage glow opacity, default 0.3. |
glow_size |
number |
Optional | 1-5000, default 380. |
flicker |
number |
Optional | 0-1, default 0.15. |
flicker_speed |
number |
Optional | 0.1-30, default 8. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
-- Fire weapons glow orange and light the fighters.sf2.fx.light { id = "fire_weapons", source = "weapon", scenes = "everywhere", weapons = { "fire", "flame", "lava" }, color = "#FF8A3A", radius = 340, glow = 0.3, flicker = 0.25, flicker_speed = 9,}
-- A warm flash at every clean hit.sf2.fx.light { id = "hit_light", source = "hit", trigger = "hit", color = "#FFD7A0", radius = 520, intensity = 1.2, duration = 0.12,}source decides where the light sits:
weapon: each fighter whose weapon item name or subtype contains one of theweaponswords (any case) carries a light at each weapon hand.magic: a casting fighter’s magic hand, and every magic projectile until it ends.location: a fixed point atx,yfrom the stage centre, up positive.stage: the stage’s own key light, taken from its background art, so one light suits every stage including other mods’ stages. It uses the art’s colour unless you givecolor.sky: light from above that shades bodies only (setbody_light), nothing at the floor to full strengthheightunits up.hit: a flash at the contact point of each matching hit, fading overduration.triggerishit,critical,block,shock,guard_break,clash,perk,koorfinal_ko(see hit particles forshock,guard_break,clash,perkandperks);final_kofires on the knockout that decides the fight: the blow that empties a health bar when that round is the winner’s last one needed (every knockout in a one-round fight, the second round’s in a best-of-three). It never fires in Survival, and rounds ending on time or by a rule do not fire it. A deciding knockout fireskotoo, sokoeffects still play.
Each light draws a soft glow on the stage and lights every fighter within
radius with an edge on the side facing it; strength falls off with distance
squared and lights blend. The edge works with or without
sf2.fx.rim_light. With body_light above 0 the whole body is
shaded, not just the edge (the eight strongest such lights count). A light with
intensity = 0 and aim = 1 only steers the rim light.
sf2.fx.glint
Section titled “sf2.fx.glint”Create sparkles that travel along weapon blades at an interval you choose.
Signature: sf2.fx.glint { id = "...", interval = 3, duration = 0.35, size = 22, alpha = 0.9, max_speed = 250, color = "#FFF7E6", fighters = "both", scenes = "fights" }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxGlintDefinition |
Required |
Fields of FxGlintDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
fighters |
"both"|"player"|"opponent" |
Optional | — |
scenes |
"fights"|"everywhere" |
Optional | — |
color |
string |
Optional | #RRGGBB or #RRGGBBAA, default warm white. |
interval |
number |
Optional | 0.2-60 seconds, default 3. |
duration |
number |
Optional | 0.05-3 seconds, default 0.35. |
size |
number |
Optional | 1-400, default 22. |
alpha |
number |
Optional | 0-1, default 0.9. |
max_speed |
number |
Optional | 0-20000, default 250. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
sf2.fx.glint { id = "blade_glint", scenes = "everywhere", interval = 4, duration = 0.4, size = 26 }Every interval seconds or so a four-pointed star runs from the grip to the tip of
a weapon blade. It starts only while the tip moves slower than max_speed, so it
shows on a held weapon, not mid-swing. Bare hands never glint.
sf2.fx.trail
Section titled “sf2.fx.trail”Create a trail that follows a weapon, chosen body points or thrown weapons and magic as they move.
Signature: sf2.fx.trail { id = "...", weapon = true, color = "#RRGGBB", ... }, sf2.fx.trail { id = "...", nodes = { "NKnee_2", "NHeel_2" }, ... } or sf2.fx.trail { id = "...", projectile = true, width = 30, ... }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxTrailDefinition |
Required |
Fields of FxTrailDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
weapon |
boolean |
Optional | Trail the weapon blade. Use this, projectile or nodes. |
projectile |
boolean |
Optional | Trail every thrown weapon and magic missile while it flies, a ribbon width units across its path. Use this, weapon or nodes. Fights only. |
width |
number |
Optional | Projectile trails only: 1-400 stage units across the path, default 30. |
nodes |
string[] |
Optional | Exactly two node names: inner end, moving end. |
fighters |
"both"|"player"|"opponent" |
Optional | — |
scenes |
"fights"|"everywhere" |
Optional | — |
blend |
"alpha"|"additive" |
Optional | — |
color |
string |
Optional | Default follows the fighter colour. |
lifetime |
number |
Optional | 0.02-1 seconds, default 0.11. |
min_speed |
number |
Optional | Default 900. |
full_speed |
number |
Optional | Default 2600. |
alpha |
number |
Optional | 0-1, default 0.55. |
start_alpha |
number |
Optional | 0-1 at the inner end, default 0.35. |
weapons |
string[] |
Optional | Up to 32 lowercase words matched against the equipped weapon. |
end_color |
string |
Optional | #RRGGBB or #RRGGBBAA colour the trail shifts to as it ages. |
falloff |
number |
Optional | 0.25-4 opacity curve along the trail; 1 is linear. Default 1. |
ribbon |
number |
Optional | 0-1 multiplies the ribbon opacity; 0 draws only the edge or streaks, default 1. |
edge |
number |
Optional | 0-1 opacity of a crisp line along the path. Default 0. |
edge_width |
number |
Optional | 0.01-0.5 depth of the edge as a fraction of the line length, default 0.08. |
edge_color |
string |
Optional | #RRGGBB or #RRGGBBAA edge colour. Default the trail colour. |
thrust |
number |
Optional | 0-200 width of the streak behind stabs and lunges, default 0 (off). |
hit_flash |
number |
Optional | 0-2 opacity added when this fighter lands an unblocked hit, default 0. |
hit_linger |
number |
Optional | 0-1 extra seconds the newest trail stays after such a hit, default 0. |
streaks |
number |
Optional | 0-1 hair lines along the path that fray toward the inner end, leaving the tip solid, default 0 (off). |
erode |
number |
Optional | 0-1 how much the trail tears into wisps along its path as it ages, inner end first, default 0 (an even fade). |
soft_edge |
number |
Optional | 0-4 screen pixels the trail edges are feathered over, default 0 (hard edges). |
edge_cool |
number |
Optional | 0-1 how far an edge_color edge shifts toward end_color as it ages, default 0. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
sf2.fx.trail { id = "kick_trail", nodes = { "NKnee_2", "NHeel_2" }, fighters = "player", color = "#6FB8FF", blend = "additive", lifetime = 0.15, min_speed = 700,}
-- A blade trail that cools to red and leaves a crisp edge.sf2.fx.trail { id = "katana_cut", weapon = true, weapons = { "katana" }, falloff = 2.2, end_color = "#6A1A10", edge = 0.85, edge_width = 0.07,}
-- An ink brush stroke: hair lines inside, wisps as it fades, a lit edge that cools.sf2.fx.trail { id = "ink_cut", weapon = true, alpha = 0.9, start_alpha = 0.1, falloff = 1.8, lifetime = 0.15, end_color = "#6A1A10", edge = 0.95, edge_width = 0.05, edge_color = "#FFE8C8", edge_cool = 1, streaks = 0.7, erode = 0.8, soft_edge = 1.25,}A fading ribbon swept by a line on the fighter. Give exactly one of these:
weapon = true follows the weapon blade (each hand separately); nodes gives the inner
end first and the moving end second; projectile = true follows every thrown weapon and
magic missile while it flies (see below). It appears only while the moving end is faster than min_speed, reaching
full strength at full_speed (which must be greater). With weapons, the trail
runs only for a weapon whose item name or subtype contains one of the words.
Every armed fighter already swings with a built-in weapon trail, whose look follows
the weapon’s campaign mastery (the player picks it in the shop’s armory). A
weapon = true trail from a mod replaces the plain built-in trail on every fighter it
applies to, but a weapon showing mastery rank I or higher keeps its mastery look
instead. A nodes trail always adds to it.
The built-in trail’s shape comes from the weapon’s subtype: a katana leaves a thin
crescent, claws three rakes, a kusarigama chain links, a keris a wave, a hammer a
short wake past its head, and so on. At the base level it is painted in the colours
of the weapon’s shop icon; mastery looks keep their own colours. A mod weapon gets
the shape of the subtype it uses. Your sf2.fx.trail settings are never shaped this way.
lifetime and speeds use fight time, so trails last longer in slow motion and
hold still during hit-stop and pause. Trails on one fighter with the same blend
do not stack; the first registered wins where they overlap. A teleport or round
reset starts a fresh ribbon.
The look fields (falloff, ribbon, edge, thrust, hit_flash…) are
optional. ribbon = 0 hides the ribbon so a trail draws only an edge or streaks,
and hit_flash works even with alpha = 0. Edges draw on top of ribbons. Since
each trail can have its own setting, you can offer a switch per layer:
local edges = sf2.settings.toggle { id = "edges", label = "Blade edges", default = true }sf2.fx.trail { id = "blade_edge", setting = edges, weapon = true, ribbon = 0, edge = 0.85 }Ink looks. Three more optional fields change how the ribbon is drawn rather than its shape, and all default to 0, the plain gradient:
streaks(0 to 1) draws fine hair lines along the path, as a brush leaves. They fray the ribbon toward its inner end and leave the tip solid.erode(0 to 1) makes the ribbon tear into wisps along its path as it ages, the inner end first, instead of fading evenly. At 1 little of it is left by the end oflifetime.soft_edge(0 to 4) feathers the ribbon’s edges over that many screen pixels, so they stay smooth instead of stepped.
The pattern stays fixed to the ribbon as it sweeps, so it never crawls. With an
edge_color, edge_cool (0 to 1) shifts the edge toward end_color as it ages: a light
edge over a dark ribbon keeps a trail visible on dark stages too.
Projectile trails. With projectile = true the ribbon runs along the path of each
thrown weapon and magic missile in flight, width stage units across (1 to 400, default
30). Its middle, the line the projectile flies along, is the bright end, as a blade’s tip
is: start_alpha applies at the ribbon’s two outer edges, and an edge draws down the
middle. The ribbon narrows toward that line as it ages. It stops growing when the
projectile strikes or ends, and what was drawn fades over lifetime. Projectiles fly
slower than swings, so lower min_speed and full_speed (try 200 and 1200). fighters
picks the fighter who threw or cast it. Projectile trails exist only in fights, and
width is for projectile trails only.
sf2.fx.trail { id = "thrown", projectile = true, width = 36, lifetime = 0.2, min_speed = 200, full_speed = 1200, alpha = 0.85, start_alpha = 0, end_color = "#6A1A10", edge = 0.9, edge_color = "#FFE8C8", edge_cool = 1 }See visual effects for more on layering.
sf2.fx.stain
Section titled “sf2.fx.stain”Create blood, ash or other stains that splash and settle on the ground after hits.
Signature: sf2.fx.stain { id = "...", trigger = "hit", color = "#590808", alpha = 0.8, count = 3, size = { 10, 26 }, spread = 40, flatten = 0.35, limit = 60, speed = { 90, 210 }, gravity = 900, lift = 80, merge_radius = 16, max_pool_size = 120, sprite = handle, blend = "alpha", fighters = "both" }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxStainDefinition |
Required |
Fields of FxStainDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
trigger |
"hit"|"critical"|"ko"|"final_ko" |
Optional | Default hit. |
fighters |
"both"|"player"|"opponent" |
Optional | — |
color |
string |
Optional | #RRGGBB or #RRGGBBAA, default dark red. |
sprite |
string|SpriteHandle |
Optional | — |
blend |
"alpha"|"additive" |
Optional | — |
alpha |
number |
Optional | 0-1, default 0.8. |
count |
number |
Optional | 1-12 per hit, default 3. |
size |
number|{ [1]: number, [2]: number } |
Optional | 1-400: a number, or { min, max }. Default { 10, 26 }. |
spread |
number |
Optional | 0-400, default 40. |
flatten |
number |
Optional | 0.1-1, default 0.35. |
limit |
number |
Optional | 1-200 landed pools kept, default 60. |
speed |
number|{ [1]: number, [2]: number } |
Optional | 0-2000 arena units/s: number or { min, max }. Default 0. |
gravity |
number |
Optional | 50-5000 arena units/s squared, default 900. |
lift |
number |
Optional | 0-1000 upward arena units/s, default 80. |
merge_radius |
number |
Optional | 0-400 arena units, default 0 (no accumulation). |
max_pool_size |
number |
Optional | 1-1600 arena units, default 120. Must be at least the largest size when merging. |
detail |
number |
Optional | 0-1. Above 0 uses detailed art. Default 0. |
stretch |
number |
Optional | 0-4. Detailed stains: how far sideways drops spatter. Default 0. |
spread_time |
number |
Optional | 0-10 seconds a landed pool takes to spread to full size, default 0. |
age_time |
number |
Optional | 0-300 seconds over which a pool darkens toward age_color, default 0. |
age_color |
string |
Optional | #RRGGBB colour pools darken toward, default dried brown. |
sheen |
number |
Optional | 0-1 wet highlight that dulls as the pool ages. Default 0. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
sf2.fx.stain { id = "hit_stains", color = "#4A0606", count = 3, size = { 8, 20 }, limit = 50, speed = { 90, 210 }, gravity = 900, lift = 90, merge_radius = 16, max_pool_size = 70,}sf2.fx.stain { id = "knockout_stain", trigger = "ko", count = 5, size = { 20, 42 } }Leaves splats on the floor under matching hits; blocked hits never stain. trigger is hit, critical, ko or final_ko. final_ko fires on the knockout that decides the fight: the blow that empties a health bar when that round is the winner’s last one needed (every knockout in a one-round fight, the second round’s in a best-of-three). It never fires in Survival, and rounds ending on time or by a rule do not fire it. A deciding knockout fires ko too, so ko effects still play.
With the default speed = 0, count splats appear straight below the contact
point, scattered up to spread either side. With a positive maximum speed,
visible droplets fly along the strike direction, rise by lift, fall under
gravity and splat where they cross the floor (spread then adds sideways speed).
Critical hits launch 1.25x faster and knockouts 1.5x. Flight follows game time.
Landed splats are flattened by flatten, sit over the floor art but behind the
fighters’ feet, and last until the next round. Without a sprite, three built-in
splat shapes are picked at random.
merge_radius above zero makes pools accumulate: a landing joins the nearest
unsaturated pool of the same effect within that distance until max_pool_size
(at least the largest size), then a new pool starts. limit caps landed pools,
removing the oldest. Turning off the effect’s setting clears its stains.
sf2.fx.shadow
Section titled “sf2.fx.shadow”Tune the shadow drawn under fighters.
Signature: sf2.fx.shadow { id = "...", alpha = 0.45, width = 150, height = 28, fade_height = 350, min_scale = 0.35, color = "#000000", fighters = "both" }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
FxShadowDefinition |
Required |
Fields of FxShadowDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string |
Required | 1-64 lowercase letters, digits, _ or -; unique within the mod. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off. |
tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags the effect is limited to. Default: every stage. |
exclude_tags |
("day"|"dusk"|"night"|"dark"|"indoor"|"fire"|"lamps"|"otherworld"|"rain"|"snow"|"mist"|"heat"|"foliage"|"petals"|"water"|"raid")[] |
Optional | Stage tags; the effect never runs on stages with one of them. |
match |
string[] |
Optional | Lowercase location-name words; the effect runs only where one matches. Prefer tags. Default: everywhere. |
exclude |
string[] |
Optional | Lowercase location-name words; the effect never runs where one matches. |
stages |
(string|LocationHandle)[] |
Optional | Exact stages the effect runs on: names such as “moon_se”, core:locations/ IDs or location handles. Up to 64. Default: every stage. |
fighters |
"both"|"player"|"opponent" |
Optional | — |
color |
string |
Optional | #RRGGBB or #RRGGBBAA, default black. |
alpha |
number |
Optional | 0-1, default 0.45. |
width |
number |
Optional | 1-2000, default 150. |
height |
number |
Optional | 1-1000, default 28. |
fade_height |
number |
Optional | 1-5000, default 350. |
min_scale |
number |
Optional | 0-1, default 0.35. |
Returns: The effect’s name, <mod-id>.<id>.
When: Loading.
sf2.fx.shadow { id = "contact_shadow", alpha = 0.42, width = 150, height = 26, fade_height = 320 }A soft oval under the fighter shrinks toward min_scale as it rises and fades out
at fade_height. The floor is the lowest point any fighter has reached, so it
settles once they stand. A standing fighter is about 300 units tall, which helps
when sizing width and height.
sf2.fx.bloom
Section titled “sf2.fx.bloom”Tune the glow that bright areas of the screen give off.
Signature: sf2.fx.bloom { threshold = 0.82, knee = 0.12, intensity = 0.7, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
BloomDefinition |
Required |
Fields of BloomDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
threshold |
number |
Optional | 0-2, default 0.82. |
knee |
number |
Optional | 0-1, default 0.12. |
intensity |
number |
Optional | 0-4, default 0.7. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
sf2.fx.bloom { threshold = 0.85, intensity = 0.6, setting = bloom }Pixels brighter than threshold glow, with knee softening the cut-off. It
affects the whole picture, so bright background art glows too; raise threshold
to limit it to effects.
On stages that are mostly bright, such as snowfields, the glow fades automatically
(down to 15% of intensity) so it does not wash them out. The halation and
god_rays of sf2.fx.screen adapt the same way.
sf2.fx.rim_light
Section titled “sf2.fx.rim_light”Tune the bright edge light drawn around fighters.
Signature: sf2.fx.rim_light { offset = 2.5, alpha = 0.85, lighten = 0.35, warmth = 0, softness = 0, key_light = 0, ink = 0, ink_color = "#12081C", setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
RimLightDefinition |
Required |
Fields of RimLightDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
offset |
number |
Optional | 0-12 pixels, default 2.5. |
alpha |
number |
Optional | 0-1, default 0.85. |
lighten |
number |
Optional | 0-1, default 0.35. |
warmth |
number |
Optional | 0-1 warm ivory tint, default 0; preserves peak brightness. |
softness |
number |
Optional | 0-3 screen pixels of outer feathering, default 0. |
key_light |
number |
Optional | 0-1. Shifts fight colour toward the stage key light. Default 0. |
ink |
number |
Optional | 0-1: rim turns to ink_color while casting magic, default 0. |
ink_color |
string |
Optional | #RRGGBB or #RRGGBBAA ink colour. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
sf2.fx.rim_light { offset = 2.5, alpha = 0.85, lighten = 0.35, warmth = 0.65, softness = 1.25, ink = 0.85, ink_color = "#1A0C26", setting = rim }Draws a thin lit edge on each fighter’s upper-left side, coloured from the stage’s
farthest background layer and brightened by lighten. With key_light it uses the
colour of the brightest light in the stage art instead. With ink above 0 the rim
eases to ink_color while the fighter casts magic, then back. Lights from
sf2.fx.light also affect the edge.
sf2.fx.ink_lines
Section titled “sf2.fx.ink_lines”Draw a thin lit line inside each fighter’s shadow where a limb or the weapon crosses the body.
Signature: sf2.fx.ink_lines { strength = 0.8, step = 12, width = 1.2, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
InkLinesDefinition |
Required |
Fields of InkLinesDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
strength |
number |
Optional | 0-2 brightness of the line, default 0.8. |
step |
number |
Optional | 4-80 fight units two parts must be apart in depth, bone to bone, default 12. |
width |
number |
Optional | 0.5-4 fight units the line reaches in from the edge, default 1.2. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
local lines = sf2.settings.toggle { id = "ink_lines", label = "Inner ink lines", default = false, heavy = true }sf2.fx.ink_lines { strength = 0.55, step = 12, width = 1, setting = lines }A fighter is a flat shadow, so an arm held in front of the chest disappears into it. With this effect the shadow keeps its shape, its colour and its rim, and a thin line in the rim’s colour marks the edge of a limb, or of the weapon in the fighter’s hands, that stands in front of another part of the same fighter: an arm over the chest, one leg over the other, a blade or a shaft across the body. The line is brighter on the side facing the stage’s light, and a crossing that is only just deep enough shows faintly.
The lines follow the fighter’s limbs and weapon, not what the fighter wears. Armor and robes are drawn over the lines as part of the shadow and get none of their own, and thin strands such as headband tails are ignored. Nothing is drawn along the fighter’s outline; that stays the rim’s.
step is how far apart in depth two parts must be, measured between their bones in
fight units (a fighter is about 210 units tall). At the default the fingers of one
hand count as one part, a weapon is one with the hand that grips it, and separate
limbs are not. Raise it to keep only the widest crossings. width is how far in
from the edge the line reaches, in fight units, and strength is its brightness.
While the effect is on, every fighter’s parts are sorted by depth and the depth of
the limbs and weapons is drawn to a full-size texture each frame, so mark its switch
heavy.
The knockout finisher draws these lines on its turned fighters
even while the setting is off.
sf2.fx.depth_haze
Section titled “sf2.fx.depth_haze”Add a distance haze that fades far stage layers toward the fog colour.
Signature: sf2.fx.depth_haze { strength = 0.4, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
DepthHazeDefinition |
Required |
Fields of DepthHazeDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
strength |
number |
Optional | 0-1, default 0.4. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
sf2.fx.depth_haze { strength = 0.35, setting = haze }Fades background layers toward the colour of the farthest layer; the farther the layer, the stronger the haze. The fighters’ layer and the foreground are never hazed.
sf2.fx.background_depth
Section titled “sf2.fx.background_depth”Add a gentle parallax shift to stage backgrounds so they feel deeper.
Signature: sf2.fx.background_depth { strength = 0.6, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
BackgroundDepthDefinition |
Required |
Fields of BackgroundDepthDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
strength |
number |
Optional | 0-2, default 0.6. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
sf2.fx.background_depth { strength = 0.6, setting = depth }Each background layer’s parallax factor (about 0.1 far, 1 floor) becomes
factor ^ (1 + strength), so far layers move proportionally less. The fighters’
layer and everything in front of it keep their normal movement.
sf2.fx.impact
Section titled “sf2.fx.impact”Tune the radial blur and colour split that give hits and critical hits their weight.
Signature: sf2.fx.impact { critical = 1, head = 0.6, shock = 0.4, duration = 0.3, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
ImpactDefinition |
Required |
Fields of ImpactDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
critical |
number |
Optional | 0-1, default 1. |
head |
number |
Optional | 0-1, default 0.6. |
shock |
number |
Optional | 0-1, default 0.4. |
duration |
number |
Optional | 0.05-2 seconds, default 0.3. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
-- No blur on head hits and shocks, keep it on critical hits.sf2.fx.impact { critical = 1, head = 0, shock = 0, setting = impact }Adds a short blur when a hit effect plays. critical is also scaled by the
player’s Critical hit shake slider; head and shock by Hit shake.
sf2.fx.knockout_outro
Section titled “sf2.fx.knockout_outro”Tune the slow zoom and pause that play when a fighter is knocked out.
Signature: sf2.fx.knockout_outro { final_only = false, hold = 0.5, lead = 0.3, zoom = 1.7, zoom_time = 0.8, offset_y = -60, snap = 0, hide_hud = false, replay = 0, replay_speed = 0.35, replay_passes = 3, orbit_glow = 0.5, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
KnockoutOutroDefinition |
Required |
Fields of KnockoutOutroDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
hold |
number |
Optional | 0-3 seconds the winner holds its idle stance after a knockout, default 0.5. |
zoom |
number |
Optional | 1-3 how far the camera closes in on the winner, default 1.7. |
zoom_time |
number |
Optional | 0.05-3 seconds to close in, default 0.8. |
lead |
number |
Optional | 0-3 seconds the win pose plays before the camera starts closing in, default 0.3. |
focus_time |
number |
Optional | Legacy, accepted for older mods; no effect. |
offset_y |
number |
Optional | -400 to 400 camera pan during the close-up; positive raises the framing, default -60. |
snap |
number |
Optional | 0-1. 0 eases evenly; 1 whips onto the winner. Default 0. |
hide_hud |
boolean |
Optional | true hides the fight HUD and on-screen controls for the close-up, default false. |
final_only |
boolean |
Optional | true plays the close-up only after the knockout that decides the fight (never in Survival); other rounds go straight to the end stance. Default false. |
replay |
number |
Optional | 0-5 seconds before the deciding knockout replayed in slow motion once the winner settles, with its hit effects; any key skips it. Default 0 (off). |
replay_speed |
number |
Optional | 0.1-1 speed of the replay, default 0.35. |
replay_passes |
number |
Optional | 1-3 times the blow plays, each pass firing its own replay_1 to replay_3 trigger for its shot. Default 3. |
orbit_glow |
number |
Optional | 0-1 strength of the soft light behind the fighters while a replay grade swings the camera round them. Default 0.5. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
local outro = sf2.settings.toggle { id = "outro", label = "Knockout close-up", default = true }-- Replay the blow that wins the fight three times once the winner settles, then close-- in on the winner.sf2.fx.knockout_outro { hold = 0.6, zoom = 1.8, replay = 0.9, replay_speed = 0.55, replay_passes = 3, final_only = true, setting = outro }
-- Cinema bars for the whole close-up.sf2.fx.screen { id = "outro_bars", setting = outro, trigger = "outro", letterbox = 0.11, hold = 10, duration = 0.6 }
-- Each replay pass in faded colour, the second from its own shot.sf2.fx.screen { id = "replay_look", setting = outro, trigger = "replay", saturation = 0.3, grain = 0.4, letterbox = 0.12, hold = 10, duration = 0.02 }sf2.fx.screen { id = "replay_close", setting = outro, trigger = "replay_2", camera_dolly = 0.45, camera_focus = 0.9, camera_roll = -10, hold = 10, duration = 0.02 }After a knockout the winner holds idle for hold seconds, then starts its win
pose. lead seconds into the pose the camera closes in over zoom_time seconds,
framing the winner alone, and the whole stage stays close until the next round. If
the knockout ends the fight, the result screen opens over the close-up.
offset_y is in tens of units; positive shows more above the winner’s head. snap
0 eases evenly, 1 whips in and overshoots zoom slightly.
sf2.fx.screen grades with trigger = "outro" start with the
close-up and "outro_land" ones as the zoom arrives. A short win pose can end
before the camera arrives; lower lead or zoom_time if so. final_only = true (default false) plays the close-up only after the knockout
that decides the fight, the same rule as the final_ko trigger; on other rounds
the fight goes straight to the native end stance, and Survival never plays it.
hide_hud = true hides the fight HUD during the close-up. Both are boolean flags. Only knockout wins get
the outro, never time-outs, ring-outs, rule endings or versus matches, and it never
changes who wins. Times stretch with slow motion. focus_time is accepted for old
mods and does nothing.
Finisher. The stop on the blow that wins the fight, with the camera swinging round the
fighters, is an effect of its own: sf2.fx.knockout_finisher. It
plays before the outro, and with hide_hud = true here the HUD stays hidden from that stop on
into the close-up.
Replay. replay (0 to 5 seconds, default 0, off) replays the knockout that
decides the fight, as fighting games show a finishing blow. Once the winner settles,
before the hold, the fight stops and its last replay seconds before the knockout,
and the fall just after it, play replay_passes times (1 to 3, default 3) at
replay_speed (0.1 to 1, default 0.35), each time with their hit effects and blood.
The HUD and controls hide, any key or tap skips it, and the fight then carries on
from where it stopped. Screen effects with trigger = "replay" dress the whole
replay; "replay_1", "replay_2" and "replay_3" each fire for one pass, so every
pass can have its own camera shot, including one that swings the camera around the
fighters (camera_orbit in sf2.fx.screen); orbit_glow (0 to 1, default
0.5) is how strong the soft light behind the fighters is while it does, and 0 turns it
off. All of them end with what they belong to, so give
them a long hold and a short duration. A short replay (under a second) shows
just the blow. Projectiles and effects attached to a fighter do not show in the
replay. Survival, versus matches and title sparring never replay.
sf2.fx.knockout_finisher
Section titled “sf2.fx.knockout_finisher”Stop the fight dead on the blow that wins it, so the camera can swing round the fighters.
Signature: sf2.fx.knockout_finisher { hold = 1.5, beat = 0, ring = 0, debris = 0, glow = 0.5, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
KnockoutFinisherDefinition |
Required |
Fields of KnockoutFinisherDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
hold |
number |
Optional | 0.1-5 seconds the fight stops dead on the blow that decides it, the instant it lands, firing the finisher trigger; the effects of that blow play once the fight moves again. Default 1.5. |
beat |
number |
Optional | 0-0.5 seconds the stopped blow shows side-on before a camera_orbit grade starts its swing; added to hold. Default 0. |
ring |
number |
Optional | 0-1 brightness of a ring of light standing round the blow, which opens into a hoop round the fighters as the camera swings. Default 0 (off). |
debris |
number |
Optional | 0-80 bits hanging in the air round the blow, each at its own depth. Default 0 (off). |
glow |
number |
Optional | 0-1 strength of the soft light behind the fighters while the camera is swung round them. Default 0.5. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
local finisher = sf2.settings.toggle { id = "finisher", label = "3D finishing blow", default = true }-- Stop for 1.5 seconds on the blow that wins the fight. The blow shows for a beat before-- the camera leaves it, with a ring of light and 30 bits hanging in the air around it.sf2.fx.knockout_finisher { hold = 1.5, beat = 0.08, ring = 0.8, debris = 30, setting = finisher }
-- While the fight stands still, the camera is flung round the fighters, keeps circling,-- and whips back side-on just as the stop ends.sf2.fx.screen { id = "finisher_swing", setting = finisher, trigger = "finisher", camera_orbit = 34, camera_sweep = 18, camera_attack = 0.4, hold = 0.9, duration = 0.6 }
-- A flash marks the blow.sf2.fx.screen { id = "finisher_flash", setting = finisher, trigger = "finisher", brightness = 0.45, hold = 0, duration = 0.3 }The finisher stops the fight dead on the blow that decides it, the instant it lands. For
hold seconds (0.1 to 5, default 1.5) the fighters hold the pose of the impact, the camera
holds its shot, particles hang in the air and the HUD steps aside. Screen effects with
trigger = "finisher" dress the stop and end with it, so give them a long hold and a short
duration. One with camera_orbit swings the camera round the fighters in 3D (see
“Orbiting the finishing blow” in sf2.fx.screen).
It is an effect of its own, with its own setting, so players can switch it apart from the
knockout close-up. It plays with or without one: with a close-up the
outro follows the stop, and without one the game’s own end stance does.
| Field | Range | Default | What it does |
|---|---|---|---|
hold |
0.1 to 5 | 1.5 | Seconds the fight stands still on the blow. |
beat |
0 to 0.5 | 0 | Seconds the stopped blow is shown from the side before a camera_orbit grade starts its swing, so the hit is seen landing before the camera leaves it. It is added to hold. Every other finisher grade, and every sound, still starts the instant the fight stops, so a short flash lands on the blow itself. |
ring |
0 to 1 | 0 | How bright a thin ring of light around the blow is. It stands upright across the blow, so from the side it is a line; as the camera swings round it opens into a hoop that passes behind one fighter and in front of the other. It widens fast, then creeps. |
debris |
0 to 80 | 0 | How many small bits hang in the air around the blow, thrown mostly the way the blow went. Each has its own depth, so near ones cross far ones as the camera moves. They creep outward while the stop lasts. |
glow |
0 to 1 | 0.5 | How strong the soft light in the air behind the fighters is while the camera is swung round them. It keeps dark fighters readable against a dark stage. 0 turns it off. |
While the camera is swung round them the fighters stay flat ink silhouettes, unlit, as
they are side-on. If your mod configures sf2.fx.ink_lines, its lines
show on the turned fighters even while that effect’s own setting is off, so limbs crossing
the body stay readable.
The ring, the bits and the glow only show while a grade with camera_orbit or
camera_sweep turns the fighters. The ring and the bits take the stage’s light colour (some
bits take the fighters’ ink colour) and need a blow with a contact point, which every strike
has. A finisher grade with camera_focus turns the shot to the point where the blow landed,
sideways and in height.
The game’s own hit spark and hit sound play as the blow lands. Everything your effects show
for that blow waits until the fight moves again, then starts from its beginning: its hit,
critical, ko and final_ko grades and their sounds, hit particles, hit lights and stains.
The fight stops only once the round has ended on that blow, in the same instant it lands, so
it never stops for a blow that does not win: the loser must be knocked out by a strike, with
the winner still standing, and the knockout must decide the fight. A knockout from bleeding
or poison, a double knockout and a time-out play as usual. The stop cannot be skipped, and
pausing the game pauses it. With hide_hud = true in
sf2.fx.knockout_outro the HUD stays hidden from the stop on into
the close-up. Survival, versus matches and title sparring never stop.
sf2.fx.smooth_camera
Section titled “sf2.fx.smooth_camera”Ease the fight camera: gliding framing, a look-ahead, soft arena ends, blended shots and a shake that follows each blow’s weight.
Signature: sf2.fx.smooth_camera { follow = 0.12, zoom_out_time = 0.12, zoom_in_time = 0.5, zoom_dead_zone = 0.01, lead = 0.2, lead_max = 50, edge = 80, push_time = 0.08, shot_blend = 0.08, impact_shake = 1, shake_roll = 0.3, shake_decay = 1.1, freeze_lean = 0.03, idle_drift = 0, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
SmoothCameraDefinition |
Required |
Fields of SmoothCameraDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
follow |
number |
Optional | 0-1 seconds the view takes to catch up sideways, default 0.12; 0 does not smooth it. |
zoom_out_time |
number |
Optional | 0-1 seconds the zoom takes to widen as the fighters part, default 0.12. |
zoom_in_time |
number |
Optional | 0-3 seconds the zoom takes to close back in as they come together, default 0.5. |
zoom_dead_zone |
number |
Optional | 0-0.2 share of the zoom a zoom in must pass before the view follows it, default 0.01. |
lead |
number |
Optional | 0-1 seconds of sideways motion the view looks ahead of the fight, default 0.2. |
lead_max |
number |
Optional | 0-200 stage units the look-ahead goes at most, default 50. |
edge |
number |
Optional | 0-400 stage units before the end of the arena where the view starts to slow, default 80. |
push_time |
number |
Optional | 0-0.5 seconds sf2.fx.screen zoom push-ins take to follow, default 0.08. |
shot_blend |
number |
Optional | 0-0.5 seconds cinematic camera_* shots take to follow, so shots glide into each other, default 0.08. |
impact_shake |
number |
Optional | 0-2 strength of the impact shake that replaces the native shake, default 1; 0 keeps the native shake. |
shake_roll |
number |
Optional | 0-3 degrees the impact shake tilts the picture at full strength, default 0.3. |
shake_decay |
number |
Optional | 0.2-6 shake strength lost each second, default 1.1. |
freeze_lean |
number |
Optional | 0-0.15 how much closer the view leans in on the struck fighter during a hit freeze, default 0.03. |
idle_drift |
number |
Optional | 0-6 stage units of slow handheld drift while nothing else moves the camera, default 0 (off). |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
local smooth = sf2.settings.toggle { id = "smooth_camera", label = "Smooth camera", default = true }sf2.fx.smooth_camera { zoom_in_time = 0.55, edge = 90, idle_drift = 1.2, setting = smooth }
-- A push-in that eases in instead of cutting (zoom_attack works with or without this preset).sf2.fx.screen { id = "finisher_push", trigger = "final_ko", zoom = 1.4, zoom_offset_y = -55, zoom_attack = 0.12, hold = 0.3, duration = 2.8 }The fight’s own camera jumps with the fighters: it works its zoom out afresh every frame
from how far apart they stand, push-ins from sf2.fx.screen cut straight
in, and the view stops dead at the end of the arena. With this effect on, the camera
follows the same framing smoothly instead. Every follow is critically damped: it settles
in about the time you give it and never swings past its target, so nothing bounces. A
time of 0 turns that part’s smoothing off.
Framing. follow is how long the view takes to catch up sideways. The zoom has two
times: zoom_out_time for zooming out as the fighters part (keep it short, so nobody
leaves the picture) and zoom_in_time for easing back in as they close. A zoom in smaller
than zoom_dead_zone (a share of the zoom, 0.01 is 1%) is ignored, so the view does not
breathe in and out with an idle stance. lead looks ahead: the view sits this many
seconds of the fight’s sideways motion ahead of where it is going, at most lead_max
stage units. edge is how many stage units before the end of the arena the view starts
to slow; it comes to rest on the same limit as before instead of hitting it. However the
camera lags or leads, both fighters stay in the picture.
Push-ins and shots. push_time eases every screen effect’s zoom, zoom_offset_y
and turn toward a fighter. shot_blend eases the cinematic camera’s camera_* shots:
a shot glides in, a shot that restarts carries on from where it was, and when a stronger
shot takes over the camera moves from one to the other instead of cutting. A new round
is the exception: the fight cuts to it, so its opening shot starts at full strength.
Shake. With impact_shake above 0, the game’s own sine-wave shake is replaced by an
impact shake of that strength. Every blow adds to one shake strength that drains away by
shake_decay a second, and what you see is that strength squared: a light hit barely
moves the picture, a critical lands hard, and a flurry builds up. It moves in smooth
noise, tilts the picture by up to shake_roll degrees, and the first instant of a blow
throws the picture along the blow’s path. The game’s criticals, head hits, shocks and
perk and wall-break shakes feed it by their size, and every other hit and block adds a
little. The player’s hit and critical shake sliders scale it as they scale the game’s
shake. impact_shake = 0 keeps the game’s shake.
Hit freeze and drift. While the game freezes on a critical or a shock, the camera
leans in on the struck fighter by up to freeze_lean (0.03 is 3% closer) and lets go
as the fight moves again. idle_drift gives the view a slow handheld drift of up to
about that many stage units while nothing else moves the camera; 0, the default, turns
it off.
A script that controls the camera itself (see
Combat scripting) sets the centre and zoom it asks for,
and the camera glides back to the fight’s framing when the script lets go. The knockout
close-up (sf2.fx.knockout_outro) keeps its own timing.
sf2.fx.screen shake and close_up work as before on top of it. The
effect changes only what is drawn, never the fight, and does nothing on the title screen.
sf2.fx.ink_hud
Section titled “sf2.fx.ink_hud”Restyle the health bars and HUD in black lacquer and gold leaf, with low-health and knockout cues.
Signature: sf2.fx.ink_hud { quiet = 0.45, quiet_delay = 3, low_health = 0.3, timer_warning = 10, knockout_wash = 0.85, setting = handle }
Parameters
| Parameter | Type | Required |
|---|---|---|
definition |
InkHudDefinition |
Required |
Fields of InkHudDefinition
| Field | Type | Required | Meaning |
|---|---|---|---|
quiet |
number |
Optional | 0-1 opacity between exchanges; 1 never dims. Default 0.45. |
quiet_delay |
number |
Optional | 0.5-30 seconds without hits before quieting, default 3. |
low_health |
number |
Optional | 0-0.9 share of the last bar below which the frame pulses red, default 0.3. |
timer_warning |
number |
Optional | 0-60 seconds left when the timer turns red, default 10. |
knockout_wash |
number |
Optional | 0-1 how far the HUD and controls fade during the knockout, default 0.85. |
setting |
SettingHandle |
Optional | Switch that turns the effect on and off; without one it is always on. |
Returns: Nothing.
When: Loading.
local hud = sf2.settings.toggle { id = "ink_hud", label = "Lacquer HUD", default = true }sf2.fx.ink_hud { quiet = 0.55, setting = hud }Bars, markers, names, timer and hit texts get the lacquer look while active. Fight
meters (fighter:set_meter and perk meters) always
have it, with or without this effect. Hit
and style callouts (“HEAD HIT!”, “COMBO”, “HARD!”) are written in the game’s own
lettering over a short brush stroke, in the style meter’s colours; their words are
the hud.callout.* text keys.
The timer pulses red in its last timer_warning seconds, and a fighter on their
last bar below low_health gets a pulsing red frame. After quiet_delay seconds
without hits the style meter and perk icons settle to quiet opacity. At a
knockout the HUD fades by knockout_wash, then returns. Portraits, buttons and
perk icon art are not replaced; turning the setting off restores the normal HUD
at once.
The versus card before a campaign fight is redrawn to match: paper for its ground, one vermilion brush stroke for its red band, an ink “VS” and larger avatars. The “VS” lands with a shake and a spatter of ink, the names sweep in along the stroke and the avatars lean toward each other while the card holds. Its layout and its length stay the same. The row of opponents shown before a fight with several of them (Survival, gauntlets) sits on the same paper. This is decided as each screen opens, so switching the setting takes effect from the next fight.
sf2.fx.set
Section titled “sf2.fx.set”Change values of an effect you registered, such as its alpha or whether it is enabled.
Signature: sf2.fx.set(effect, values)
Parameters
| Parameter | Type | Required |
|---|---|---|
effect |
string |
Required |
values |
FxLiveValues |
Required |
Fields of FxLiveValues
| Field | Type | Required | Meaning |
|---|---|---|---|
enabled |
boolean |
Optional | false hides the effect until set back to true or reset. |
[string] |
number|{ [1]: number, [2]: number } |
Required | A numeric effect field. Range fields take a number or {min,max}. |
Returns: Nothing.
When: After registration, often in an sf2.fx.on_frame handler.
sf2.fx.set("fog_bank", { alpha = 0.3 }) -- thicker fogsf2.fx.set("rain_near", { enabled = false }) -- stop the rainsf2.fx.set("sparks", { speed = { 200, 400 } }) -- ranges take { min, max }values holds numeric fields of the effect, checked against the same ranges as at
registration, plus enabled. Colours, shapes, triggers and sprites cannot change.
Changes last until sf2.fx.reset or the next fight.
Screen grades, lights, overlays and trails apply new numbers at once. Particle
emitters and stains read most of theirs only when built, but enabled always
works. An always-on screen grade cannot be given zoom, shake or a time_scale
below 1.
sf2.fx.play
Section titled “sf2.fx.play”Start a screen effect that is set to run only when your script asks for it.
Signature: sf2.fx.play(effect, options?)
Parameters
| Parameter | Type | Required |
|---|---|---|
effect |
string |
Required |
options |
FxPlayOptions |
Optional |
Fields of FxPlayOptions
| Field | Type | Required | Meaning |
|---|---|---|---|
x |
number |
Optional | Arena X, finite -10000..10000, that the zoom frames. Omit to keep the camera centre. |
Returns: true if the grade started, false if its setting is off, its match/exclude rule rules out the stage, or no presentation is running.
When: After loading, usually in a combat callback. Calling again restarts the grade.
-- During loading:local stall = sf2.fx.screen { id = "stall", trigger = "script", saturation = 0.2, vignette = 0.75, hold = 0.3, duration = 1.1, time_scale = 0.3, zoom = 1.3, zoom_offset_y = -40, sound = "snd_time_shift",}-- Inside a combat callback:local view = fighter:snapshot()if view then sf2.fx.play(stall, { x = view.self.position.x }) endoptions.x is the arena X the camera push-in frames, for example the fighter’s
snapshot().self.position.x. Hold and duration use real time. See
visual effects.
sf2.fx.reset
Section titled “sf2.fx.reset”Put an effect back to the values it was registered with.
Signature: sf2.fx.reset(effect)
Parameters
| Parameter | Type | Required |
|---|---|---|
effect |
string |
Required |
Returns: Nothing.
When: After registration.
sf2.fx.reset("fog_bank")Undoes every sf2.fx.set change and switches the effect on again.
Every fight also starts from the registered values.
sf2.fx.on_frame
Section titled “sf2.fx.on_frame”Run a function several times a second during fights to change effects as the fight develops.
Signature: sf2.fx.on_frame(handler, options?)
Parameters
| Parameter | Type | Required |
|---|---|---|
handler |
fun(view: FxFrameView) |
Required |
options |
FxFrameOptions |
Optional |
Fields of FxFrameView
| Field | Type | Required | Meaning |
|---|---|---|---|
round |
number |
Required | Round number. |
time |
number |
Required | Seconds of fight time. |
round_active |
boolean |
Required | True while the round is being fought. |
outro |
number |
Required | Knockout close-up progress: 0 without one, rising to 1 as it frames the winner. |
location |
string |
Optional | Location name. |
player |
FxFrameFighter |
Optional | — |
opponent |
FxFrameFighter |
Optional | — |
distance |
number |
Optional | Horizontal distance between the fighters. |
Fields of FxFrameOptions
| Field | Type | Required | Meaning |
|---|---|---|---|
rate |
number |
Optional | 1-30 calls per second, default 10. |
Returns: Nothing.
When: Register once per mod while loading; handler(view) then runs in fights, options.rate times a second (1-30, default 10), not while paused.
-- A vignette that pulses like a heartbeat below a third of health.local danger = sf2.fx.screen { id = "danger", vignette = 0, accent = "#B01010", accent_width = 0.06 }
sf2.fx.on_frame(function(view) if not view.player then return end local peril = math.max(0, 1 - view.player.health_fraction / 0.33) local beat = math.max(0, math.sin(view.time * (1.2 + peril * 1.4) * math.pi * 2)) ^ 6 sf2.fx.set(danger, { vignette = math.min(1, peril * (0.45 + beat * 0.25)), accent_strength = peril })end, { rate = 10 })Read view and react with sf2.fx.set or sf2.fx.play.
The view is a fresh copy each call; editing it changes nothing.
| Field | Meaning |
|---|---|
round, time |
Round number; seconds of fight time. |
round_active |
true while the round is being fought. |
outro |
Progress of the knockout close-up, 0 to 1. |
location |
The location’s name. |
player, opponent |
health, max_health, health_fraction (0-1), arena x, magic (shadow energy, 0-1; 1 while a cast is charged) and magic_ready (true while a cast is charged). |
distance |
Horizontal distance between the fighters. |
A handler that errors or runs too long is switched off for the session.