Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 2 and Version 3 of content/DialogHowTo


Ignore:
Timestamp:
May 26, 2017, 3:31:54 PM (7 years ago)
Author:
rrogge
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • content/DialogHowTo

    v2 v3  
    22
    33This tutorial will show you how to implement dialogue boxes in a level file.
     4
     5Example: DialogueShowcase.oxw
     6
     7== Create an event & trigger ==
     8
     9First open the xml file of the level you want your dialogue to appear in.
     10
     11In 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:
     12
     13{{{
     14<DistanceTrigger name="test" position="100,0,100" target="Pawn" distance=25 stayActive="true" />
     15    <Backlight position="100,0,100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,1"/>
     16}}}
     17
     18You should now see a violet light appearing in the game when loading empty level.
     19
     20== Add your first Question ==
     21But when flying through it doesn't do anything yet, so let's add a first dialogue. The basic structure looks like this:
     22
     23{{{
     24<NextQuestion  question="Your question" a1="First answer" a2="Second answer" >
     25    <events>
     26        <execute>
     27           <EventListener event="test" />
     28        </execute>
     29    </events>
     30</NextQuestion>
     31}}}
     32
     33The 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.
     34
     35== Create a proper dialogue ==
     36For each answer you may define a next question as a followup. For example:
     37
     38{{{
     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>
     45        <execute>
     46           <EventListener event="test" />
     47        </execute>
     48    </events>
     49</NextQuestion>
     50}}}
     51
     52Basically 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!
     53