Naninovel MasterAudio BGM

Share custom commands, script functions, actor implementations and other Naninovel plug-ins you've created.
Post Reply
witchstudios
Posts: 1
Joined: 31 Aug 2020 23:35

Naninovel MasterAudio BGM

Post by witchstudios »

WHY?
When using the stock @startBGM @stopBGM you will notice that when you use @goto the music stops :(
If you want your music to play throughout the story, including saving the music state and reloading it, look no further!

Using MasterAudio

Download: https://gofile.io/d/p2HXRb (MusicHookNani.rar) Unzip this and put it in your games scripts section (doesnt have to be in naninovel folders)

Usage:
@MasterPlay group:foo - Plays the masteraudio group foo, multiple calls will stop the previous music.
@MasterStop - Stops all music

Setup, without following these steps it will NOT work:

  1. Create a MasterAudio Prefab with MasterAudio
  2. Create your music groups and Make all music groups use a new BUS called NaniBGM <-- this name is case sensitive
    PICTURE
  3. Create this CustomVariable
    PICTURE
  4. Attach the script TitleScript.cs to your TitlePrefabUI
  5. Add onSHow callback to TitleScript.cs
    See picture for steps 4 and 5

when you want to play a bgm across multiple scripts
@MasterPlay group:music-group-a
Now the music music-group-a is playing
@MasterPlay group:now-group-b
And at this moment music-group-a stopped and now-group-b is playing!

Elringus
admin
Posts: 521
Joined: 11 May 2020 18:03

Re: Naninovel MasterAudio BGM

Post by Elringus »

Hey, Thanks for sharing the extension!

Just wanted to mention, that you can prevent resetting the played music on @goto by either disabling Reset on Goto in state configuration or using the goto command in the following way:

Code: Select all

@goto ScriptName reset:IAudioManager,ICustomVariableManager

— the above will prevent resetting the audio and custom variable managers when loading another script. You can find more info about why most of the built-in services are reset on goto by default in the guide: https://naninovel.com/guide/engine-serv ... et-on-goto

Post Reply