61
Technical forum / Re: Dialogue Problem
« 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:
Can you understand this piece of code? Of course there are also other way how to work with dialogs but you should start here.
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
- #include "scripts\base.inc"
- global StateRoom;
- ////////////////////////////////////////////////////////////////////////////////
- on "Talk"
- {
- // greetings
- // set the flag, so that we know we've already talked to him
- StateRoom.TalkedToOldGuy = true;
- // and let the dialogue begin
- OldGuyDialogue();
- // restore interactivity
- }
- ////////////////////////////////////////////////////////////////////////////////
- function OldGuyDialogue()
- {
- var Responses;
- var Selected;
- var Loop = true;
- while(Loop)
- {
- // prepare the sentences
- Responses[0] = "Who are you?";
- Responses[1] = "What are you doing here?";
- Responses[2] = "What can you tell me about the Wintermute Engine?";
- Responses[3] = "I have to go.";
- // fill the response box
- // let the player choose one
- // let the actor say the selected sentence
- // (that's why I use the array for storing the sentences)
- // now let the Old Guy reply depending on the selected sentence
- if(Selected==0)
- {
- }
- else if(Selected==2)
- {
- // go to the second branch of dialogue
- OldGuyDialogue2();
- }
- else if(Selected==3)
- {
- Loop = false; // we want to end the dialogue
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////////
- function OldGuyDialogue2()
- {
- var Responses;
- var Selected;
- var Loop = true;
- while(Loop)
- {
- // prepare the sentences
- Responses[0] = "What is it?";
- Responses[1] = "Is it any good?";
- Responses[2] = "Why is it called 'Wintermute'?";
- Responses[3] = "That's all I wanted to know about the Wintermute Engine.";
- // fill the response box
- // let the player choose one
- // let the actor say the selected sentence
- // (that's why I use the array for storing the sentences)
- // now let the Old Guy reply depending on the selected sentence
- if(Selected==0)
- {
- this.Talk("As far as I know it's a piece of software, that allows you to create you own adventure games.");
- this.Talk("Although I don't understand why would anyone want to do it, since the point&click adventures are dead.");
- }
- else if(Selected==1)
- {
- }
- else if(Selected==2)
- {
- this.Talk("But I think it has something to do with the author's obsession for cyberpunk and that kind of crap.");
- }
- else if(Selected==3) Loop = false;
- }
- }
- ////////////////////////////////////////////////////////////////////////////////
- on "LookAt"
- {
- }
- ////////////////////////////////////////////////////////////////////////////////
- on "Take"
- {
- }
- ////////////////////////////////////////////////////////////////////////////////
- on "LeftClick"
- {
- }
- ////////////////////////////////////////////////////////////////////////////////
- on "Money"
- {
- }
- ////////////////////////////////////////////////////////////////////////////////
- {
- }
Can you understand this piece of code? Of course there are also other way how to work with dialogs but you should start here.