Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Dialogue - A simple and easy way to make characters talk

Discussion in 'Assets and Asset Store' started by Jamster, Apr 19, 2013.

  1. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    So my latest asset store submission is a simple way to make characters talk to each other (at least I think it's easy). Dialogue allows you to:
    • Have a click-through dialogue with any number of characters talking.
    • Write in an easy to understand script like format.
    • Use gotos and ends to navigate your script.
    • Use calls to send things back to your behaviour.
    • Give the player options to choose and make the dialogue dynamic.
    • and more... :)

    As an example dialogue script (taken from the demo scene for robot 4):
    Code (csharp):
    1. Robot 4:        Hello!
    2. Player:            {Hello!}                [goto hello]
    3.                 {What do you demo?}        [goto whatDemo]
    4.        
    5. -hello
    6. Player:           Whoa! That looks usefull!
    7. Robot 4:        Good isn't it? This way the player gets a little more freedom in what they do.
    8. Robot 4:        It could be used fo buying things in a shop for instance.
    9. Player:           That's cool, thanks!
    10.                 [end]
    11.  
    12. -whatDemo
    13. Robot 4:        I demo the option system.
    14. Robot 4:        It allows players to choose what they say and allows you to take different actions!
    15. Player:           That's pretty cool, thanks!
    16.                [end]
    Demo :)

    And it's all for only $5 :D

    Click here to go to the asset store

    Update 1.3.3 available now!
    Capture.PNG Capture1.PNG
    Ability to load variables into the script to show up-to-date information to the user!
    Plus bug fixes and some spelling mistakes rectified :)

    - Jamie
    - Ninjapoke Studios
     

    Attached Files:

    Last edited: May 17, 2015
  2. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Demo is now up! :D

    (I've been a little busy recently so didn't get chance, sorry)

    -NinjaPoke studios
     
  3. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Update 1.1
    We've completely redone the interface!

    We realised it's wasn't as nice as we'd like to incorperate into your projects so we've made it even easier to open dialogues:
    Code (csharp):
    1. DialogueManager.DisplayDialogue(filename);
    Plus we've also got a pretty long list of what we want to add so look forward to more updates! :D

    Buy now for $5!!
     
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    Will this work on mobile?

    How do you make the dialogue say player names or string variables?
     
    Last edited: Dec 2, 2014
  5. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Hi Gekigengar,

    Sorry I haven't seen this sooner my email notifications must have been turned off.

    The character speaking is automatically displayed alongside the text (although you can remove that quite easily). As for displaying variables, it's on my todo list... :p You should be able to define your own tag (something like $variableName$) and replace it with your variable just before it's displayed using a custom renderer but it might have to be a bit of a hack until I add functionality. Of course if you want to modify the source code and make a more permenant feature you could!

    I'm trying to test mobile right now :)

    Apologies and Regards,
    Jamie
     
    Last edited: Jan 18, 2015
  6. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Regarding Mobile, I dont see any reason why it shouldn't work. It uses Unity's own GUI sytems and no external dependancies, if it gets a bit deformed then you can always write a custom renderer for it :)
     
  7. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    Thanks for the reply!,
    If you'd develop this further, this might even be the best dialog system so far.
    (Easy to track, Author friendly, and Localization friendly.)

    Perhaps, make it so it can change global variables?
    Or even, play uSequencer events and such.

    and yes, $Var$ sounds great! Please do it asap!
    I am thinking the only drawbacks is that I can't play animation or change variables through this.

    Does the system supports if/then/else statements?

    Can it call functions in between the texts?

    If this supports the New UI, that would be so cool!

    I am actually thinking of rAthena style of NPC scripts.

    Code (CSharp):
    1. prontera,151,192,4   script   Monk::reset_monk   834,{
    2.  
    3.    set .@ResetStat,75000;   // Zeny for stat reset
    4.    set .@ResetSkill,75000;   // Zeny for skill reset
    5.    set .@ResetBoth,125000;   // Zeny for resetting both together
    6.  
    7.    cutin "bu_maggi1", 0; //Display cut-in image of name maggi expression 1 at position 0 (0 = left, 1 = center, 2 = right)
    8.    mes "[Monk]";
    9.    mes "Hello adventurer.";
    10.    next; //Display the "Next" button for next dialog page.
    11.    cutin "bu_maggi2", 0; //Display cut-in image of name maggi expression 2 at position 0 (0 = left, 1 = center, 2 = right)
    12.    mes "[Monk]";
    13.    mes "I decided to help those in needs";
    14.    mes "After mastering the art of enlightenment.";
    15.    mes "If you need my aid by any means,";
    16.    mes "I am more than willing to aid you";
    17.    next;
    18.    cutin "bu_maggi1", 0;
    19.    mes "[Monk]";
    20.    mes "For a set of fee.";
    21.    mes "Reset Stats: "+ .@ResetStat +"z";
    22.    mes "Reset Skills: "+ .@ResetSkill +"z";
    23.    mes "Reset Both: "+ .@ResetBoth +"z";
    24.    mes "Please select the service you want:";
    25.    next;
    26.    switch(select("^FF3355Reset Skills:Reset Stats:Reset Both^000000:Cancel")) {
    27.    case 1:
    28.      mes "[Monk]";
    29.      if (Zeny < .@ResetSkill) {
    30.        mes "Even monks need zeny to survive nowadays..";
    31.        close; //Display the close dialog button to close conversation.
    32.      }
    33.      set Zeny, Zeny-.@ResetSkill;
    34.      sc_end SC_ALL;
    35.      ResetSkill;
    36.      specialeffect2 158;
    37.      mes "There you go!";
    38.      next;
    39.      mes "[Monk]";
    40.      mes "Come again soon..!";
    41.      close;
    42.    case 2:
    43.      mes "[Monk]";
    44.      if (Zeny < .@ResetStat) {
    45.        mes "Sorry, you don't have enough Zeny.";
    46.        mes "For a greater good, comes a great price.";
    47.        close;
    48.      }
    49.      set Zeny, Zeny-.@ResetStat;
    50.      ResetStatus;
    51.      specialeffect2 371;
    52.      mes "All done..!";
    53.      next;
    54.      mes "[Monk]";
    55.      mes "Come again soon..!";
    56.      close;
    57.    case 3:
    58.      mes "[Monk]";
    59.      if (Zeny < .@ResetBoth) {
    60.        mes "Sorry, you don't have enough Zeny.";
    61.        mes "Come again next time.";
    62.        close;
    63.      }
    64.      set Zeny, Zeny-.@ResetBoth;
    65.      sc_end SC_ALL;
    66.      ResetSkill;
    67.      ResetStatus;
    68.      specialeffect2 338;
    69.      mes "done..!";
    70.      next;
    71.      mes "[Monk]";
    72.      mes "Heh, heh, heh.";
    73.      mes "It's a pleasure to do business";
    74.      mes "With you.";
    75.      close;
    76.    case 4:
    77.      close;
    78.    }
    79. }
    80.  
    As you can see, it is almost similar to yours, but it has the ability to change variables, or call functions such as cut-in images, play special effects, ResetSkill() functions, if then else statements, etc.
     
    Last edited: Jan 19, 2015
  8. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Thanks for the suggestions, I don't really get around to much actual game design anymore so that's some interesting food for thought!

    Regarding animation and changing variables, you already can ;) you can make calls to C#/JS functions and even pass in parameters using the call statement :)

    I also quite like the image cutin, might be a bit horrible to procedurally generate the GUI though...

    Unity's new uGUI is now fully supported, I just haven't posted anything on here about the update!

    Jamie
     
    Gekigengar likes this.
  9. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    Another NPC script, this time, with goto jumps.
    As you can see, the script can either set a local variable, or a global variable.

    It can also use text colors such as ^00AA00Magnifiers
    Which is green color code. (RRGGBB)

    These are a few inspirations which might allow you to create the most flexible dialog in the asset store! (While these are not perfect, the possibilities are huge!)
    (I don't know if this might help, but yeah!)

    I think your dialog system is extremely unique, compared to the other competitors,
    as this is the only hassle free, untangled solution, and writer friendly dialog system
    I have come across in the asset store.

    I hope you can make it even more powerful by implementing colors, if/then/else, local variable and global variable setups, and a while-loop.

    Code (CSharp):
    1. //============================================================
    2. //= Identifier Script
    3. //============================================================
    4.  
    5. prontera,132,215,5    script    Identifier    833,{
    6.  
    7. // Price
    8. // =====
    9. // This is the Price in Zeny for one identified Item
    10.  
    11. set @price, 500;
    12.  
    13. // Actual Script Begins Here
    14. // =========================
    15.  
    16. mes "[Identifier]";
    17. mes "Hello there!";
    18. mes "I can identify all your unidentified items.";
    19. mes "It's just "+@price+" Zeny each item.";
    20. next;
    21. menu "Sure.",-,
    22. "No thanks...",L_Bye;
    23.  
    24. getinventorylist;
    25. set @identify, 0;
    26.  
    27. for(set @i, 0; @i < @inventorylist_count; set @i, @i + 1) {
    28. if (@inventorylist_identify[@i] == 0) set @identify, @identify + 1;
    29. }
    30.  
    31. if (@identify == 0) goto L_Nothing;
    32.  
    33. mes "[Identifier]";
    34. if (@identify < 2) {
    35. mes "You've got one unidentified item in your inventory.";
    36. mes "I'll identify it for "+@price+" Zeny.";
    37. } else {
    38. mes "You've got "+@identify+" unidentified items in your inventory.";
    39. mes "I'll identify them for "+(@identify * @price)+" Zeny.";
    40. }
    41. mes "If you've got any ^00AA00Magnifiers^000000, I'll take those instead.";
    42. mes "Shall I start now?";
    43. next;
    44. menu "Ok, let's go!",-,
    45. "What a ripoff...",L_Bye;
    46.  
    47. getinventorylist;
    48. set @identified, 0;
    49.  
    50. for(set @i, 0; @i < @inventorylist_count; set @i, @i + 1) {
    51. if (@inventorylist_identify[@i] == 0) {
    52. if (countitem(611) > 0) delitem 611,1;
    53. else if (Zeny < @price) goto L_NoZeny;
    54. else set Zeny, Zeny - @price;
    55. delitem2 @inventorylist_id[@i],1,0,0,0,0,0,0,0;
    56. getitem @inventorylist_id[@i],1;
    57. set @identified, @identified + 1;
    58. }
    59. }
    60.  
    61. mes "[Identifier]";
    62. mes "Well, I identified everything!";
    63. mes "I've identified a total of "+@identified+" items for you.";
    64. mes "Come again.";
    65. close;
    66.  
    67. L_Nothing:
    68. mes "[Identifier]";
    69. mes "You don't have any unidentified Items.";
    70. mes "Come again when you do.";
    71. close;
    72.  
    73. L_NoZeny:
    74. mes "[Identifier]";
    75. mes "You don't have enough Zeny.";
    76. close;
    77.  
    78. L_Bye:
    79. mes "[Identifier]";
    80. mes "Come again soon.";
    81. close;
    82.  
    83. }
    This one is an example of variable arrays, which is extremely useful.

    Code (CSharp):
    1.  
    2. prontera,163,172,3    script    Stylist#custom_stylist    878,{
    3.  
    4.     cutin "orleans_1",2;
    5.     mes "[Stylist]";
    6.     mes "I can change your style in a blink of an eye..!";
    7.     next;
    8.     cutin "orleans_2",2;
    9.     mes "[Stylist]";
    10.     mes "It is a pleasure for me to see the citizens in a better style..!";
    11.     next;
    12.     cutin "orleans_6",2;
    13.     mes "[Stylist]";
    14.     mes "How may I help you today..?";
    15.     setarray .@Styles[1],getbattleflag("max_cloth_color"),getbattleflag("max_hair_style"),getbattleflag("max_hair_color");
    16.     setarray .@Look[1],7,1,6;
    17.     set .@s, select(" ~ Cloth color: ~ Hairstyle: ~ Hair color");
    18.     set .@Revert, getlook(.@Look[.@s]);
    19.     set .@Style,1;
    20.     while(1) {
    21.         setlook .@Look[.@s], .@Style;
    22.         message strcharinfo(0),"This is style #"+.@Style+".";
    23.         set .@menu$, " ~ Next (^0055FF"+((.@Style!=.@Styles[.@s])?.@Style+1:1)+"^000000): ~ Previous (^0055FF"+((.@Style!=1)?.@Style-1:.@Styles[.@s])+"^000000): ~ Jump to...: ~ Revert to original (^0055FF"+.@Revert+"^000000)";
    24.         switch(select(.@menu$)) {
    25.             case 1:
    26.                 set .@Style, ((.@Style!=.@Styles[.@s])?.@Style+1:1);
    27.                 set .@sx, rand(1,7);
    28.                 cutin .sface$[.@sx],2;
    29.                 if (.@sx <= 3){
    30.                     specialeffect2 457;
    31.                 } else if (.@sx == 4) {
    32.                     specialeffect2 890;
    33.                 } else if (.@sx >= 5) {
    34.                     specialeffect2 463;
    35.                 }
    36.                 specialeffect 4;
    37.                 specialeffect2 5;
    38.                 specialeffect2 53;
    39.                 break;
    40.             case 2:
    41.                 set .@Style, ((.@Style!=1)?.@Style-1:.@Styles[.@s]);
    42.                 set .@sx, rand(1,7);
    43.                 cutin .sface$[.@sx],2;
    44.                 specialeffect 4;
    45.                 specialeffect2 5;
    46.                 specialeffect2 53;
    47.                 break;
    48.             case 3:
    49.                 message strcharinfo(0),"Choose a style between 1 - "+.@Styles[.@s]+".";
    50.                 input .@Style,0,.@Styles[.@s];
    51.                 if (!.@Style) set .@Style, rand(1,.@Styles[.@s]);
    52.                 set .@sx, rand(1,7);
    53.                 cutin .sface$[.@sx],2;
    54.                 specialeffect 4;
    55.                 specialeffect2 5;
    56.                 specialeffect2 53;
    57.                 break;
    58.             case 4: set .@Style, .@Revert;
    59.                 setlook .@Look[.@s], .@Revert;
    60.                 set .@sx, rand(1,7);
    61.                 cutin .sface$[.@sx],2;
    62.                 specialeffect 4;
    63.                 specialeffect2 5;
    64.                 specialeffect2 53;
    65.                 break;
    66.         }
    67.     }
    68.  
    69. OnInit:
    70.     .sface$[1] = "orleans_1";
    71.     .sface$[2] = "orleans_2";
    72.     .sface$[3] = "orleans_3";
    73.     .sface$[4] = "orleans_4";
    74.     .sface$[5] = "orleans_5";
    75.     .sface$[6] = "orleans_6";
    76.     .sface$[7] = "orleans_7";
    77.     end;
    78. }
    79.  
    This one is a part of my written script of an array and a while loop example.
    Code (CSharp):
    1.  
    2.     cutin "job_ko01",0;
    3.      mes "[Muramasa]";
    4.      mes "Hmm?";
    5.      while(1){ //While(1) will always return true, hence the dialog will re-occur at the end of the dialog until close2; function is called to close the dialog.
    6.        next;
    7.        mes "[Muramasa]";
    8.        mes "Anything you need?";
    9.        next;
    10.        switch(select("About Oboro:About the Demon Blades:I seek your advice.:End Conversation.")){
    11.          case 1:
    12.            cutin "job_ko02",0;
    13.            mes "[Muramasa]";
    14.            mes "^008800Oboro^000000 is a colleague of mine from back in the old times..";
    15.            next;
    16.            cutin "job_ko01",0;
    17.            mes "[Muramasa]";
    18.            mes "I discovered him and his blades when we were young, enchanted by its beauty.";
    19.            next;
    20.            mes "[Muramasa]";
    21.            mes "He has always been a bit of an oddball since back then..";
    22.            next;
    23.            cutin "job_ko04",0;
    24.            mes "[Muramasa]";
    25.            mes "Despite his attitude, his craftsmanship techniques are unorthodox, and his skills were unparalleled.";
    26.            next;
    27.            cutin "job_ko02",0;
    28.            mes "[Muramasa]";
    29.            mes "I think it is better if you speak to him if you wish to know more.";
    30.            break;
    31.            end;
    32.          case 2:
    33.            cutin "job_ko01",0;
    34.            mes "[Muramasa]";
    35.            mes "Back in those times, all we care about is to create the blades of our dreams..";
    36.            next;
    37.            mes "[Muramasa]";
    38.            mes "Both ^008800Oboro^000000 and Me, partners each other soon after..";
    39.            next;
    40.            cutin "job_ko01",0;
    41.            mes "[Muramasa]";
    42.            mes "It is because of this one vision we both share, to create a living blade.";
    43.            next;
    44.            mes "[Muramasa]";
    45.            mes "He pursue it through the beauty within magical blades in the west.";
    46.            next;
    47.            mes "[Muramasa]";
    48.            mes "Blah blah blah..";
    49.            break;
    50.            end;
    51.          case 3:
    52.            cutin "job_ko01",0;
    53.            mes "[Muramasa]";
    54.            mes "Advices..? Hmm..";
    55.            next;
    56.            cutin "job_ko04",0;
    57.            mes "[Muramasa]";
    58.            mes "^FF8800" + .obquote$[rand(1,.maxobquotes)] + "^000000";
    59.            next;
    60.            mes "[Muramasa]";
    61.            mes "How is that..?";
    62.            break;
    63.            end;
    64.          case 4:
    65.            cutin "job_ko01",0;
    66.            mes "[Muramasa]";
    67.            mes "Well then, come again anytime.";
    68.            close2;
    69.            cutin "",255;
    70.            end;
    71.        }
    72.      }
    73.    }
    74.    OnInit:
    75.      .obquote$[1] = "By being lost, one is given the chance to rediscover their purposes.";
    76.      .obquote$[2] = "It is not defeat if you end up winning last, it is progress.";
    77.      .obquote$[3] = "With great power, comes great responsibilities.";
    78.      .obquote$[4] = "There is nothing bad in losing your past, it is an opportunity to discover your new side.";
    79.      .obquote$[5] = "By being lost, one discovers a new path.";
    80.      .obquote$[6] = "Dangers is parcels and part of adventure.";
    81.      .obquote$[7] = "Never underestimate the strengths in numbers.";
    82.      .maxobquotes = 7;
    83.      end;
    84. }
    85.  
     
    Last edited: Jan 19, 2015
  10. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    I'll definately look into those features for you and other users.

    If/Else/Endif is something that I'd quite like to implement, that would then allow while loop items (though bare in mide you can still do this provided that it is only the user exiting the loop).

    Colour is another that would be quite nice to implement, but how to do that is a little more tricky :)

    Jamie
     
  11. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Update 1.3
    Update 1.3 is out!

    It's not a very big update it simply adds a new renderer for Unity's new GUI system.

    (Also I have no clue where update 1.2 is... it's just missing from the thread I think...!)


    Capture.PNG Capture1.PNG

    Download from the Asset Store!
     
    Gekigengar likes this.
  12. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    Nice update!
    No variables and text colors yet?

    I see that the choices are separated into 2 when there is 2 choice,
    what happen if there is more than 2 choices?

    Does this have an input method anyways?
    (Input a number question, input a string for names, etc.)
     
  13. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Nope I'm afraid not, submitted it before you asked so that'll be a future update!

    Yup it'll split into as many as needed, obviously it's the designers responsibility to make sure it's still readable as the buttons get smaller though, I might see if it's possible to split onto multiple lines at some point.

    It doesn't have input because there aren't variables yet! Your best bet would be to call your own method to throw a prompt up and then process that as you need, until something better's in place :)

    Jamie
     
  14. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    Purchased today, will be waiting for updates!
    Its amazing!
     
  15. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Glad you like it :)

    I have a lot on my plate at the moment so I can't guarentee anything fast! :)
     
  16. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    I need guidance in modifying the system, on where and what to change.

    I want to make a [nextpage] label.

    so that the dialog displays the next line in the same box until the [nextpage] label is reached.

    when it hits the [nextpage] label, it will clear out the lines and start anew.

    This way I can manage what to display and where to stop scrolling.

    When pressing next, the scroll ends at the next semicolon.
    And display the next text one row below the end of the current line marked by the colons.

    Code (CSharp):
    1.  
    2. Test : Oh, hi!;
    3. My name is Test,;
    4. Nice to meet you!;
    5. [nextpage]
    6. $Player$ : Hello;
    7. ,I am $Player$;
    8. , Nice to meet you too!;
    9. [nextpage]
    10. Test : How you doin mate?;
    11. Anything great?;
    12. Player : I am doing just fine!;
    13. [end]
    Any help?
     
    Last edited: Feb 11, 2015
  17. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    I noticed that you don't need to implement colors and styles to the system btw.

    I tried using rich-text, and it works in the system from out of the box.

    http://docs.unity3d.com/Manual/StyledText.html
     
  18. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Ooohhh I never knew you could do that! Thanks :D
     
  19. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    Any news on using variables on dialogues? :s

    Now everything is perfect except dialogues with variables.
     
  20. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Hmm good question... I was under the impression I had submitted that... :confused: I'll try and sort that today sorry.
     
  21. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    So it turns out I had submitted it and it had been accepted a while back, I just forgot to post it here :)

    Update 1.3.3
    Support for variables defined in scripts using $$variableName$$ allowing you to add customisation to your dialogues!
    Plus I sorted some bugs and spelling errors :)

    (Again I'm not sure what happened to updates 1.3.1 and 1.3.2, I think I'm going crazy...)

    Jamie
     
    Gekigengar likes this.
  22. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    706
    I see, thanks for the update!
     
  23. destapp

    destapp

    Joined:
    Oct 22, 2012
    Posts:
    18
    hi jamster, i've already bought this plugin yesterday, its a great plugin dialogue with a nice prize :D
    but i want to ask is it possible call a method at the same time with the conversation, for example :

    A: Hi B [call OnTalking talking]
    B: Hi A [call AnimationSpeaker greeting]

    *ontalking is flag when character is in conversation
    *animationSpeaker is method for change image character handler

    i've tried this way but its not working for mw, so if you have a trick or solution please let me know.. ^^
    thank you very much
     
  24. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Hmmm, I think if you put the call on the line before it should make the call then skip directly to the Speech :)

    Code (csharp):
    1. [call OnTalking talking]
    2. A: Hi B
    3. [call AnimationSpeaker greeting]
    4. B: Hi A
    I maybe completely wrong, I've been focusing on other projects more recently!
     
  25. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I bought your asset yesterday. So far so good. Testing it out and this is how it looks.



    But I'm fairly new with C# so I need some help.

    I've tried to trigger animations with the system in the middle of the dialogue so I've added these functions to the DialogueTemplate.cs file:

    Code (csharp):
    1.  DialogueManager.DisplayDialogue (filename, new Call[]{
    2.       new Call("BuySpade", BuySpade),
    3.       new Call("WaveGoodbye", WaveGoodbye),
    4.       new Call("BuyColdplay", BuyColdplay)
    5.      });
    Then with the dialogue text file I added:

    Code (csharp):
    1. The Wizard: Goodbye!
    2. [call WaveGoodbye]
    3. Player: Goodbye
    This is not working, byt when I try:

    Code (csharp):
    1. The Wizard: Goodbye!
    2. [call BuySpade]
    3. Player: Goodbye
    It works. The debug log prints "all: BuySpade()"

    So for some reason only the first line on the "new Call("BuySpade", BuySpade)" works. But the next lines WaveGoodbye and BuyColdplay are not working when I'm trying to call them.

    Any help?
     
  26. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Right... Someone else had this issue but I never heard back from them... I'm guessing this is a glitch so I'll take a look tonight :)
     
  27. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Well I found the issue, and it's so trivial I overlooked it at first!

    There's a break statement on line 151 of DialogueManager.cs that should be inside the if statement; swap lines 150 & 151 over and you'll be fine :) I'll submit a patch ASAP :)

    Also, if it's not too cheeky to ask, could I upload that screenshot to the Dialogue Asset Store page as showcase material?

    Jamie
     
  28. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi Jamie! Thanks I'll try that. :)

    About the screenshot, I bought asset called Dark Fantasy UGUI Pack for the buttons.

    https://www.assetstore.unity3d.com/en/#!/content/26591

    So I quess people might expect that those UI grapics will come with your asset, so that might be a problem? But it's ok for me. It's from a game I'm working on.
     
  29. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    In that case I wont post it (at least until I can find an image guy to add a credit to it!), don't want to get in trouble with the actual creator! :p

    V1.3.4 has now been submitted to fix the bug

    Jamie

    P.S. If you like the package I'd be very grateful if you could leave us a review on the store :)
     
  30. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Maybe I could do screenshot with credits for you tomorrow? I think you would sell more with this kinds of in game screenshots. I'll leave you a review as well. I'm from Finland and it's 1am so gotta get some sleep. :D

    Juhani
     
    Jamster likes this.
  31. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
  32. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Awesome! Thank you very much! :)
     
    Nadan likes this.
  33. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I wrote the review as well. It seems that now you have full 5 stars for the asset. Keep up the good work!
     
    Jamster likes this.
  34. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I have new question. How do I use variables? I understood that I add the $$playerName$$ to the dialogue itself. But how do I define the varible itself? I'm trying to use the players name in the dialogue.

    The docs say:

    "To add a variable you simply need to add to the DialogueManager.variables where the key is the variable name and the value as what to insert in its place."

    But I don't know how to do this.
     
  35. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Should be (away from computer right now so can't see the actual code)
    Code (csharp):
    1. DialogueManager.variables.Add(name, value");
    Then you can change it using
    Code (csharp):
    1. DialogueManager.variables[name] = value
    If it helps, variables is a Dictionary<string, string> :)
     
  36. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Btw...
    Dialogue 1.3.4 is now out!
    (Get buying ;) )
     
  37. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Ok, got it working. Thanks.

    I would like to use players name in the dialogue like this:

    Code (csharp):
    1. The Wizard: Hello!
    2. $$playerName$$: Hello!
    So I could personalize it for the player. It seems it's not possible to use the variable like this? So that's one wish for a future feature in Dialogue.
     
  38. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Oh yeah... I guess it's not...

    I'll try and do that for the next version... :/
     
  39. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I'm trying to build my game to Windows Phone 8.1 and I'm getting some errors. Can you take a look at them?

    Just switch the platform: Windows Store > SDK 8.1
     
  40. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    I'm afraid I don't get any errors when I change platform :confused: can you copy and past the errors here?
     
  41. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I forgot to mention that the errors appear when I try to build the game. You could just try to build the Demo scene and it stops with these errors:

    Code (csharp):
    1. Assets\Dialogue\Dialogue\Plugins\Dialogue.cs(200,36): error CS0117: 'char' does not contain a definition for 'Parse'
    2.  
    3. Assets\Dialogue\Dialogue\Plugins\DialogueManager.cs(200,24): error CS1061: 'System.Delegate' does not contain a definition for 'Method' and no extension method 'Method' accepting a first argument of type 'System.Delegate' could be found (are you missing a using directive or an assembly reference?)
    4.  
    5. Error building Player because scripts had compiler errors
     
  42. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    Ok I think I've fixed it, I get no errors when I try to build but I'd be very grateful if you could test on your Windows Phone for me :)

    2 changes, replace line 200 in Dialogue.cs with
    Code (csharp):
    1. string[] parts = line.Split(' ');
    and replace the Call structure at line 193 in DialogueManager.cs with
    Code (csharp):
    1.  
    2. public struct Call{
    3.    public string name;
    4.    public Delegate method;
    5.    public bool isParamed;
    6.  
    7.    public bool IsParamedFunction{
    8.      get{
    9.        return isParamed;
    10.      }
    11.    }
    12.  
    13.    public Call( string name, Action method ){
    14.      this.name = name;
    15.      this.method = method;
    16.      this.isParamed = false;
    17.    }
    18.  
    19.    public Call( string name, Action<string> method ){
    20.      this.name = name;
    21.      this.method = method;
    22.      this.isParamed = true;
    23.    }
    24.  
    25.    internal object CallMethod(params object[] args){
    26.      return method.DynamicInvoke(args);
    27.    }
    28. }
    29.  
    See if that helps :)
     
  43. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    T
    Thanks, I will test this with my device soon.
     
  44. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Just tested it with my Windows Phone and it's working. Awesome!
     
    Jamster likes this.
  45. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    I'll push an update to the store then :)
     
  46. PlatformSix

    PlatformSix

    Joined:
    Feb 27, 2014
    Posts:
    57
    Is it possible to add calls with more than one parameter? Or multiple calls in a row (consecutive ones seem to skip the first one, but then require DialogueManager.Next() to proceed past the subsequent ones... but then even a single call requires a .next when it's first in the script)? For example, I'm working with this piece of test dialogue:
    Code (csharp):
    1. Sophie:     Hello Lemon.
    2. [call Face Sophie Lemon]
    3. Lemon:     Sophie!
    4. [call Perform Sophie Point]
    5. Sophie:        Where have\nyou been?!
    6. [call Turn Lemon 180]
    7. [call Wait 500]
    8. Lemon:     No-where.
    9. Lemon:     It doesn't matter!
     
    Last edited: Dec 21, 2015
  47. Jamster

    Jamster

    Joined:
    Apr 28, 2012
    Posts:
    1,102
    I'd always said that you can specify as many as you like and then split them at spaces but actually, looking back at the code you can't! The best bet, I think, is to put a character you wont use much as a separator so a call might become
    Code (csharp):
    1. [call Face Sophie|Lemon]
    and then you can split at the pipe character.

    For the multiple calls I'm not sure there's a simple fix I can give you, or that I can implement. The whole code needs a rewrite and I plan to do so at some point in the near future, it'll probably only take me a weekend. Until then I suspect you'll need to just create a local call that can do both... :confused:

    Sorry I can't be more help
    Jamie
     
  48. PlatformSix

    PlatformSix

    Joined:
    Feb 27, 2014
    Posts:
    57
    No worries, thanks a bunch! :)