Forum rules - please read before posting.

Original background not showing after running Naninovel custom action

Hello!

I'm pretty new to both Adventure creator and Naninovel but I was able to get them set up pretty quick. The issue I'm having is that when I run a custom action to play a Naninovel script, the background doesn't return to what it originally was before the action ran, when the action is fone. Instead I'm left with a black screen with no background. Just the UI of Adventure creator

What brings the issue:

Hotspot2d ➪ Custom Action ➪ Play Naninovel script named "Mirror" (Turn off Ac: Enabled. Swap camera: Disabled)

"Mirror" Naninovel script:
back Bath
chat Test
Test: Hello world!
turnOnAC
stop

In the Naninovel background configuration, Bath is set to an image called "Bathroom 3"

The same background is also used normally for that area. As in, it's the background that you see in the scene before running the action, if that makes sense.

Naninovel Engine Configurations:
Override Objects Layer: Enabled
Oblects Layer: Naninovel (number 11)
Initialize on Application Load: Disabled
Show Title UI: Disabled

Unity Version: 2021.3.25f1
AC Version: 1.77.3
Naninovel Version: 1.18.2

Comments

  • Welcome to the community, @Paesant.

    Keep the "Bathroom 3" sprite showing in its Inspector - what happens to it when the issue occurs?

    If you can share a video or screenshots that show both the background and the ActionList involved, I can try to spot what's wrong.

    It may be a case of Naninovel hiding the assigned background automatically once it completes. Try either removing the "back Bath" property, or duplicating the "Bathroom 3" sprite object and having Naninovel use the copy instead.

  • Thanks for the response! @ChrisIceBox

    Okay when i played the game with the "Bathroom 3" sprite showing in the inspector, it showed no change when the issue occured.

    Here are some screenshots of the background im using and the actionlist editor, along with the naninovel script
    https://imgur.com/a/jxav1Zp

    (i havent used imgur before this so let me know if there's an issue with the link)

    I've tried removing the "back Bath" property but when i do that, i get a grey background when the action runs, which is what made me add the property in the first place.

    I also tried your suggestion of making a copy of the background image for naninovel to use which worked but also made me realize a whole other issue. The issue being that if i clicked on the hotspot again after running it a first time, only the text will show up. No background or character.

    So:

    Click "mirror" hotspot -- runs naninovel script perfectly -- goes back to AC
    Click "mirror" again -- runs only the text part of the script -- goes back to AC

    Also although the suggestion of making a duplicate background for Naninovel did seem to work, it does seem a bit tedious to make a copy of all my backgrounds considering i have quite a bit.

  • Thanks for the details - the images are showing just fine.

    We can come up with a workaround to help keep any necessary changes to a minimum, but we'll first need to learn exactly what's going on in the first place.

    Double-check that the background isn't being modified in some way after the script runs. It may help to pause the game and compare both that and the Camera - it may be a small detail that's hard to spot, but there will be some change being made for the background to become hidden.

    I'm not too familiar with Naninovel, but I suspect that Naninovel is automatically hiding the "back" object once its script ends - as it may be assuming that this should only be shown while the script is running.

    You may wish to contact Naninovel's developer for confirmation of this - as the integration was written on their side - but if that's the case, I'd say the two potential workarounds would be either:

    1. Use a script to keep the background enabled at all times
    2. Unset the "back Bath" property, and get rid of the grey background

    If you try removing this property again, pause the game once the grey appears and try to spot where it's coming from. Has a new "grey" background object appeared in the Hierarchy?

  • Sorry for the delayed reply @ChrisIceBox !

    I checked the camera and background multiple times and can say that they aren't being modified when the script runs.

    I made a video of a brand new project with everything from my settings with naninovel to the action list and custom script so you can analyze it as well. Here it is
    https://youtu.be/jagWBWx1DxY

    You can see the problems i mentioned which are:
    -Background being grey when i first run the script without the "back" element
    -The original background being hidden when i use the "back" element with the same image as the one in the scene
    -The naninovel script not working properly

  • Thanks for the video - though I can't find the point at which the original background is hidden. It looks like the game ends before it's shown at 8:28. Am I looking in the wrong place?

    When the background becomes grey, it looks like it's still initialising - as the cursor has the spinning "load" icon next to it. The mirror script hasn't yet run, because it should only kick in once you click on the Hotspot, so it may be related to Naninovel's startup process.

    I'm wondering the image in the scene being the same as the one in the script is a red herring - as it looks like Naninovel uses its own reference to the texture, rather than identifying the background object in the scene. You could test this by having the script refer to a different background to the one in the scene.

    This behaviour doesn't look to be coming from the AC side of things, however. I would recommend you get in touch with Naninovel's developers, who should be able to shed some light on this.

  • I got in touch with the developers and turns out your solution of making a duplicate background sprite to use for naninovel is the way to go. That was what was suggested for people who don't have much experience with C# so thank you for taking the time to help with this!

    I have another question if thats alright to ask.

    Since i am using naninovel as a drop in dialogue system, i thought it would make sense to have the main menu in AC bring up the naninovel UI instead, for example, the "Load game" button bringing up naninovel's load game ui and so on. The problem is that i haven't been able to figure out how to connect those pieces together.

    Naninovel has its own prefabs for such screens and here's an example of how they're called with scripts in their "subtitle ui"

    Load button to call load screen:
    `namespace Naninovel.UI
    {
    public class ControlPanelLogButton : ScriptableLabeledButton
    {
    private IUIManager uiManager;

        protected override void Awake ()
        {
            base.Awake();
    
            uiManager = Engine.GetService<IUIManager>();
        }
    
        protected override void OnButtonClick ()
        {
            uiManager.GetUI<IPauseUI>()?.Hide();
            uiManager.GetUI<IBacklogUI>()?.Show();
        }
    } 
    

    }
    `
    I know adventure creator has its own code to use such as "Using AC;" and such but i'm really not familiar with c# at all which is why i have AC in the first place haha ^^'

  • edited June 2023

    UI Buttons in AC menus don't necessarily need to be linked to the Menu Manager as "Button elements".

    If your Pause menu uses Unity UI as its Source, then you can remove them from the Menu's list of elements, and attach Naninovel's own Button components (e.g. ControlPanelLogButton) to the Button GameObjects instead.

    If you're only using Naninovel to handle dialogue, however, it may be best to continue to use AC's save system - and include any additional Naninovel-related data in AC save-files through custom script. How exactly this would be done would be based on what needs saving, however.

    If you can share details on exactly how you'd like the save system to work, I can advise further.

  • I just want it to function like a regular old save system, just like it does now. In regards to Naninovel related data, I would like if it saved the Naninovel scripts in the game if it doesn't already.

    Also since it would be best to use AC's save system instead, then how would I make the button in Naninovel's prefabs (which are made using Unity's UI system) open AC's menus instead?
  • I would like if it saved the Naninovel scripts in the game if it doesn't already.

    I'm not sure if Naninovel's integration for AC includes this already. If not, it'd be a case of serializing its data into an AC Global String variable before saving, and then de-serializing that string after loading.

    A tutorial on this topic can be found here, which Naninovel's developers might welcome if they're looking to incorporate this feature into their integration.

    Also since it would be best to use AC's save system instead, then how would I make the button in Naninovel's prefabs (which are made using Unity's UI system) open AC's menus instead?

    If you're using Unity UI, you can have them run AC ActionList assets by setting the UI Button's "On Click" event to trigger the ActionList's Interact function. This will cause the ActionList to run when clicked.

    As part of that ActionList, you can use the Menu: Change state Action to turn on an AC menu.

  • edited June 2023

    My apologies, i didnt word that correctly. What i mean was for Adventure creator to handle saving like Naninovel does when running scripts, for example:

    https://imgur.com/a/8nSQhEe

    The first image shows Naninovel's save UI.

    The second one shows when i run the save in the second slot, it takes me back to the point in the naninovel script i saved at.

    For example:
    Script:
    Hello everyone!
    Look its raining
    Today is a gloomy day
    Let us jump in puddles

    If i save at "Hello everyone" and continue playing till i reach "Let us jump in puddles" and then load the save file, it takes me back to "Hello everyone" with the script still active. Thats the naninovel save system.

    But with adventure creator, if i use it's save system during the script and then try to load it to that same point, i guess it refreshes the scene? The load file just loads the scene without the naninovel script playing, like it never started running at all. (Third photo)

    So i was wondering if Adventure Creator's saving system could save that particular information like Naninovel does

  • Thanks for clarifying.

    FWIW: The easiest approach would be to prevent saving while Naninovel dialogues are running.

    Otherwise, it would be a case of instructing AC what kind of custom data you want to incorporate into its save-system.

    Alternatively, if you wanted to use Naninovel's save system, you'd instruct Naninovel with custom AC data to incorporate.

    Which option you'd take would mainly depend on how you're looking to use the two together.

    If you're mainly using Naninvoel, with AC handling Hotspot interactions to trigger dialogues, the latter may be a viable choice.

    If you're mainly using AC, with Naninovel just handling dialogues, the former may be best.

    If you can share details on how you're using the two assets together, I can give more detailed advice.

  • I'm mostly just using Naninovel for dialogue while AC handles everything else like hotspots, cut scenes, menus, etc.

    I would honestly just like if i could use adventure creator to handle everything in the game (including dialogue) so i wouldn't have to worry about things like this but the game i'm working on has visual novel elements and visual novels usually have certain things like this:

    [https://imgur.com/a/92vWBQz](https://imgur.com/a/92vWBQz "https://imgur.com/a/92vWBQz")

    A dialogue ui with buttons such as "skip", "history", "save" etc, which i know can be made with ac's menu elements but for some reason, if you have speech set to "can be skipped with mouse clicks" then those menu button elements won't be able to be clicked which is unfortunate.

    Also i don't think adventure creator has a way to see the text history of conversations at any point in the game or a way to set a button to automatically play text forward if the setting was originally "can be skipped with mouse clicks", or to show the choice menu while the dialogue ui is still on screen or a way to hide all ui on screen and then have them reappear when the mouse button is clicked.

    Which is unfortunate because Adventure creator would make for a great visual novel tool if it had these features.
  • While I'd maintain that it should still viable to include Naninovel-related data in AC save-games (with the assistance of Naninovel's developers), most of those should be possible with a little scripting. If you're happy to take things a little step-by-step, I think things could be improved.

    First of all, you will indeed need to uncheck Can skip with mouse clicks? to be able to click Menu Buttons without automatically skipping speech. That doesn't limit speech-skipping, however - an input named "SkipSpeech" can be defined to serve the same purpose.

    Rather than defining this input, you can instead have AC simulate its clicking by setting a Button element's Click type to Simulate Input. Using this, you can relegate the skipping of speech lines to an on-screen Button rather than a key/mouse-click.

    For "History", you'd need to rely on a custom script that records each line as it's spoken. What you do with such records will depend on how you want the "History" button to look and function, but the Chat log script on the AC wiki does something along these lines:

    https://adventure-creator.fandom.com/wiki/Chat_log

    An "Auto" button could be achieved by using another script to increase the speed at which lines are scrolled/displayed. We can look into that, but let's get the above working first and take things from there.

  • show the choice menu while the dialogue ui is still on screen

    To add: this is possible by inserting a [hold] tag at the end of your speech text.

    This tag will cause the speech to continue to display once its ended, so that Conversation menus can appear alongside it. A tutorial can be found here.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.