Skip to content

[Sonic Frontiers] Any code using the Lua library makes Kronos's tutorial end immediately (events, cutscenes and Ancient Gates break) #277

Open

Description

@cjranno2010

With any code enabled that uses the Lua library (for example Tutorial Skip or Enhanced Homing Attack Rebound), Kronos's tutorial on a new save ends almost as soon as the island loads. Its tutorial steps then never run, which means:

the in-engine event where enemies spawn in front of the ruins (before the Ninja) doesn't play
the cutscene after the Ninja doesn't play, and the Ninja's Ancient Gate (Gate 2) never opens
the statue Island Mystery's door cutscene doesn't play, and its Ancient Gate (Gate 0) never opens, even though the puzzle itself registers (GimmickInfo 25)
the save reaches story sequence 10 within a few minutes
With no Lua-library code enabled, the same mod setup plays the tutorial normally.

Likely cause

Lua.Update() registers and initialises a ScriptSequenceManager (InitScriptSequenceManager with the BuildLevel hash, then RegisterScriptSequenceManager) whenever the game mode changes and the manager has no sequences. On Kronos that manager appears to run the island's story sequences as well. A trace taken from it (line hooks that buffer each script line, read back with Lua.Call) shows this on a new save:

w1r03_sequence05 | function OrderSequence()
w1r03_sequence05 | StartClearCheck()
w1r03_sequence10 | function OrderSequence()
In w1r03_sequence05.lua, the only StartClearCheck() at the top of OrderSequence is inside if (GetDebugFlag("isTutorialEnable")) == 0 then. So in that sequence the flag reads 0, the tutorial counts as cleared, and the story moves to sequence 10. Story progress is shared, so the game's own sequence follows and none of the tutorial quests run. I haven't confirmed why the flag reads 0 there, or whether the game's own manager is replaced or runs alongside it.

Environment

Sonic Frontiers 1.42 (Steam, exe timestamp 0x676BAE3A)
Linux, Proton Experimental, HedgeModManager 8.0.0-beta7, HE2ModLoader 1.4.0
Note: the Resources hook is patched locally (mov rdx, rax after GetResourceInfo; see the separate Resources issue), since without that the game crashes at startup with any code on.
Steps to reproduce

Enable Gameplay/Open Zone/Tutorial Skip or Physics/Enhanced Homing Attack Rebound. Any code with #lib "Lua" should do.
Start a New Game (answer No to Tutorial Skip's prompt if it's on).
Play to the area before the Ninja. The enemy-spawn event doesn't play, and after the Ninja its gate doesn't open.
Disable those codes, start another New Game: the event, cutscenes and gates all work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions