Skip to content

Play non-looping effects of a PFX controller once per trigger - #1084

Open
pieterdeschepper wants to merge 1 commit into
Try:masterfrom
pieterdeschepper:pfxcontroller-one-shot
Open

pieterdeschepper wants to merge 1 commit into
Try:masterfrom
pieterdeschepper:pfxcontroller-one-shot

Conversation

@pieterdeschepper

@pieterdeschepper pieterdeschepper commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

In the Gothic 1 Sleeper temple, each spawn of demons and undead orc priests triggers a zCPFXControler with MFX_SPAWN_CAST.PFX (EVT_TPL_07_PFX_01, EVT_TPL_08_PFX_01, EVT_TPL_16_PFX_01, EVT_TPL_XARDASSPAWN_PFXCONTR_01). That effect has one emission key at 1 FPS and no ppsIsLooping, so it should flash for about a second. PfxController always called setLooped(true), so after the first trigger the flare kept emitting forever. The state is also saved and restored on load.

Change

PfxController::isOneShot() is true when the effect has emission keys (prefferedTime>0) and no ppsIsLooping. For such effects:

  • The emitter isn't looped.
  • onTrigger creates a fresh emitter, so each trigger plays the effect from its first key. Before, an emitter that had already played stayed "active" but emitted nothing.
  • load doesn't reactivate it. Existing saves with the stuck flare load without it.

Controllers with looping or key-less effects behave as before.

Testing

Gothic 1 on macOS (Apple M3 Pro):

  • A save in the temple's room 16 that showed the permanent flare now loads without it.
  • New spawns flash once and fade.

I tested in a local build.

🤖 Generated with Claude Code

PfxController always looped its effect, so one-shot effects such as
MFX_SPAWN_CAST (the flare when the Gothic 1 temple spawns demons and
orc priests) kept emitting forever after the first trigger.

Effects with emission keys and no ppsIsLooping now play once: each
trigger restarts them from the first key, and they are not reactivated
when a save is loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant