How To Add Dialogue - A Long Awaited Tutorial

Posted in Modding Help
Unsubscribe from this topic
Another tutorial, aren't you all lucky?

Here's all the things you'll need to get making some beautiful dialog!

- Lucas' RCF Explorer - For getting the scripts needed.
- Lucas' RSD Converter - For adding the sounds.
- A file editor (e.g. Notepad or even better Notepad++)
- An audio editor for assuring your file is the right type. I use Audacity.
- Your actual sound file
- Your mod

Notes/Discoveries

- Conversations cannot exceed 9 lines. If you do exceed this limit, then it will play line 10+ first and follow it with the first 9 lines. Credit to Mike for this

Before I start, on another thread, Jake posted an example mod to show the structure, I'm going to post it here because it can be helpful to actually look through.

Mod Download

I'd like to thank Jake for putting this in a thread I found as a newbie, and also me for somehow working it out.

So today I'm making an official tutorial for dialog. Now dialog has quite a few uses. It can make the story flow and can also help when you want to add it to a driver that hasn't got any, for example, Moe in Housewife Duties.

Just a word of warning, dialog can get annoying and absolutely frustrating at times, but keep with it, as it can make a mod! I know for a fact that dialog was like "huh" when I first saw it, but now I can do it with my eyes closed.

First of all, we need to set up some paths in your mod.

\CustomFiles\conversations 
\CustomFiles\sound\scripts

Now we need a lovely file called dialog.spt, oh how we love the script.rcf file. This file is contained in the root game's folder. The file can be opened using Lucas' RCF explorer.


The script file is used to tell the game what dialog to find, how many pieces of dialog there are and what they are used for, but we can go more into that later on!

Get the file, open it and find a file called dialog.spt, right click and extract!


Put this file in the \CustomFiles\sound\scripts folder you made earlier on. Leave this file for now, we'll need it later on, though.

Dialog. It can be used in so many ways, but here I am going to teach you it in the sense of a conversation. Let's take a piece of example dialog naming that is used in Housewife Duties.

C_strange_1_convinit_Mrg_L1M1

Now let's pick this apart.

C = This tells the game what it's used for, here I am assuming it's standing for "conversation"
strange = This is the name of the dialog, here I used strange because it reminds me what the dialog is for.
1 = This here tells the game the order of the dialog and also the amount. Limits above.
convinit = This is telling the game that this is part of a player-NPC dialog, this part can have another use, which I'll tell you later.
Mrg = This is the character code, here I used Mrg to stand for - you guessed it - Marge. There are loads, with credit to Jake, I'm going to post the character codes on dropbox. Here (Jake did say that he was going to do documentation on this at one point, so if it does come out, I will replace the link)
L1M1 = This tells the game the level and mission that the dialog is used in, pretty straightforward here.

To actually get a dialog file, you need to extract one from dialog.rcf, also in the root game folder. Go into the file and go to conversations, extract a file (You can use the file name as a template) and put this file in the \CustomFiles\conversations folder you made earlier.



Next, sound files. You need to edit a piece of dialog, either from game or the show or whatever. The dialog MUST be a 24000hz 16-bit mono WAV file to actually work without crashing your game, you can check this when you import it into the RSD converter.


If this file is not a 24000hz 16-bit mono WAV file, it will crash when the dialog is played

Now we have the file sorted out, that's all you need. As long as it is named properly, is the right type and is in the right file, this shouldn't cause any issues.

Next we need the game to actually acknowledge that the dialog exists, so open dialog.spt.

Go to the bottom and add this, changing the dialog name to the one of yours.

create daSoundResourceData named C_strange_1_convinit_Mrg_L1M1
{
    AddFilename ( "conversations/C_strange_1_convinit_Mrg_L1M1.rsd" 1.000000 )
    SetStreaming ( true )
}

The files need to be named the same as the "daSoundResourceData" section.

This will now be able to be used.

Now make a dialog stage in your game, this is an example one from my m1sdi.mfk, if you use lua, change what you need.

AddStage();
	AddObjective("dialogue");
		SetPresentationBitmap( "art/frontend/dynaload/images/mis01_02.p3d" );
		AmbientAnimationRandomize( 1, 0 );      // ( pc=0, npc=1) (nonrandom=0, random=1)
		AmbientAnimationRandomize( 0, 0 );
		AddAmbientNpcAnimation( "none" );
		AddAmbientNpcAnimation( "none" );
		AddAmbientNpcAnimation( "none" );
		AddAmbientNpcAnimation( "dialogue_cross_arms" );
		AddAmbientNpcAnimation( "none" );
		AddAmbientNpcAnimation( "none" );
		AddAmbientPcAnimation( "none" );
		AddAmbientPcAnimation( "dialogue_hands_in_air" );
		AddAmbientPcAnimation( "none" );
		AddAmbientPcAnimation( "none" );
		AddAmbientPcAnimation( "dialogue_hands_on_hips" );
		AddAmbientPcAnimation( "none" );
		SetDialogueInfo("marge","lisa","strange",0);
	CloseObjective();
CloseStage();

The important part you'll need to change is this:

SetDialogueInfo("marge","lisa","strange",0);

"marge" is the name of the playable character, "lisa" is the name of the character that they're talking to (This can be different for some characters to their character code, but this is rare, the only one I can think of is svt turns to teen) and "strange" is the name of the dialog.

The objective must be ("dialogue").

Now open your game and go to that stage, it should work if everything is correct.

Issues that usually have causes:

Help, I've crashed!

Either you have really screwed up the stage or the file you used is not the correct type. It must be a 24000hz 16-bit mono WAV file, remember!

Erm my characters are staring intently into each other's souls? (Staring contest)

The naming may not be correct in your script file, this usually causes the game to endlessly try to find what you're referring to.

File not found??!?!?!

It means the game cannot find the file you're referring to in your dialog.spt, make sure the naming in your .spt file is correct and that the .rsd file is named correctly.

My computer blew up!?!?!?

That sounds like another issue, sorry!

Now let me explain another piece of dialog that is used in conversation.

C_alright_1_noboxconv_Mrg_L1M4

Now if you look, one part is different. This part is noboxconv

noboxconv is used to start dialog outside of a dialog stage. This dialog can be started instead with this:

SetCompletionDialog("alright");

at the end of a stage.

There is a difference if you have a non-playable character talking in this dialog, you need to use this instead.

SetCompletionDialog("alright","moe");

"moe" lets the game know what character is talking.

That's it for this tutorial, if any part is incorrect, please say and I will edit. If you have any issues, try going to #SHAR-Mod-Help in discord!
Great tutorial, wish I had this when I was learning how to add custom dialogue.
(For the record it took me 3 hours from previous explanations.)
Good tutorial!
I learned something about dialogue today that I think I should share here in order to save anyone the trouble: conversations cannot exceed 9 lines. If you do exceed this limit, then it will play line 10+ first and follow it with the first 9 lines.
[removed]2 years
I don't know why, but the 'SetCompletionDialog' didn't work for me. I extracted a .rsd file from 'agnes' folder and named it "p_hitbyw_agn_punk" --> "c_bring_1_noboxconv_agn_l1m0" I put the renamed file in my 'conversations' folder, I wrote the 'create daSound...' thing, I also wrote 'SetCompletionDialog("bring");' before the 'CloseStage();' AND it ends up just by Homer saying his line or not saying anything at all. Help please. :(

Note: I'm spamming every thread with my questions, so sorry, but I'm just curious and I know there are people who know stuff here...

P.S. I have not written anything in the CustomDialogueCharacterCodes file, if I do need to write something in there, please tell me what :D
If the completion dialog involves another character (in this case, Agnes, unless she is the player character in your mod), I think you need to specify them as the second argument to SetCompletionDialog.

SetCompletionDialog("bring","askinner");

I think they may also need to exist as a character in the world somewhere for this to work, be it as an NPC or a driver in a car.

EDIT: Updated to have the right internal name for Agnes.
Nope, did not work. I tried 'agnes' and 'askinner' (since that's her original file name). I tried changing the sound file's name, but nope.

'agnes' ends up with no line at all.
'askinner' ends up with Homer's line.
[removed]2 years

Here I took a screenshot of the files: what I wrote, where I've put the files and etc.

Edit: so it has to be 'askinner' and the files have to be named properly like other original files. I tested it out and it works now, but 'agnes' is not the correct name. 'agnes' would only work if the names in the art/char/askinn_m.p3d file would be changed from 'askinner' to 'agnes'
Unsubscribe from this topic
Please login to contribute to the conversation.