The Elder Scrolls - style dialog system

Started by Akatosh, Sun 08/04/2007 17:11:06

Previous topic - Next topic

Akatosh

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:
Code: ags

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


* Create the dialog dDialog with completly all options

* Put this in the dialog script:
Code: ags

@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:
Code: ags

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:

Code: ags

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


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

Code: ags

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  :=

strazer

Quote from: Akatosh on Sun 08/04/2007 17:11:06* Put this in game_start:
Code: ags

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?

Akatosh


Rui 'Trovatore' Pires

Is this similar to the Gabriel Knight 1 system?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk