Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Akatosh on Sun 08/04/2007 17:11:06

Title: The Elder Scrolls - style dialog system
Post by: Akatosh on Sun 08/04/2007 17:11:06
So I thought: if you script a dialog system for someone, you can copy it over to the Tech Forum, too.


Quote from: ciborium on Sun 08/04/2007 14:03:22
Can I make a topic list that can be added to and removed from throughout the game, where only those key-words bring up conversation topics?

My workaround would be:

* Put above game_start:

Character *cOtherguy;
//this creates a pointer we'll use later.


* Create the dialog dDialog with completly all options

* Put this in the dialog script:

@S
return
@1
run-script(1);
//if you want, you can put additional stuff here, e.g. stop (remove return then)
return
@2
run-script(2);
//same here
return
//and so on, do this for every dialog topic.
//NOTE: create the options first, it will make the @S, @1, @2 and so on appear!
//also, remove the text behind //.


* Now create properties, as many as you have topics. They must be named 1, 2, 3, 4, 5 and so on. Create them as strings and set their respective properties to what you want that character to say about topic 1, 2, 3...

* Put this into dialog request:

String prop=String.Format("%d",parameter);
cOtherguy.Say(cOtherguy.GetProperty(prop));


//after that you can still use what dialog_request was intended for. for example, if option 6 gives you an item:


if (parameter==6) player.AddInventory(inventory[2]);


* Put the following interaction in "talk to character":


cOtherguy=Character.GetAtScreenXY(mouse.x, mouse.y);
dDialog.Start();


* If you want to turn options of that dialog on and off, just use the Dialog.SetOptionState command. It's described in the manual.

---

So, if you use it in your game, please give me credit  :=
Title: Re: The Elder Scrolls - style dialog system
Post by: strazer on Sun 08/04/2007 17:18:35
Quote from: Akatosh on Sun 08/04/2007 17:11:06* Put this in game_start:

Character *cOtherguy;
//this creates a pointer we'll use later.


Putting this into a function makes it local and so it gets destroyed when the game_start function finishes running.
You probably mean to put it outside of all functions, on top of the global script?
Have you actually tested this?
Title: Re: The Elder Scrolls - style dialog system
Post by: Akatosh on Sun 08/04/2007 17:20:18
Whoops - a typo. I meant "above".
Title: Re: The Elder Scrolls - style dialog system
Post by: Rui 'Trovatore' Pires on Sun 08/04/2007 17:32:26
Is this similar to the Gabriel Knight 1 system?