Game Development Community

Conversation Tools

by Kevin Epps · in Torque Game Builder · 03/13/2007 (12:23 pm) · 12 replies

Anyone know of any convo tools that could be integrated into TGB?

Right now, I just need something that can do dialog between characters. RPG style typewriter effect would be nice as well.

Anyone know of anything?

#1
03/13/2007 (12:37 pm)
As noted earlier in a topic on this, it would be a good idea to separate the interface elements (dialog) from the conversations (dialogue) to avoid confusion.

AFAIK, there are not any pre-spun solutions for TGB yet. There are a number of projects, including a conversation tree resource, but I do not know how difficult they would be to include (requiring a Pro license and some programmer elbow grease to get them from TGE 1.2 to TGB). There was also a promising TGB project that was blogged about a little while back about conversation trees in TGB.

Good luck!
#2
03/13/2007 (12:53 pm)
I didn't read this thread ... no I did not ...


Every time I read an interesting thread, thoughts go swarming all around ... and next thing I know, code comes flying out of my fingers ...

Problem is ... I can't focus on one thing long enough ... so, I'm gonna pretend I didn't read this thread :)
#3
03/13/2007 (1:10 pm)
I converted the RPGDialog resource from TGE to TGB... I don't remember if there were code changes, or if it was all script based. But if you have a PRO license, it doesn't really matter. Let me know if your interested, and I'll see about pulling it out for you...
#4
03/13/2007 (1:35 pm)
Yeah, I have a Pro License. If it's not too much trouble, could you send that to me, or post it?

If you'd rather email, my email is eppskevin@yahoo.com.

Thanks, Eric!

@DavidH: Sorry! :)
#5
03/13/2007 (2:00 pm)
I'll pull it out tonight and see about getting it into a resource, or get it setup for those interested to download...
#6
03/13/2007 (2:01 pm)
Thanks again, Eric. You're a hero, man!
#7
03/13/2007 (3:32 pm)
Ok, looks like this is all script based.... You'll need to download the zip file of course, then in the zip file there is a directory named DialogEditor. Just drop that directory inside the tools/resources directory of TGB. This will add an option to start up the dialog editor from within the level builder. You will see an option for it in the project menu, or you can shortcut it with ctrl-d.

Next is the dialogs directory. Just drop that within the data directory of your game. This contains the files that hold the various conversations, the images for NPCs and players, and any sounds you want to tie to conversations.

Finally, you have Dialog.cs and RPGDialog.gui. Put Dialog.cs in the gameScripts directory of your game, and the RPGDialog.gui file in the gui directory of your game. Don't forget to add exec calls for both.

The last piece you'll need to do, is to add items that allow you to assign conversation files to NPC. You'll want to do that within the configDatablocks.cs file for your project. Below is an example of what I had. I have the AdventureKit, so I'm simply sub-classing the player class of that.

datablock t2dSceneObjectDatablock( AiNPCConfig : PlayerConfig )
{ 
   enemyClass = "NO_ATTACK";
   class = "AiNPC";
   superclass = "Player";
   fireRate = 0;
   attackDist = 0;
   
   RPGDialogScript = "Test";
   RPGDialogPortrait = "Test.png";
   RPGDialogStartQuestion = 1;
   RPGDialogBusy = false;
   RPGDialogBusyText = 'Sorry but I\'m busy talking to %1 right now.';
   RPGDialogTalkingTo = 0;
};

Obviously the important pieces of the things that start with RPGDialog. With those items in the datablock, then anytime you set a sprite to that datablock within the Editor, you will have those fields available for editing.

As I said, I have the AdventureKit in with this project also, so I might have used some calls to some of the functions from there in the dialog system. If you don't have the AdventureKit, you should get it, or just let me know where there are issues, and I can code up alternative functions.

Ok, here is the link Dialog TGB System

It's been a while since I looked at this, so you may run into some issue with it. If you do, just let me know and I'll try and help you at as much as I can.

Oh, and one more thing I forgot... At the top of the Dialog.cs file, there are a number of preferences you need to set for you project...
#8
03/13/2007 (3:37 pm)
Oops... Another thing I forgot...

Add the following to your profiles.cs in common/gui:

new GuiControlProfile ("RPGDialogQuestionProfile")
{
   fontType = "Arial Bold";
   fontSize = 16;
   fontColor = "44 172 181";
   fontColorLink = "255 96 96";
   fontColorLinkHL = "0 0 255";
   autoSizeWidth = true;
   autoSizeHeight = true;
   border = false;
};

new GuiControlProfile ("RPGDialogAnswerProfile")
{
   fontType = "Arial Bold";
   fontSize = 16;
   fontColor = "44 172 181";
   fontColorLink = "255 96 96";
   fontColorLinkHL = "0 0 255";
   autoSizeWidth = true;
   autoSizeHeight = true;
   border = false;
};

new GuiControlProfile ("RPGDialogScrollProfile")
{
   opaque = true;
   border = false;
   borderColor = "0 255 0";
   bitmap = "./images/scrollBar";
   hasBitmapArray = true;
};

new GuiControlProfile ("RPGDialogBorderProfile")
{
   bitmap = "./images/darkBorder";
   hasBitmapArray = true;
};

if(!isObject(RPGWindowProfile)) new GuiControlProfile (RPGWindowProfile)
{
   opaque = true;
   border = 1;
   fillColor = "211 211 211";
   fillColorHL = "190 255 255";
   fillColorNA = "255 255 255";
   fontColor = "0 0 0";
   fontColorHL = "200 200 200";
   bitmap = "./images/demoWindow";
   textOffset = "5 20";
   hasBitmapArray = true;
   justify = "center";
};
#9
03/13/2007 (4:12 pm)
Thanks, Eric. It works for me just fine.

I do have a question, though. Can I use this to just go back and forth between to characters, without questions?

Like in Megaman X, there's a part that just shows Megaman and another character talking, and you just hit a button to advance to each sentence.

Like:

Megaman: How DARE You? (Hit A)
Boss: Because you're WEAK!! (Hit A)
Megaman: Well, we'll see about that!! (Hit A)
etc....
#10
03/14/2007 (9:08 am)
You'd have to do some scripting to get that, but it should be possible...

You would just create an action that would move to the next part of the conversation, and bind a call to that action to whatever key/button you want... Or put a "continue..." link as the only response...

If you study the Dialog.cs file, you'll see how it reads in questions and possible responses from the two types of files. You can also look at the files themselves, as they are just XML files. Then you could just use the methods to read the information in, and setup whatever kind of GUI you want to handle the display...

I'd whip something up for you, but I'm in the middle of a big paid project, so I don't have a lot of free time at the moment. If you give implementing it a shot, and run into any specific issues, I can lend my advise...
#11
03/14/2007 (9:10 am)
Actually, you helped me a great deal!

I figured I would have to do some scripting for that, but didnt' know if RPGDialog already did that for you or not. Thanks, Eric!

You've given me a place to start now! :)

I'll let you know if I get stumped.
#12
03/14/2007 (9:14 am)
Eric, I haven't even looked at this yet, but it's a question that's been on my "list of things to look into" for a while.

You're a champ for sharing this, thanks a bunch!