Forum rules - please read before posting.

[SOLVED] Dialogue System problem with local variables

edited August 2014 in Technical Q&A
Heyo,

In the final scene of my game is an NPC that you need to talk to to progress the game. You click on him and a cutscene runs that switches the camera and starts a conversation (using the Dialogue System For Unity plugin).

When I test my game in Unity, everything works totally fine.
When I get to the same point in the (Windows) build, the camera switches like it should, but the conversation doesn't start.

The crazy thing is, if I uncheck every other scene in my game and make a new build that goes straight to this one, the conversation DOES work!

After that I tried moving the scene to the top with the other scenes still enabled, and it worked then too, so somewhere something in one of the earlier scenes is fucking with it. Which is weird because everything to do with starting that convo is governed by local variables only.

Tearing my hair out haha. Any ideas? cc @pixelcrushers

Comments

  • edited August 2014
    Alright woof I've narrowed the problem down to it being a problem with the way Dialogue System handles local variables.

    There is a boolean in this scene called firstrun. This is to keep track of whether this is the first time you are having a conversation with this character. From the start the conversation forks into two paths; one gets triggered if firstrun is true and the other when firstrun is false.

    I made a debug menu with a label that displays the value of [localvar:0] (aka firstrun) to see if something fishy was going on, but it reads the value fine and it is set to true. So that means at least one of the two conversation paths should trigger. And no matter how much I click on the character, it doesn't get set to false, so that means the conversation doesn't even get past the first line.

    BUT ONLY if you've played through any other scene previously. If you start the build straight into this scene it does work. And if I remove the variable check on one of the two paths it also works.

    :-/

    p.s. if I test a different scene in Unity and play up to this scene the problem also occurs, so it's not an editor vs. build thing like I initially thought.
  • Hi, I'm looking into this now. I'll get back to you soon!
  • Fixed. Here's the updated support package: http://pixelcrushers.com/dialogue_system/download/AdventureCreator_Support_2014-08-02.unitypackage

    I mistakenly thought GameEngine persisted between scene changes, but I guess that explains why there's also a PersistentEngine object. :-)

    Prior to the fix above, the bridge script cached the value of GameEngine. Since local variables are accessed through the GameEngine object, they weren't getting sync'ed because the script had a stale reference to the old scene's GameEngine object. Now it finds the GameEngine in the current scene.
  • Oh stellar, that fixed it, thanks so much!
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.
Do NOT follow this link or you will be banned from the site!