| | 4 | |
| | 5 | Example: DialogueShowcase.oxw |
| | 6 | |
| | 7 | == Create an event & trigger == |
| | 8 | |
| | 9 | First open the xml file of the level you want your dialogue to appear in. |
| | 10 | |
| | 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: |
| | 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 | |
| | 18 | You should now see a violet light appearing in the game when loading empty level. |
| | 19 | |
| | 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: |
| | 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 | |
| | 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. |
| | 34 | |
| | 35 | == Create a proper dialogue == |
| | 36 | For 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 | |
| | 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! |
| | 53 | |