Skip Title
Posted: 27 Oct 2021 23:30
by moonrise
Is it possible with naninovel to skip the title screen all together? I'm making a game with one save slot. My preferred flow is this:
Open game
#Title
If never set settings (settings_set = False):
if saved_game_exist:
#New Game
;Actual start of the new game, No save menu, game only uses quick save to keep track of progress
So I've tried this on my own, but I'm coming across errors. First my custom UI Settings doesn't pause the game on the menu. It just continues to the Title UI :(. Also don't know how to set up a global variable that whenever the program is 1st run it checks to see if the settings were set by a person.
Haven't tackled the the loading the quick save or checking to see if there's a save, but one step at a time.
Any advice would be appreciated.
Re: Skip Title
Posted: 28 Oct 2021 09:39
by idaot
You can disable Show Title UI in the Engine configuration.
In the Scripts configuration, you can add a Start Game Script where you can do a conditional check (https://naninovel.com/guide/naninovel-s ... -execution) for whether a global variable is set to true (or if you prefer to do it via C#, then you can easily check this via the AnyGameSaveExists method) If set to false, you can perform @showUI TitleUI and then @set the global variable to true.
You may need a little bit of C# to access the save state. This can be achieved via a custom command (https://naninovel.com/guide/custom-comm ... om-command) and by utilising the LoadGameAsync method via the IStateManager engine service (https://naninovel.com/guide/engine-serv ... e-services)
Let me know if you need more help.
Re: Skip Title
Posted: 28 Oct 2021 23:20
by moonrise
So I created a clean slate.
In Naninovel>Engine I unchecked the Show Title UI.
In Naninovel>Scripts I put in an initialized script to start playing the game.
Code: Select all
# Set Settings
Have you played before?
; Have not turned this into a if statement yet.
@choice "Yes" goto:Base.ReadGame
@choice "No"
@stop
Have you set the settings?
; Not sure what I'm writing wrong on this if statement. It says Custom Variable "False" doesn't exist.
@if setsettings==False
;Have not turned the variable above to a global variable yet.
You have not set the Settings
@showUI SettingsUI
; Above line crashes the game with Sustem.NullReferenceException
@set setsettings=True
@endif
# NewGame
Hello, world. Testing 1,2,3
@title
;Above line works fine.
#ReadGame
Let's load the game.
@showUI SaveLoadUI
;Above line errors
@stop
I keep getting this error when I try to show the UIs. Am I setting up the file wrong?
Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object
at Naninovel.Commands.ShowUI+<ExecuteAsync>d__3.MoveNext () [0x00048] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Command\ShowUI.cs:37
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9577ac7a62ef43179789031239ba8798>:0
at Naninovel.UniTaskCompletionSource.Naninovel.Async.IAwaiter.GetResult () [0x0001f] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskCompletionSource.cs:89
at Naninovel.UniTask.GetResult () [0x00001] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:46
at Naninovel.UniTask+Awaiter.GetResult () [0x00000] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:213
at Naninovel.ScriptPlayer+<ExecuteIgnoringCancellationAsync>d__130.MoveNext () [0x00037] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\ScriptPlayer\ScriptPlayer.cs:596
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9577ac7a62ef43179789031239ba8798>:0
at Naninovel.UniTaskCompletionSource.Naninovel.Async.IAwaiter.GetResult () [0x0001f] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskCompletionSource.cs:89
at Naninovel.UniTask.GetResult () [0x00001] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:46
at Naninovel.UniTask+Awaiter.GetResult () [0x00000] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:213
at Naninovel.ScriptPlayer+<ExecutePlayedCommandAsync>d__128.MoveNext () [0x003c1] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\ScriptPlayer\ScriptPlayer.cs:556
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9577ac7a62ef43179789031239ba8798>:0
at Naninovel.UniTaskCompletionSource.Naninovel.Async.IAwaiter.GetResult () [0x0001f] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskCompletionSource.cs:89
at Naninovel.UniTask.GetResult () [0x00001] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:46
at Naninovel.UniTask+Awaiter.GetResult () [0x00000] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:213
at Naninovel.ScriptPlayer+<PlayRoutineAsync>d__131.MoveNext () [0x002b0] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\ScriptPlayer\ScriptPlayer.cs:620
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9577ac7a62ef43179789031239ba8798>:0
at Naninovel.UniTaskCompletionSource.Naninovel.Async.IAwaiter.GetResult () [0x0001f] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskCompletionSource.cs:89
at Naninovel.UniTask.GetResult () [0x00001] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:46
at Naninovel.UniTask+Awaiter.GetResult () [0x00000] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:213
at Naninovel.UniTaskExtensions+<ForgetCore>d__19.MoveNext () [0x0001b] in E:\Unity Game Projects\New Unity Project\Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskExtensions.cs:195
UnityEngine.Debug:LogError(Object)
Naninovel.Async.UniTaskScheduler:PublishUnobservedTaskException(Exception) (at Assets/Naninovel/Runtime/Common/Async/UniTask/UniTaskScheduler.cs:65)
Naninovel.Async.CompilerServices.AsyncUniTaskVoidMethodBuilder:SetException(Exception) (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs:29)
Naninovel.<ForgetCore>d__19:MoveNext() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskExtensions.cs:195)
Naninovel.Async.CompilerServices.MoveNextRunner`1:Run() (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:147)
Naninovel.UniTaskCompletionSource:TrySetException(Exception) (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:176)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetException(Exception) (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:60)
Naninovel.<PlayRoutineAsync>d__131:MoveNext() (at Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:603)
Naninovel.Async.CompilerServices.MoveNextRunner`1:Run() (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:147)
Naninovel.UniTaskCompletionSource:TrySetResult() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:165)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetResult() (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:75)
Naninovel.<WaitForWaitForInputDisabledAsync>d__126:MoveNext() (at Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:523)
Naninovel.Async.CompilerServices.MoveNextRunner`1:Run() (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:147)
Naninovel.UniTaskCompletionSource:TrySetResult() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:165)
Naninovel.ScriptPlayer:SetWaitingForInputEnabled(Boolean) (at Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:428)
Naninovel.ScriptPlayer:DisableWaitingForInput() (at Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:509)
Naninovel.InputSampler:SetInputValue(Single) (at Assets/Naninovel/Runtime/Input/InputSampler.cs:229)
Naninovel.InputSampler:<SampleInput>g__SampleObjectTriggers|43_3() (at Assets/Naninovel/Runtime/Input/InputSampler.cs:149)
Naninovel.InputSampler:SampleInput() (at Assets/Naninovel/Runtime/Input/InputSampler.cs:106)
Naninovel.<SampleInputAsync>d__24:MoveNext() (at Assets/Naninovel/Runtime/Input/InputManager.cs:168)
Naninovel.Async.CompilerServices.MoveNextRunner`1:Run() (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.Async.Internal.ContinuationQueue:RunCore() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ContinuationQueue.cs:193)
Naninovel.Async.Internal.ContinuationQueue:EarlyUpdate() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ContinuationQueue.cs:153)
Naninovel.Async.Internal.ContinuationQueue:Run() (at Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ContinuationQueue.cs:100)
Re: Skip Title
Posted: 29 Oct 2021 09:26
by idaot
@showUI SettingsUI and SaveLoadUI should work by default, make sure they've been added to the UI resources (added by default). If the error persists, then right click the script and choose to Re-import. Do the same with the Naninovel folder under Assets.
As for the variable, you need to define/set a value before running a check, otherwise it'll return an error. You can define a variable via Custom Variables configuration. To make it global, just simply add a g_ prefix.
Re: Skip Title
Posted: 29 Oct 2021 22:34
by moonrise
I'm starting to think that it might be my version of Unity. I was using 2019.4.12f1. I have the newest installed 2021.1.26f1 now. I will try and see if that fixes the errors.
-EDIT: So I updated my version and things are working. :) Thank you for your help. Just two things I'm still a little confused on.
Re: Skip Title
Posted: 30 Oct 2021 18:03
by idaot
So you'll likely want to create a custom command, this guide has a simple template called HelloWorld that contains code for a custom @hello command: https://naninovel.com/guide/custom-comm ... om-command.
Naninovel has several state-management methods available via the IStateManager.cs engine service, you can read about them here: https://naninovel.com/guide/engine-serv ... e-services
In your case, you'll want to use either QuickLoadAsync() or LoadGameAsync("slotId"). I suggest checking out SaveLoadMenu.cs or ControlPanelQuickLoadButton.cs for examples of how state loading is handled using both methods.