Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Dialogue Problem  (Read 2812 times)

0 Members and 1 Guest are viewing this topic.

Fastfooot

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 1
    • View Profile
Dialogue Problem
« on: September 07, 2013, 05:56:46 PM »

Hello. I am absolutely new to the Wintermute Community and have a little (Big) Dialogue Problem  :-\.

The Problem is: I check nothing about it.

I dont know how and where i have to put all the code-stuff together, to get a simple dialogue between two Characters.

I tried the Things in the WME-Documentation and even the Dialogmaker-Editor (crashes on my computer) many times, but nothing helped.

I would you thank a lot if you can help me Tod solve this Problem.

bye Ivan

bye Ivan
Logged

ciberspace

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 116
    • View Profile
    • Tele Juego
Re: Dialogue Problem
« Reply #1 on: September 07, 2013, 06:45:05 PM »

NAItReIN

  • Occasional poster
  • **
  • Karma: 1
  • Offline Offline
  • Posts: 69
    • View Profile
Re: Dialogue Problem
« Reply #2 on: September 07, 2013, 10:13:13 PM »

Hello Fastfooot,

I am sorry for my bad English. If you are new to Wintermute Engine you should open WME Demo project to see how does this great engine work. This is really a good way how to start.

There is what you are looking for:

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. global StateRoom;
  4.  
  5. ////////////////////////////////////////////////////////////////////////////////
  6. on "Talk"
  7. {
  8.   Game.Interactive = false;
  9.  
  10.   // greetings
  11.   if(!StateRoom.TalkedToOldGuy) actor.Talk("Hello!");
  12.   else actor.Talk("Hi, it's me again.");
  13.   this.Talk("Hello, miss.");
  14.  
  15.   // set the flag, so that we know we've already talked to him
  16.   StateRoom.TalkedToOldGuy = true;
  17.  
  18.   // and let the dialogue begin
  19.   OldGuyDialogue();
  20.  
  21.   // restore interactivity
  22.   Game.Interactive = true;
  23. }
  24.  
  25.  
  26. ////////////////////////////////////////////////////////////////////////////////
  27. function OldGuyDialogue()
  28. {
  29.   var Responses;
  30.   var Selected;
  31.  
  32.   var Loop = true;
  33.  
  34.   while(Loop)
  35.   {
  36.     // prepare the sentences
  37.     Responses[0] = "Who are you?";
  38.     Responses[1] = "What are you doing here?";
  39.     Responses[2] = "What can you tell me about the Wintermute Engine?";
  40.     Responses[3] = "I have to go.";
  41.  
  42.     // fill the response box
  43.     Game.AddResponse(0, Responses[0]);
  44.     Game.AddResponse(1, Responses[1]);
  45.     Game.AddResponse(2, Responses[2]);
  46.     Game.AddResponse(3, Responses[3]);
  47.  
  48.     // let the player choose one
  49.     Selected = Game.GetResponse();
  50.  
  51.     // let the actor say the selected sentence
  52.     // (that's why I use the array for storing the sentences)
  53.     actor.Talk(Responses[Selected]);
  54.  
  55.     // now let the Old Guy reply depending on the selected sentence
  56.     if(Selected==0)
  57.     {
  58.       this.Talk("My name's not important.");
  59.       actor.Talk("Oh... OK");
  60.     }
  61.     else if(Selected==1) this.Talk("I'm here to answer questions about the Wintermute Engine.");
  62.     else if(Selected==2)
  63.     {
  64.       this.Talk("What would you like to know?");
  65.       // go to the second branch of dialogue
  66.       OldGuyDialogue2();
  67.     }
  68.     else if(Selected==3)
  69.     {
  70.       this.Talk("OK, bye.");
  71.       Loop = false; // we want to end the dialogue
  72.     }
  73.   }
  74. }
  75.  
  76.  
  77.  
  78. ////////////////////////////////////////////////////////////////////////////////
  79. function OldGuyDialogue2()
  80. {
  81.   var Responses;
  82.   var Selected;
  83.   var Loop = true;
  84.  
  85.   while(Loop)
  86.   {
  87.     // prepare the sentences
  88.     Responses[0] = "What is it?";
  89.     Responses[1] = "Is it any good?";
  90.     Responses[2] = "Why is it called 'Wintermute'?";
  91.     Responses[3] = "That's all I wanted to know about the Wintermute Engine.";
  92.  
  93.     // fill the response box
  94.     Game.AddResponse(0, Responses[0]);
  95.     Game.AddResponse(1, Responses[1]);
  96.     Game.AddResponse(2, Responses[2]);
  97.     Game.AddResponse(3, Responses[3]);
  98.  
  99.     // let the player choose one
  100.     Selected = Game.GetResponse();
  101.  
  102.     // let the actor say the selected sentence
  103.     // (that's why I use the array for storing the sentences)
  104.     actor.Talk(Responses[Selected]);
  105.  
  106.     // now let the Old Guy reply depending on the selected sentence
  107.     if(Selected==0)
  108.     {
  109.       this.Talk("As far as I know it's a piece of software, that allows you to create you own adventure games.");
  110.       this.Talk("Although I don't understand why would anyone want to do it, since the point&click adventures are dead.");
  111.       actor.Talk("*ahem*");
  112.     }
  113.     else if(Selected==1)
  114.     {
  115.       this.Talk("I dunno. I never used it myself. You'll have to find out yourself.");
  116.       actor.Talk("OK, I'll try.");
  117.     }
  118.     else if(Selected==2)
  119.     {
  120.       this.Talk("Well I don't know for sure...");
  121.       this.Talk("But I think it has something to do with the author's obsession for cyberpunk and that kind of crap.");
  122.       actor.Talk("I *still* don't understand. Oh well, nevermind.");
  123.     }
  124.     else if(Selected==3) Loop = false;
  125.   }
  126. }
  127.  
  128.  
  129. ////////////////////////////////////////////////////////////////////////////////
  130. on "LookAt"
  131. {
  132.   if(!StateRoom.TalkedToOldGuy) actor.Talk("Who's this guy? Maybe I should talk to him.");
  133.   else actor.Talk("I still don't understand what he is doing here.");
  134. }
  135.  
  136. ////////////////////////////////////////////////////////////////////////////////
  137. on "Take"
  138. {
  139.   actor.Talk("He's not my type.");
  140. }
  141.  
  142. ////////////////////////////////////////////////////////////////////////////////
  143. on "LeftClick"
  144. {
  145. }
  146.  
  147.  
  148. ////////////////////////////////////////////////////////////////////////////////
  149. on "Money"
  150. {
  151.   Game.Interactive = false;
  152.   actor.Talk("Do you want some money?");
  153.   this.Talk("Miss, do I look like I'm homeless or something?");
  154.   actor.Talk("Well...");
  155.   this.Talk("Don't answer that!");
  156.   actor.Talk("Ok, no money then.");
  157.  
  158.   Game.Interactive = true;
  159. }
  160.  
  161.  
  162.  
  163. ////////////////////////////////////////////////////////////////////////////////
  164. function GoToObject()
  165. {
  166.   actor.GoTo(356, 398);
  167.   actor.TurnTo(DI_UPRIGHT);
  168. }

Can you understand this piece of code? Of course there are also other way how to work with dialogs but you should start here.
« Last Edit: September 08, 2013, 07:19:20 PM by NAItReIN »
Logged
 

Page created in 0.082 seconds with 20 queries.