2

 

 

Interactive dialogs, examples

 

1. a dialog loop

You have written 3 dialogs for the entity no. 001 (ent001.dat). Now becomes in the third dialog at "ANOTHER ENTITY" under Input '1' and under Entity also '1' typed in. The name "ANOTHER ENTITY" is chosen badly. The current entity also can be changed.

DIALOGNUMBER

ACTUALY ENTITY

ANOTHER ENTITY

 

INPUT

OUTPUT

INPUT

ENTITYNUMMER

1

1

2

0

0

2

2

3

0

0

3

3

4

1

1

 

What happens here? Dialog no.1 is played. At the next meeting dialog 2 comes. And at the overnext meeting dialog 3 then appears. In the third dialog the input by entity 001 put back on 1. You can it see in the third line of table under ANOTHER ENTITY. A loop has arisen. Comes the player a fourth on visit now starts again with the first dialog.

Without this entry in the third dialog properties it would be a linear dialog! The third dialog then would always be repeated.

 

2. a NPC changes the dialog by event with another NPC

You have two entitys. NPC no. 001 (ent001.dat) you have visit repeatedly. He tells first, he has which lost a little. He asks you to search for it. At the next visit he asks whether it gives a new. No, you have found nothing. At the third visit he says hardly anything. You go to a another NPC no.099 (ent099.dat) and it this tells this to you exactly these found object has. It gives it to you. Very good!. Back to the first entity and give him the lost. He thanks you and you get a fat reward. You still go to it a fifth (the game programmer perhaps has slept and there still is a reward)  but is only said now "hello".

 

DIALOGNUMBER

ACTUALY ENTITY NO. 001

ANOTHER ENTITY

 

INPUT

OUTPUT

INPUT

ENTITYNUMMER

1

1

2

0

0

2

2

3

0

0

3

3

4

3

1

4

4

5

0

0

5

5

6

0

0

 

DIALOGNUMBER

ACTUALY ENTITY NO. 099

ANOTHER ENTITY

 

INPUT

OUTPUT

INPUT

ENTITYNUMMER

1

1

2

4

1

2

2

3

0

0

 

So the tables look for the two entitys. No.001 has lost something and cry 3 dialogs to this find it. In the third dialog it mustn't go on with the fourth one. Then there is the dialog with the reward write. Do you see the third line in the table by ACTUALY ENTITY NO. 001 ? The ANOTHER ENTITY input stand on '3' ! And this Entity is changed no.001 ! So the same! As of now the third dialog permanently is repeated. Finite is NPC no.099 found. He tells in the first dialog of the find and gives it to you. This one gets the NPC no.001 simultaneous under ANOTHER ENTITY Input put on the fourth dialog. One goes, it still tells no.099 a second for what a different one in dialog 2 and this then permanently is repeated. OK. Back to no.001 .  Yeah!!! The fourth dialog finally appears with the reward now.

 

3. a NPC changes the dialog because of other events in the game

The best for the end. With your own scripts, every dialog, every arbitrary entity, can be played ! It everything isn't possibly all wishes packing an editor. The editor principle is simple. The next dialog of all entitys is stored in an array. Dialog number of one, much or all entitys is the desired entered to this array. That's all! You have the possibility now of starting dialogs when ever you want!

What does happen if the player meets a NPC?

1. The player scans an entity.

2. The ENTITY number is read from the ENTITYSKILL (one of the predefined 48 entity skills).

3. The ENTITY number is at once the "entXXX.dat"  file's number.

4. This file is opened and read.

5. The same are also ENTITY number and array position.

6. The next dialog number is at this array position.

7. The dialog with this number is played.

8. The next dialog number is written to the array position.

So it works. You can mention the array and after wish change.

An Array can be defined in 3DGS A6 with at most 500 start values!  I need 2 arrays be managed for approximately 1000 entitys here.

dia1_array manages the next diaog number for entity no.1- 499, dia2_array manages the next dialog number for entity no. 500- 998. You can see the two arrays in the "dialog.wdl". They are filled with '1' at every position. This indicates all entitys put to the first dialog on game start.

 

Here one example. The player runs over an object and cancels it. A NPC shall and it recognize this having effect after that.

The NPC has the ENTITY number 321.

The function to these find one for object by the player you must write. Into this function you can append the dialog code now.

 

//"filenumber", "dia1_array" and "dia2_array" are predefined in"dialog.wdl"

 

 var next_dialog;  //next dialog number

 

filenumber = 321;   //the ENTITY number, typing in these number in one of the 48 skills to your NPC model!

next_dialog = 6;    // the 6. dialog comes next

 

 if(filenumber < 500) {

     dia1_array[filenumber] = next_dialog;

                                   }

 if(filenumber >= 500) {

 

     dia2_array[filenumber - 500] = next_dialog;

                                     }

 

That's all. The player finds the object (its your script). The 6th dialog for NPC 321 is entered. Meets the player of this entity becomes this dialog.

 

Dataformat of a dialogfile

With the help of the editor the complete dialogs of a game can be created. For every NPC(entity) one becomes separate file created with the following format.

entXXX.dat                                    XXX = 001-996

The extension "dat" is chosen only arbitrarily. These are pure text files. The files aren't encoded.

 

Structure of a dialogfile

( 000 255 000 entityname) [  1 002 014 008 02 ] |-------- |--------- | --------- [ 1 003 000 000 03 ] ...................

 

( 000  255  000 entityname )

basicdata

color entity text (RGB), entity name

[ 1  002  014  008  02 ]

basic 1. dialog

who starts this dialog? 1= player 2= entity,

 

 

next dialog number 002

 

 

change next dialog of this entity number 014

 

 

the next dialog number of this another entity 008

 

 

texteffect 02

| --------------

 

start marker of a dialog part, behind the text

[ 1 003  000 000  03  ]

basic 2. dialog

see 1. Dialog e.t.c.

 

You can easy edit a "entXXX.dat" dialog file with a text editor. NOTE! IF you use an text editor, the line number of dialog parts must always be divisible through the textbox lines! Has the write less lines, fill up with the char for linefeed.

 

Structure of the "diabasic.wdl"

Within the editor different global settings can be changed, these after exiting this one program be stored in a "diabasic.wdl". Attention !!! You can change the values in the file wih a editor. Not changing any letter but otherwise.

ENTNUMSKILL    01

one of 48 entity skills

TEXTLINES           00

number of text lines in the textbox

EFFECTTEMPO      0

speed of the text representation 0-9

PTRED                  255

Red     textcolor player

PTGREEN            255

Green textcolor player

PTBLUE                255

Blue    textcolor player

 

 

D_AUTOSTART      0

then '1' start dialogs if automatically, this is condition that entity starts the dialog

D_STARTTYP          0

0 = start dialog automatically, no matter who starts

 

1 = ENTER

 

2 = SPACE

 

3 =  D

 

4 = left mouse button

 

5 = right mouse button

 

6 = joystick button 1

 

7 = joystick button 2

 

8 = joystick button 3

 

9 = joystick button 4

D_HORSCAN       360

player scan arc horizontal, to find a entity

D_VERTSCAN     360

player scan arc vertical, to find a entity

D_SCANRAD     0200

scan radius around the player

DIABOXPOS_X   0000

x position of text background bitmap + text

DIABOXPOS_Y   0000

y position of text background bitmap + text

DIABOXOFF_X   000

x text offset adjust to textbox

DIABOXOFF_Y   000

y text offset adjust to textbox

BOXOVERLAY       0

overlay flag, text background bitmap

BOXTRANSPARENT 0

transparent flag, text background bitmap

BOXALPHA          050

alpha value, text background bitmap

BOXVISIBLE         1

visible flag, text background bitmap

BOXD3D                 1

D3D flag,text background bitmap

 

Manage several projects

Thats easy. Cut the "diabasic.wdl" and all created "entXXX.dat" files from the directory of this one NPC Dialog editor from and it copies into a directory of your choice. Start the editor.  It is again in the initial position.

 

Mirek Thier (Lolek) August 2003