Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 3 and Version 4 of content/DialogHowTo


Ignore:
Timestamp:
Dec 14, 2017, 9:33:14 AM (7 years ago)
Author:
kuchlert
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • content/DialogHowTo

    v3 v4  
    1 == How to use interactive dialogues in level files ==
     1== How to use interactive dialogs in level files ==
    22
    3 This tutorial will show you how to implement dialogue boxes in a level file.
     3This tutorial will show you how to implement dialog boxes in a level file.
    44
    5 Example: DialogueShowcase.oxw
     5Example: DialogShowcase.oxw
    66
    77== Create an event & trigger ==
    88
    9 First open the xml file of the level you want your dialogue to appear in.
     9First open the xml file of the level you want your dialog to appear in.
    1010
    11 In order to start a dialogue you will need an event which is triggered. You can for example create a distance trigger (plus a light so that you see where it actually is) that you fly through like this:
     11In order to start a dialog you will need an event which is triggered. You can for example create a distance trigger (plus a light so that you see where it actually is) that you fly through like this:
    1212
    1313{{{
    14 <DistanceTrigger name="test" position="100,0,100" target="Pawn" distance=25 stayActive="true" />
     14<DistanceTrigger name="triggerName" position="100,0,100" target="Pawn" distance=25 stayActive="true" />
    1515    <Backlight position="100,0,100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,1"/>
    1616}}}
     
    1818You should now see a violet light appearing in the game when loading empty level.
    1919
    20 == Add your first Question ==
    21 But when flying through it doesn't do anything yet, so let's add a first dialogue. The basic structure looks like this:
     20== Basis Dialog Structure ==
     21But when flying through it doesn't do anything yet, so let's add a first dialog. The basic structure looks like this:
     22Name should be the name of the person you want the player to talk to and currentQuestionId will be the starting point of the conversation
    2223
    2324{{{
    24 <NextQuestion  question="Your question" a1="First answer" a2="Second answer" >
     25<Dialog name="Max" currentQuestionId="start">
     26    <questions>
     27        ...
     28    </questions>
     29   
     30    <answers>
     31        ...
     32    </answers>
     33
    2534    <events>
    2635        <execute>
    27            <EventListener event="test" />
     36            <EventListener event="triggerName"/>
    2837        </execute>
    2938    </events>
    30 </NextQuestion>
     39</Dialog>
    3140}}}
    3241
    33 The middle part makes sure that your dialogue appears when your event is triggered. When you fly through the light now, the dialogue box should open.
     42The Questions and Answers part will be explained below.
     43The event part enables the dialog to be executed once the trigger is activated. Multitrigger does not work yet, because the dialog is not reset on leaving.
    3444
    35 == Create a proper dialogue ==
    36 For each answer you may define a next question as a followup. For example:
     45== Adding Text to your Dialog ==
     46A dialog without text would be prettey boring so we now will add text for the npc you are talking to and some replies.
     47In the interface a question is always some text the npc says and an answer is one possible option for the player to reply.
     48By linking the answers to a next question you can define how the npc reacts to the player saying someting. For the player you simply give the question all ids of the possible answers he could give.
     49You need to give each question and each answer a unique id but multiple answers can lead to the same question and multiple questions can give the same answer as an option.
     50
     51Structure of question section:
     52{{{
     53...
     54<questions>
     55    <Question Id= "someQuestion" question= "this is where you add the text you want to let the npc say">
     56        <answerIds>
     57            <AnswerId Id= "someAnswerId">
     58            <AnswerId Id= "maybeSomeOtherOptions">
     59            <AnswerId Id= "haveAsManyAsYouWant>
     60            <AnswerId Id= "orNoneThatsOkayToo">
     61        </answerIds>
     62    </Question>
     63
     64    ... list all questions in this area with the template from above
     65</questions>
     66...
     67}}}
     68
     69By giving no answerIds you can end the Dialog with a npc text.
     70
     71
     72Structure of answer section:
     73{{{
     74...
     75<answers>
     76    <Answer Id= "someAnswerId" nextQuestionId ="someQuestionId" answer= "this is where you add the text you want to give as a possible response" >
     77       
     78    ... list all answers in this area with the template from above
     79</answers>
     80...
     81}}}
     82
     83If you want to end the dialog on a player response simply chose a nextQuestionId that does not exist, best would be to always use the same (for example "end") but any string that is not a questionId will do.
     84
     85For both Question and Answer class it is possible to rearange the arguments but for readability and ease of use i recomend always defining ids befor text.
     86
     87== Example of a simple dialog ==
     88This is a simple example how everything together could look like but there are many more possibilities to use this structure.
     89(And probably more creative texts for those too) This can also be found in the DialogShowcase level to test it directly.
    3790
    3891{{{
    39 <NextQuestion  question="Your question" a1="First answer" a2="Second answer" >
    40       <possibleQuestions>
    41           <NextQuestion  question="Your next question if a1 was chosen" a1="First answer" a2="Second answer" />
    42           <NextQuestion  question="Your next question if a2 was chosen." a1="First answer" a2="Second answer" />
    43         </possibleQuestions>
    44     <events>
     92<Dialog name="Kurt" currentQuestionId="loop1">
     93      <questions>
     94        <Question Id="loop1" question="Wanna be looped?" >
     95          <answerIds>
     96            <AnswerId Id="yes"/>
     97            <AnswerId Id="no"/>
     98            <AnswerId Id="giveItToMe"/>
     99          </answerIds>
     100        </Question>
     101        <Question Id="lorem" question="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." >
     102          <answerIds>
     103            <AnswerId Id="endIt"/>
     104          </answerIds>
     105        </Question>
     106        <Question Id="loop2" question="Wanna be looped again?" >
     107          <answerIds>
     108            <AnswerId Id="yes"/>
     109            <AnswerId Id="no"/>
     110            <AnswerId Id="end"/>
     111          </answerIds>
     112        </Question>
     113        <Question  Id="ok" question="Guess not then"/>
     114      </questions>
     115      <answers>
     116        <Answer Id="giveItToMe" answer="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." nextQuestionId="lorem"/>
     117        <Answer Id="yes" answer="yeah loop me" nextQuestionId="loop2"/>
     118        <Answer Id="no" answer="i'd rather not" nextQuestionId="ok"/>
     119        <Answer Id="endIt" answer="i will go now..." nextQuestionId="end"/>
     120      </answers>
     121      <events>
    45122        <execute>
    46            <EventListener event="test" />
     123          <EventListener event="test"/>
    47124        </execute>
    48     </events>
    49 </NextQuestion>
    50 }}}
     125      </events>
     126    </Dialog>
     127}}} 
    51128
    52 Basically each question can have a vector (possibleQuestions) of following questions. If you define this vector make sure it has two elements (meaning two NextQestions). Now you can try out more nested strutures, have a look at the example level DialogueShowcase.oxw if you're lost. Enjoy!
     129Now you know all the basics and can try it for your self, go have fun with it!
    53130