Search Unity

[70% OFF - FLASH DEAL] Dialogue System for Unity - easy conversations, quests, and more!

Discussion in 'Assets and Asset Store' started by TonyLi, Oct 12, 2013.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @angrypenguin - If your dialogue UI class derives from AbstractDialogueUI (as all the built-in classes do -- UnityUIDialogueUI, legacy UnityDialogueUI, NGUIDialogueUI, etc.), then:
    • To simulate a click of the continue button, call the dialogue UI's OnContinue() method. OnContinue() is virtual, so can also make a subclass and override if it you want.
    • When ConversationView shows a subtitle, it calls the subtitle class's Show() method, which always shows the continue button. Then it immediately determines whether the continue button should actually be visible. If not, it calls the dialogue UI's HideContinueButton(subtitle) method. This method is also virtual if you want to override. So, to answer your question, assume that the continue button is visible unless HideContinueButton was called.

    Hi @Ludo97 - Set up your NPC to disable its AI and animation during conversations. The general instructions are here: How To Set Up NPCs. To make the NPC look at the player, in the NPC's first dialogue entry node set the Sequence field to:
    LookAt(listener)

    Hi @kebrus - Yes. There are a few ways to do this. The easiest is to inspect the Dialogue Manager and untick Always Force Response Menu. Then if the player only has one valid response the conversation will automatically use that response without showing a response menu.
     
  2. Temuzhin

    Temuzhin

    Joined:
    Apr 9, 2015
    Posts:
    23
  3. JAKAMY

    JAKAMY

    Joined:
    Apr 21, 2015
    Posts:
    13
    Hello and Happy new year :) I recently purchased your asset and found it to be very complete. To be honest I just started studying it and experimenting with it inside my 2D game. yesterday I stumbled upon a small problem on my side that I couldnt find where to resolve. when I added my 2D player prefab the name displayed under the player face is the name(headcollider) of one of the child objects' collider as in the picture. the problem is that my character is quite complexe because of the gameplay we want and using the force actor name on the main prefab's collider object doesnt do anything. I tried disabling the child object which made the player name another child object collider. only after I disabled all the child objects that the player name used the prefab main object name. Is there a way to define what collider is used for the player in the scenario of collider entry trigger? Since I won't be able to handle any additional script if its not read from the root collider object of the player prefab.
    PS: I used the player wizard too but it still doesnt work or even if it display correctly the player name there it fails to in game.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @Temuzhin - Your quest log window should be in the scene hierarchy. To see an example, open Examples/Feature Demo/Feature Demo (for a legacy Unity GUI example) or Examples/Unity UI Examples/Generic UI Example or SF Unity UI Example (for Unity UI examples).

    The Feature Demo scene has a GameObject named Feature Demo. The quest log window is a child of this GameObject. The FeatureDemo.cs script (on the Feature Demo GameObject) calls the quest log window's Open() method.

    Because the Unity UI Generic UI Example uses Unity UI, all windows are located under a Canvas. The Canvas is a child of the Dialogue Manager. The FeatureDemo.cs script points to the quest log window under the Canvas and calls its Open() method.

    Hi @JAKAMY - The easiest way to bypass the whole issue is to assign the main player GameObject to your Conversation Trigger's Actor field. (The idea is the same if you're using Dialogue System Trigger or another trigger component instead of Conversation Trigger.)

    If you leave the Actor field blank, the Conversation Trigger will try to automatically identify the best GameObject for the actor. If the Conversation Trigger is set to OnTriggerEnter, it will use the GameObject that entered the trigger collider -- in this case, it appears to be HeadCollider. You can add an Override Actor Name component to HeadCollider to tell the Dialogue System to use a different name.
     
    JAKAMY likes this.
  5. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    NEVERMIND, talked to soon, it's the message first and the object later with two commas

    Sorry to bother again but I can't figure out what am I doing wrong

    What exactly is the best way to run a method from another script in a specific point of a conversation? I was doing in the Sequencer "SendMessage(GameManager, Travel);" being GameManager an object and script that controls the flow of the game and Travel a method I want to run, am I doing it wrong?
     
    Last edited: Jan 4, 2016
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @kebrus - You have it almost perfect, but the order of SendMessage() arguments is a little peculiar. It's:

    SendMessage( methodName, argument, object )

    So in your case try this:

    SendMessage(Travel,,GameManager)

    The reason for this strange order is so you can omit parameters. For example, if you want the speaker to call the method Dance() on itself, you can use this sequencer command:

    SendMessage(Dance)

    because the default for argument is blank and the default for object is the speaker itself.
     
  7. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Yeah it makes sense, whats the difference between the sequence code and the script code tho? Also can I run something at the end of dialogue line? for example, the user had to click continue and only then the code would run. Sorry to bother, I reading the documentation, I really am, it's just a bit too much to take in at first
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    No worries! It's a big, comprehensive system. Don't hesitate to ask questions. It's probably faster for me to point you in the right direction than for you to dig through pages of documentation.

    To delay something for an amount of time, put "@seconds" at the end, like this:

    SendMessage(Travel,,GameManager)@2.5

    This delays the command until the 2.5-second mark.

    There's also a special keyword {{end}} that's based on the length of the dialogue text and the Dialogue Manager's Subtitle Chars Per Second value. So you could do this:

    SendMessage(Travel,,GameManager)@{{end}}

    But neither of those wait for the continue button to be clicked. To run a sequence after the continue button, you have two choices:
    1. If the next stage in the conversation is going to be a player response menu, tick the dialogue entry's Add Response Menu Sequence checkbox. This will give you a Response Menu Sequence field. Put the commands in this field. They'll play as soon as the response menu comes up.
    2. Otherwise, if the next stage is not a response menu, put the commands in the next dialogue entry's Sequence field.

    Regarding "whats the difference between the sequence code and the script code tho?" -- do you mean the Sequence field versus the Script field? If so, the Sequence field uses sequencer commands. It's usually used to change things in the scene, such as moving the camera, playing animation and audio, etc.

    The Script and Conditions fields lets you enter Lua statements to check and/or set values in the Dialogue System's internal environment, such as variables you've defined in the Variables tab of the Dialogue Editor. You can click the "..." next to the field to use a point-and-click wizard so you don't have to write Lua code manually. These fields are commonly used to remember certain responses the player has chosen, and to follow different branches of the conversation based on those choices.
     
    kebrus likes this.
  9. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    I see, thanks for the explanation

    Following that, what if the next stage does not exist, meaning, it's the last one. I know I can add a component to check for the end of a conversation but I wanted to have multiple ending methods running depending on the conversation flow
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    The sequencer has a messaging system. It's unrelated to Unity messages/SendMessage().

    Let's say you want to invoke GameManager.Travel() after the player clicks the continue button. Try this:

    1. Set your dialogue entry node similar to this:
    • Dialogue Text: "Click continue to travel."
    • Sequence: Audio(Jeopardy_Song); required SendMessage(Travel,,GameManager)@Message(ContinueClicked)
    2. In the Hierarchy view, drill down into your dialogue UI and inspect the Continue Button. Its On Click () event currently invokes UnityUIDialogueUI.OnContinue. Click the "+" to add another event handler. Assign the Dialogue Manager GameObject. Select the SendMessage method, and set the argument to "ContinueClicked" (without quotes). (Sorry, I'm out of the office right now so I can't prepare screenshots.)


    What this does:
    • When the conversation gets to this dialogue entry, the sequencer will play Jeopardy_Song immediately. However, the SendMessage() command will wait until it receives the sequencer message "ContinueClicked". (The "required" keyword just ensures that this command plays no matter what.)

    • The continue button will always send "ContinueClicked" to the sequencer. It's okay if the current sequence isn't waiting for the message; it'll just ignore it.

    I realize it sounds complicated, but you only need to do step #2 one time. Then whenever you want to do something after clicking continue in any dialogue entry, you just add "@Message(ContinueClicked)" to it.
     
  11. JAKAMY

    JAKAMY

    Joined:
    Apr 21, 2015
    Posts:
    13
    Thank you for your reply :) It did work, I just added runtime assignment for the actor field as my character is instantiated on scene load.
     
    TonyLi likes this.
  12. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Cheers!
     
  13. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    Hi @TonyLi ,
    How do i add a portrait Image using NGUI,
    On both NGUIBarkUI and also on the Alert Panel(alert panel to show quest items ie, key found etc)
    And if possible, have animated portraits.
    Thanks a lot.
     
    Last edited: Jan 5, 2016
  14. Jack62Lewis

    Jack62Lewis

    Joined:
    Jun 17, 2013
    Posts:
    105
    Is your NPC using a nav agent component to walk? If so you can do the thing I'm doing which is, on the script that you use to control the nav agents movements have this piece of script:


    public void OnConversationStart()
    {
    agent.Stop(); <<in your code replace "agent" with the name of the variable you're storing the nav agent in.
    }

    public void OnConversationEnd()
    {
    agent.Resume(); <<in your code replace "agent" with the name of the variable you're storing the nav agent in.
    }

    This is a simple way for pausing/resuming the nav agents current path when conversations are started/ended by the player
     
    TonyLi likes this.
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @vivalavida - The default NGUIBarkUI and NGUIDialogueUI don't implement animated portraits. You can either modify the scripts (NGUIBarkUI.cs and NGUIAlertControls.cs) or use Unity UI. Similarly, barks and alerts don't use portrait images. Since alerts aren't associated with a specific actor, the Dialogue System wouldn't know which actor portrait to use. To add portraits to bark UIs, you can copy the portrait code from NGUISubtitleControls.cs.

    For alert panels, you may want to show arbitrary images such as a key for a quest. The Dialogue System has a support package for Text Mesh Pro, which can show images inline with text. Text Mesh Pro is an additional purchase if you don't already own it, but many developers have found it to be useful for putting images in their text, such as in their dialogue text and quest descriptions.

    If you don't want to use Text Mesh Pro, you could add a UITexture to your alert panel. Then override ShowAlert to put an appropriate image in the UITexture. For example, you could scan the alert string for a custom tag of your choosing, such as "[image=XXX]". If you find it, remove the tag from the string before showing it, and put image XXX in the UITexture.
     
    Last edited: Jan 5, 2016
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    New Year's Sale - Dialogue System for Unity 35% Off

    To celebrate the new year and the release of version 1.5.8, the Dialogue System for Unity is on sale now for 35% off!

    For those who already own the Dialogue System, version 1.5.8 is now available on the Asset Store, and it provides a lot of improvements and additions. See the release notes here.
     
    BackwoodsGaming likes this.
  17. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Thx TonyLi for the explanation, it's working as intended, I'll be sure to take advantage of the promotion ;)

    cheers
     
  18. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    I appreciate this statement. Thank you.

    I have started the final assembly of MegaWars.Net and decided it is best to create a new project.

    With this in mind I want all dialogs to use the Dialogue system. I want every bit of text shown to the user to go through the databases that way everything can be translated.

    Since there will be dialogs that don't use the system directly (login dialog comes to mind) I still want to use the databases to have the translation features. Are there functions that can extract a string using an ID?

    Thanks again.
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    For text outside of dialogue databases, use a Localized Text Table. <-- Instructions are in that link. There's also a localization video tutorial (here's the direct jump to localized text tables). Just create a localized text table and assign it to your Dialogue Manager. Then add a Localize UI Text component to your UI Text elements, or call LocalizedTextTable["string"] to get the localized version of a string.
     
    Mazak likes this.
  20. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    Perfect, thank you
     
  21. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    It is possible to unlock a quest by another?
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @Ludo97 - Yes, there are several ways to do this. Here are some ideas:

    1. Handle it all in a conversation. For example, say an NPC sends you on a quest to bring him a salty cracker. After you bring him a salty cracker, he'll send you on another quest to bring him a glass of water. You could set up the conversation like this:
    • PC: Do you have any quests?
      • NPC: Bring me a cracker.
        Conditions: Quest["Cracker"].State == "unassigned"
        Script: Quest["Cracker"].State = "active"

      • NPC: I'm still waiting for a cracker.
        Conditions: Quest["Cracker"].State == "active" and Variable["hasCracker"] == false

      • NPC: Ooh, a cracker!
        Conditions: Quest["Cracker"].State == "active" and Variable["hasCracker"] == true
        Script: Quest["Cracker"].State = "success"; Variable["hasCracker"] = false

      • NPC: Now I'm thirsty! Bring me a glass of water.
        Conditions: Quest["Cracker"].State == "success" and Quest["Water"].State == "unassigned"
        Script: Quest["Water"].State = "active"
    (Note: You don't have to type in the Conditions and Script quest manually. You can use the Lua wizards to configure them with simple point-and-click dropdown menus.)


    2. Or handle it in a trigger component such as Quest Trigger. For example, say you have two quests: "Infiltrate" (infiltrate an enemy base) and "Escape" (escape the base). When the player enters a trigger collider in the center of the base, the Infiltrate quest becomes successful and the Escape quest becomes active.

    To set this up, add two Quest Triggers to the trigger collider. Set them both to OnTriggerEnter. On one, set Infiltrate to success. On the other, set Escape to active. You could put something in the Alert Message field, such as: "Successfully infiltrated base. Now you must escape!"

    Note: For a follow-on quest like this, you could also use quest entries (sub-tasks). The quest could be called something like "Reconnaissance", with quest entries for "Infiltrate" and "Escape".


    3. Or put actual Lua code in a custom field in your quest. This is an advanced technique that requires a bit of scripting. Ssome developers use it to attach extra functionality to quests. Using the Infiltrate example above, you could add a custom field called something like "On Success". Set "On Success" to:

    Quest["Escape"].State = "active"​

    If you've registered functions with Lua to interface with your gameplay code, you can put that here, too. For example, say you've registered a "GiveXP" function:

    Quest["Escape"].State = "active"; GiveXP(50)​

    When you complete a quest, use the Lua.Run method to run the code in this field:

    Code (csharp):
    1. Lua.Run(DialogueLua.GetQuestField("Infiltrate", "On Success").AsString);
     
  23. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    thank you
     
  24. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    I use the backup system of "Dialogue sytem " in my scene. I created a separate menu for testing and in this menu there a button " continue" but I know how to do for when I press the button , load the last backup. I have added a particular script?
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @Ludo97 - The FeatureDemo.cs script provides an example of loading and saving. If you're using Realistic FPS Prefab, the multi-scene example in the Third Party Support/Realistic FPS Support folder also demonstrates saving and loading. And there is a more comprehensive example in the free Menu Template on the Dialogue System Extras page.

    Briefly:
    1. Add a Level Manager component to your Dialogue Manager.
    2. Call LevelManager.LoadGame:
      Code (csharp):
      1. FindObjectOfType<LevelManager>().LoadGame(PlayerPrefs.GetString("SavedGame"));
    See Save System Quick Start Steps for more info. And if you have any questions about it, please let me know!
     
  26. r3nrohan

    r3nrohan

    Joined:
    Sep 28, 2015
    Posts:
    33
    umm How can I use inbuilt save system of dialouge system to save inventory pro data?
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @r3nrohan - Inventory Pro's integration for the Dialogue System uses Inventory Pro's SaverLoader system. To tie it into the Dialogue System's save system, add a Dialogue System Collection Saver Loader to every Inventory Pro collection that you want to save. You can use menu item InventorySystem > Integration > DialogueSystem > Dialogue System Collection Saver Loader to add it.

    In Inventory Pro's demo scene for the Dialogue System integration, this component has been added to CharacterWindow, Skillbar, InventoryWindow, and InventoryWindow2.
     
  28. nrvllrgrs

    nrvllrgrs

    Joined:
    Jan 12, 2010
    Posts:
    62
    Is there a callback for OnLinkedConversationStart, for when a conversation directly links/starts another conversation? If not, could such a callback be added?
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @nrvllrgrs - There currently isn't one, but I'll add it in the next version! In the meantime, your script can use OnConversationLine:
    Code (csharp):
    1. private int currentConversationID = -1;
    2.  
    3. void OnConversationLine(Subtitle subtitle) {
    4.     var conversationID = subtitle.dialogueEntry.conversationID;
    5.     if (currentConversationID != conversationID) {
    6.         currentConversationID = conversationID;
    7.         var conversation = DialogueManager.MasterDatabase.GetConversation(conversationID);
    8.         Debug.Log("Switch to conversation " + conversation.Title);
    9.     }
    10. }
     
  30. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Hi, sorry to bother you again :p

    A quick question, firstly I want to be able to hide a name or basically change it on the fly, for example I want to be able to change the player name or hide a npc name temporarily. I tried using the override script but that changes the display on the avatars but not on the dynamic text dialogue, I also tried changing the variable with a script but that changes the database so it changes the name permanently. What would be the best way? add another variable and use that instead of the name and have the name use the override method?
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @kebrus - What about changing the Actor and/or Conversant variables? When a conversation starts, these variables are set to the participants' names, and you can use them in your dialogue text:
    • [NPC] Dialogue Text: Hi, I'm [var=Conversant]!"

    And you can change it during a conversation:
    • [NPC] Dialogue Text: "I'm your long lost sister!"
      Conditions: Variable["SisterRecognizesPlayer"] == true
      Script: Variable["Conversant"] = "sister"

    • [PC] Dialogue Text: "Hello, [var=Conversant]!"

    I'm not sure if this is what you're asking. If I missed the mark, please give me an example.
     
  32. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Well it helped a little but still didn't solve the problem. I wasn't aware I could use the Variable to check who the conversant and actor are, I was using something like Actor["Player"].Name = "New Name" which irreversibly changes the name in the data base. Now I'm able to change the name in the dialogues, but that change doesn't apply to the name in the avatar.

    The best example I can give you going start a conversation with a new character and the name states something like "???" or "..." and then that character introduces itself and the name displayed would change to "NPC Name". In my case I need to be able to change my player name at any time and I must be able to generate random NPCs and change their name on the fly.
     
  33. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    Hi guys,

    I have imported into Unity a free realistic-looking character from AutoDeskCharacterGenerator. I have, also, set it as a humanoid character, so that mecanim bones (i.e. Unity mecanim skeleton) would be automatically integrated into it.

    I animate this character based on the throughput of a motion-capture device (called Xsens) that basically maps the positions & orientations of a human wearing the mocap suit onto Unity's mecanim bones, and thus animates my character. So, in my Unity project, I now have an avatar that does exactly what a user does in real time, while wearing the Xsens mocap suit.

    Now, all I need is to make this character (as is) speak and say things, for experimentation. Can I use this dialogue system "without" losing anything that I have made so far? In other words, is it as simple as just adding verbal communication and lip sync and facial gestures to a Unity mecanim character, without compromising anything else? Or this dialogue system is not what I think it is?

    Many thanks,
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    @kebrus - I'm so sorry -- the forum said it posted my reply below, but on returning to the thread today it was still in draft mode. Here's my reply:

    By "name in the avatar" do you mean the portrait name? For example, it would be "NPC Name" in the lower left of the image below:


    If so, the short answer is to update the cached CharacterInfo for the character:
    Code (csharp):
    1. var playerID = DialogueManager.MasterDatabase.GetActor("Player").id;
    2. var characterInfo = DialogueManager.ConversationModel.GetCharacterInfo(playerID);
    3. characterInfo.Name = "New Name";
    The start of the conversation sets up the cache, so you need to do this after the conversation has started.

    The Dialogue System uses a Model-View-Controller architecture, where ConversationModel manages data (including info about participants), ConversationView shows the UI, and ConversationController coordinates between them.

    For efficiency, ConversationModel maintains a cache of CharacterInfo records, one per participant. If you change an actor's name, you also need to update the cache. The ConversationView uses CharacterInfo.Name as the portrait name.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @HamFar - I don't think the Dialogue System for Unity is what you're looking for. The Dialogue System runs branching conversation trees similar to those seen in games like Fallout, Mass Effect, Baldur's Gate, Zelda, Monkey Island, etc. Although the Dialogue System can integrate with third party assets such as SALSA and LipSync to drive lipsync and facial gestures, conversation trees are generally written at design-time, not dynamically at runtime.
     
    HamFar likes this.
  36. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey Tony^^

    I have a problem with the save/load system.
    I set it up like this:
    (For testing in a single scene)



    The load and save Messages are displayed ingame and the Info says:



    But nothings happen, my player didn't change the position.
    I already tried the PersistentDestructible component, but same here.
    I use the 1.5.8 Version.

    Thank you very much in advance :)
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @Darkkingdom - Does saving and loading work in the Feature Demo scene?

    If so, please try the Save Load Example scene. In the first scene, there are terminals that you can "use" to load and save using Game Saver components. Does this work?
     
    Darkkingdom likes this.
  38. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81

    Hey Tony thanks for the fast reply^^

    yeah it works perfect in the example scene.
    I even copyed the "Load Game" and "Save Game" Gameobjects from that scene and just added a 2D Collider an edited the Trigger to "On Trigger Enter".
    Does they have to be child or parent of something?^^
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    There aren't any parent-child requirements.

    What is triggering the Game Saver's "OnUse"? The Lua Trigger only shows an alert message. If your scene isn't set up yet to send "OnUse" to the Game Saver, you can do the following:
    1. On the Load Game GameObject, remove the Lua Trigger component.
    2. Add a Dialogue System Trigger component. (This is the Dialogue System's general-purpose trigger component.)
    3. Set the Dialogue System Trigger's Trigger to OnTriggerEnter.
    4. Expand Show Alert. Set the message to "Game Loaded".
    5. Expand Send Messages. Add one element. Assign the Load Game GameObject, and set the Message to "LoadGame" (without quotes) and the Parameter to "0" (zero, without quotes).
    6. Repeat for the Save Game GameObject, except set the Message to "SaveGame". Since you're using LoadGame and SaveGame messages, you can actually use the same Game Saver GameObject for all your saving & loading if you want. Or you can keep them separate like they are now.
     
    Darkkingdom likes this.
  40. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    That's it! Thank you very much Tony^^
    5* Support like always :)
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Thanks! Happy to help!
     
    Darkkingdom likes this.
  42. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    I have been glade to early :(

    I'm trying to load my saves from the startmenu.
    And I make the saves in the scene the same way I describe above, this looks okay:



    But them I'm trying to load the save in startmenu, via this component and a direct call with <GameSaver>().OnUse;



    the scene don't get loaded.
    The Info says the load get called:



    I already tried to load the level manual with <LevelManager>().LoadLevel(); but then my PersistentPositionData is not loaded and my conversationen progress too.
    <GameSaver>().LoadGame(1); brings the same effect.



    Oh and another short question:
    Where comes the name from "Starting Level" and "Default Starting Level"? From my scene filenames?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @Darkkingdom -

    1. Is the scene in which you saved the game in your project's build settings? For example, if you saved in the scene "Airlock", then "Airlock" must be in the build settings.

    2. Are there any errors or warnings in the Console view?


    Yes. :)
     
  44. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    1. Yes it is. Do I have to set the levelname in the scene I save somewhere? Or does this get saved automatically?
    2. Nope just the infos I posted, plus the whole Variables and Quests I have.
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    You don't have to set the level name. The Persistent Position Data component will save it in the Actor["Player"] array.

    If you load your game from the same scene that you saved in, does it restore the position properly? (Let's call this the "gameplay scene.")

    By default, the Dialogue Manager GameObject acts as a "singleton." This means it only allows one version of itself in the scene. In addition, it will continue to exist through scene changes. If you're loading in your start scene, the Dialogue Manager in your start scene will stick around. If there is another Dialogue Manager in the gameplay scene, the start scene's Dialogue Manager will destroy it.

    Also, if your start scene doesn't have a Dialogue Manager for the Game Saver to work with, the Dialogue System will create an empty Dialogue Manager (without a Level Manager). This empty Dialogue Manager will then stick around when you change scenes.

    Make sure your start scene has a valid Dialogue Manager. Then make sure this Dialogue Manager has a Level Manager component.

    If that doesn't help, please feel free to send a copy of your project to tony (at) pixelcrushers.com. I'll be happy to take a look!
     
  46. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Yes it works perfect as long I load from the gameplay scene.


    I use my DialogueManager as a prefab.
    Both the start and the gameplayscene have the prefab with a LevelManager component (with the name of the gameplay scene).
    Should just the start scene have a DialogueManager?
    I did it this way because I don't want to play from the start scene, for every change I do in gameplay scene xD

    Mhhh... I didn't had a actor named Player^^
    But even after I created him with ID 0, the problem is still there :(
    This is what I got from the info, for the Actors:



    Hope this is alright because I don't see anything with the gameplayscene save.


    Thank you so much and sorry if I'm anoying^^'
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    Hi @Darkkingdom - No worries; hang in there, we'll get it working! :)

    You set this up the best way. Just keep in mind that if you're coming into the gameplay scene from the start scene, the start scene's Dialogue Manager will be the one that sticks around.

    Those logs show that the Dialogue System's runtime environment is initialized. But if it's loading a saved game, then this should be followed by additional lines that put the saved game data into the runtime environment, too.

    I'll post an example here later today. It should hopefully clear all this up.
     
    Darkkingdom likes this.
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    The Last Door - Series Finale Released

    Congratulations to The Game Kitchen for releasing Beyond The Curtain!

    This is the final episode of The Last Door, the ground-breaking episodic horror series that Penny Arcade described as "A love letter to Lovecraft." If you enjoy horror or story-based adventures, check it out!

    Also check our their development blog for great insight into their process, including character creation, preproduction, and how they used the Dialogue System to bring their dialogue to life!
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,698
    @Darkkingdom - Here's an example scene in 2D that uses GameSaver: GameSaverExample_2016-01-15.unitypackage

    It's not fancy, but that's to keep the purpose of each GameObject clear. When you import the package, add the "Game Saver Example" scene to your build settings.

    You control a square in the center of the screen:



    The scene has several triggers:
    • Start Quest and Finish Quest change the state of a quest (to test saving and loading of quest states).
    • Save Checkpoint 1 and 2 save the player at that position.
    • Load Game On Start loads the last saved game on start.
    You'll notice that since the player saves on top of a save checkpoint, when you load the saved game the player will immediately save again. You can prevent this using whatever method is appropriate in your game, such as checking something in the trigger's Condition section. I figured it wasn't worth clouding up the example scene with this.

    I also used one GameSaver and pointed all the triggers to it. You could use separate GameSavers if you want; it's fine either way.

    I didn't include a separate start scene, but that probably won't be an issue. I suspect it's just a configuration issue with the GameSaver(s) and triggers.
     
    Darkkingdom likes this.
  50. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Thank you so much for the scene you extra made :)

    But oh boy... I tried almost everything^^
    I changed the direct script call of the GameSaver to a DialogueSystemTrigger, 1:1 like in your example scene (of course with the message to the GameSaver^^).
    I changed the PlayerPrefsKey to a new varaible, in the gameplayscene and the startscene.
    I deleted all from DialogueManager and reimported it.
    I created a new scene for my startmenu.
    I even changed my DialogueManager, to the one in the example scene you made for me.

    But nothing works q.q
    The only thing I found out, is that it looks that it can load every information and just didn't start the level:



    But when I'm trying to load the gameplay scene manual, it still don't start from the saved position :(