riconuts / FNF-Troll-Engine

43 stars 21 forks source link

custom substate in a song #40

Closed Rice1367 closed 2 months ago

Rice1367 commented 2 months ago

Describe your problem here.

I'm not sure if this covers the topic of "or using the engine", but idk) Sorry for the dumb question, but how can I open a customSubstate in the middle of a song? Like a pauseSubstate. Or is this not something that is currently supported? I've previously been looking at things like the substates folder file found in the assets of the latest version of tgt and the cutscenes script, but I think it's a bit outdated compared to the way the engine works in the most recent versions among other things. I've been able to open a substate with the 'game.openSubState' function, but I haven't been able to get the variable defined as a 'HScriptedSubstate' to find the file, or whatever it's supposed to do.

Are you modding a build from source or with scripts?

Scripts

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

No response

riconuts commented 2 months ago

the tgt cutscene substate is outdated yeah To make a custom substate you need to make a script for it on your mods substates folder, let's name it CustomSubstate.hscript Now, to create an instance of that substate, you'd write HScriptedSubstate.fromFile("CustomSubstate") As you've already figured it out you can open it with game.openSubState.

Unless you wrote anything on the script you might not see any visible effect. You can find an example and some notes on how to write state/substate scripts on the example_content extension states folder.

Rice1367 commented 2 months ago

the tgt cutscene substate is outdated yeah To make a custom substate you need to make a script for it on your mods substates folder, let's name it CustomSubstate.hscript Now, to create an instance of that substate, you'd write HScriptedSubstate.fromFile("CustomSubstate") As you've already figured it out you can open it with game.openSubState.

Unless you wrote anything on the script you might not see any visible effect. You can find an example and some notes on how to write state/substate scripts on the example_content extension states folder.

oh yeyy thank you very much, it was just a bit of confusion on my part of not knowing where to locate the file and have the script find it