Game Development Community

dev|Pro Game Development Curriculum

RPGDialog - NPC interaction system

by Nelson A. K. Gonsalves · 11/29/2002 (12:27 pm) · 186 comments

RPGDialog is a Torque Game Engine modification that adds standard RPG Dialogs support, including multiple choice questions and question linking(underlined words on a question that perform actions when clicked on). Also included is an editor for creating and editing dialogs easily.

Instructions on installing are included on the zip file.

New download location since geocities is dead

Have fun using it! :)
And let me know of any problems you might find.

Contact me at dk_uo@yahoo.com or leave a comment here.

Features

- Multiple choice questions, present a question and a list of answers and do something depending on which answer the player picks, the choices are numbered and can be picked either by the mouse or by pressing the 1,2,...,9,0 keys on the keyboard, choices after 10 must be selected via mouse.

- Question Links, Ex: "Hello, I'm Mary, how are you?" clicking on the word Mary would trigger an action as if it was a choice in the Multiple choice window.

- Portraits, pictures that represent the NPC, change it depending on the choices of the player or even use them to show the mood of the NPC.

- Sounds, add voice overs or any sound effects that are triggered when the question is displayed.

- Fully functional in multiplayer games, only allowing one player to talk to each NPC at a time, sending a message telling the others that the NPC is busy if they try to talk to it.

- Moving the player too far away from the NPC closes the Dialog automatically.

- Each option triggers a function, allowing complete customization of the actions caused by the dialog, either by using the included functions, altering them or creating your own.

June 8th 2005.
I finnaly got around to giving this a much deserved update!

Firstly I updated the instructions and made a few changes to make it fully compatible with TGE 1.3.

Also I've added buttons to move the answers up and down in the editor, so its now easier to organize the available options.

And finnaly, multiple actions can now be triggered by one response, thanks goes to BrokeAss Games for the idea. To execute multiple actions just add them one after the other without anything separating them, there is one example of this in the test scripts. Ohh, and now clicking on the actions list will add them to the actions edit and not replace them.

I have one warning though, version 1.0 .dla files are incompatible with version 1.3, there is an easy workaround I've used on my files, just open them directly in a text editor and do a quick replace all from "<" to "<END><", add <END> to the end of each line and remove the <END> from the beginning of the line, that should make them 100% compatible.

Let me know if you find any problems.

-Nelson

About the author

Recent Blogs

#21
01/14/2005 (11:05 am)
I see from Dan's posting that it is possible to use this resource with starter.fps. I am using 1.3 with starter.fps. When I hit F5, I see the dialog boxes without any problem but spawnTestNPC and SpawnNPC generate errors saying that the functions cannot be found. I did move the datablock PlayerData(LightMaleHumanArmor) from the "demo" to the starter.fps as Dan suggested but that doesn't help. So, how can I create an NPC and link it to the dialog?
By the way (stop laughing!), I understand the concept of an NPC but what do the initials stand for - nobody ever seems to write it out!). Thanks.
#22
01/15/2005 (9:07 am)
NPC = non-player character

Does anyone know how I can get spawnTestNPC or SpawnNPC functions into the 1.3 starter.fps? Or, is there another way to get rpgdialog to work with 1.3?
#23
01/17/2005 (5:26 am)
Quote:
spawnTestNPC and SpawnNPC generate errors saying that the functions

Is your .cs file that contains those functions compiling? Check the console.log and see that you don't have errors in that file.
#24
01/18/2005 (11:37 am)
Hi Dan. Thanks for your comments. The console just said that the functions could not be found. I'm using 1.3. Maybe an early version of the SDK contained those functions. I've looked through the starter.fps and common scripts and am going to check some of the other mods (starter.racing, demo etc) when I get home. I'll also check in an older version of Torque. If anyone knows where to locate spawnTestNPC and SpawnNPC, please let me know! Thanks.
#25
01/20/2005 (8:09 pm)
Judith,

spawnTestNPC and SpawnNPC are functions created with this resource. These functions are located in the RPGDialog.cs file. For me, the RPGDialog.cs file was "included" within the init.cs file with the following lines:
// RPG
exec("./scripts/RPGDialog.cs");

// RPG
exec("./scripts/RPGDialogAudioProfiles.cs");

As a result, those functions shouldn't require any particular version of Torque. Is your RPGDialog.cs being compiled correctly or included correctly?
#26
01/21/2005 (11:07 am)
Thanks again Dan. I accidentally copied the RPGDialog.cs file into the wrong directory. Everything is working great now. This is an awesome resource. I can really use this one!
#27
01/21/2005 (5:39 pm)
Not a problem. Glad you got it working.
#28
02/04/2005 (1:34 am)
I sorta got this implemented last night, it was pretty cool...

I worked it into the fps demo... but, I ran into a couple problems...

1) I don't want to delete my config.cs, it has important binds in there...
2) Possibly as a result of this, possibly as a result of installing the hitbox resource... I can't seem to activate the Talkto Function using my keyboard.
3) I just copied the playerdata datablock and named it lightmalehumanarmor... seemed to work but could be the source of my problems...

What I have to do is look at the ID of the NPC, and do Talkto(IDNum); from the console... but I have to be standing EXTREMELY CLOSE! All the functions and the editor work though!

A couple questions:

1) How can I increase the distance from which I can talk to the NPCs?
2) Any idea why I can't call talkto from the keyboard and how I can fix that (I'm a script n00b).



Overall this is one of the best Resources i've ever seen... if more people would put work like this into making resources, getting games done would be a lot faster. THANK YOU!
#29
03/01/2005 (6:25 pm)
Wow I can't believe how old this resource is and it STILL works AS-IS!
That said make sure to change the line in AiSpawn that reffers to LightMaleHumanArmor to DemoPlayer, and it shouldwork like a charm!

Enjoy!
#30
03/09/2005 (3:49 pm)
I have a question.. is it possible to add voice (wavs) to play along with the dialogue?
#31
04/02/2005 (5:36 pm)
In the console there are this error:

rw/server/scripts/RPGDialog.cs (194): Unable to instantiate non-conobject class AIPlayer.
Set::add: Object "0" doesn't exist
rw/server/scripts/RPGDialog.cs (198): Unable to find object: '0' attempting to call function 'setMoveSpeed'
GROUP = -1
Missing spawn points group MissionGroup/PlayerDropPoints
rw/server/scripts/RPGDialog.cs (199): Unable to find object: '0' attempting to call function 'setTransform'
rw/server/scripts/RPGDialog.cs (200): Unable to find object: '0' attempting to call function 'setEnergyLevel'
rw/server/scripts/RPGDialog.cs (201): Unable to find object: '0' attempting to call function 'setShapeName'
#32
04/08/2005 (9:05 am)
No answer?
#33
04/08/2005 (11:31 am)
Robert... I will be looking at this resource soon... Maybe we can work together to find a solution for you. I haven'
t downloaded the files yet, but the fix is probably fairly easy.
#34
04/08/2005 (5:12 pm)
Oh sorry.I know is easy but i don't find fix.Tnx for answer :D
#35
04/08/2005 (5:14 pm)
Are you executing AIPlayer.cs in the game.cs script?
#36
04/09/2005 (8:39 am)
i need excuting AIPlayer.cs in the game.cs? i exec AIPlayer.cs previous.
#37
04/09/2005 (1:38 pm)
it still needs to be executed in game.cs... exec("./AIPlayer.cs");
#38
04/10/2005 (4:12 pm)
tnx. i try.
#39
04/12/2005 (7:59 am)
Roberto. Did you manage to get teh Dialogs working properly? Did you get your AIPlayer error fixed?
#40
04/13/2005 (2:36 am)
There seems to be a pretty nasty bug in this resource.

There are two GotoQuestion global functions in this resource... one is used by the editor and the other is an action fired from a dialog option. It seems that depending on the order you exec the two script files one function or the other will be called. If you exec the action GotoQuestion second then none of your dialog goto question actions will function.

To fix it simply change GotoQuestion in RPGDialogEditor/editorMain.cs to something different like GotoQuestionED ... change all instances except for the case statement in updateAction().

This fixes it right up.