Forum Mod Bakery Docs

SetDialogueInfo and Corresponding Dialogue Files

Posted in Support
Please login to contribute to the conversation.
Hello, very new here.

I was poking around in the script files and noticed that dialogue appears to be initiated by SetDialogueInfo(string, string, string, int);
However, the strings supplied look like something potentially hard-coded and not stored somewhere. Is it possible to add dialogue patterns for use with SetDialogueInfo(...) without overwriting old dialogue? That is--to add a new set of string to feed the function that will initiate dialogue using new sound files (i.e. SetDialogueInfo("homer","marge","newdialoguetopic",0);).

Thanks, and sorry if I missed something glaring!
Hi, welcome to Donut Team!

Yes, if i understand what you're asking, you can add more dialogue to the game and it's technically not hard coded. It's very odd though. I can reply with details, however I have a question. Are you editing your game files directly, or are using the mod launcher?
The mod launcher let's you create and play mods without overwriting your game. I can explain to you how to make a mod using it if need be.
I am planning to use the mod launcher in the future, but for now I am just fooling around in the script files. When I say dialogue I mean the voice files that are played sequentially, nothing to do with CustomText.

Thanks!
You can't do anything in the way of modifying sound scripts (which define Sound Resource Datas which are things like conversations between characters and driving dialogue) without using the Mod Launcher.

The scripts are stored in scripts.rcf. This is an archive format for the game that the PC version uses exclusively for sound related things like music, dialogue, and sound scripts.

You can Lucas' RCF Explorer which you can use to extract the files here.

You can modify them by extracting them to a mod's CustomFiles folder following the same structure as seen in the RCF file and modify them that way.

For example, you can find the file that adds all the Sound Resource Datas for the dialog in the game at:
scripts.rcf\sound\scripts\dialog.spt

But if a mod had it's own dialog.spt here, it would override that one:
Mod\CustomFIles\sound\scripts\dialog.spt

The reason that wouldn't work if you extracted to the games folder is that the game checks the RCF files for files before checking its folders normally.

However when using the Mod Launcher, the Custom Files hack in the mod launcher makes it check CustomFiles folders in any enabled mod for any files before the games folder including files normally found in an RCF file.
Yes I understand. This may be confusing, so i'll provide a mod you can download to see how I did all this at the end. If you have any questions, i'd be glad to help.

To achieve this, you'll need to use the following programs:
Lucas' RCF Explorer - For fetching the dialog script.
Lucas' RSD Converter - For importing new wav files for new dialogue.
Lucas' Simpsons Hit & Run Mod Launcher - To use the new dialogue script you're using. The game doesn't usually read it outside of the RCF file, and we currently do not have a tool that can build RCF archives.

All tools listed are available at: sharmods.donutteam.com/tools/

You can start by creating a folder and inside a file called "Meta.ini"

In the Meta.ini, you can name your mod and require the hack "CustomFiles". Here's an example of that file:
[Miscellaneous]
InternalName=NewDialogueExample
Title="New Dialogue Example"
Description="A demo mod for adding new dialogue."
Version=1.0
Main=1
Category=Test Mods

RequiredHack="CustomFiles"

[Author]
Name="Jake Andreoli"

Now create a folder called "CustomFiles". Inside this, you can place new Pure3D and scripts that the mod launcher will tell the game to read instead of the game's version of the file. Inside that folder, you'll need to replicate the game's folder structure. So something like:
CustomFiles/scripts/missions/level01/

Then inside that "level01" folder place a mission file you want to add new dialogue to. In my example, I used the premission of level 1 mission 1 (not the tutorial mission!). I then updated the newly copied version of m1sdi.mfk to use the dialogue "newdialogue" between homer and marge.
SetDialogueInfo("homer","marge","newdialogue",0);

Now create a folder called "sound" inside "CustomFiles". Inside the "sound" folder, create a folder called "scripts". Then using Lucas' RCF Explorer, open "scripts.rcf". Look for "dialog.spt" and extract it. Then place it in your "sound/scripts" folder.

Edit the dialog.spt and add something like this at the bottom:
create daSoundResourceData named C_newdialogue_1_convinit_Mrg_L1M1
{
    AddFilename ( "conversations/C_newdialogue_1_convinit_Mrg_L1M1.rsd" 1.000000 )
    SetStreaming ( true )
}
create daSoundResourceData named C_newdialogue_2_convinit_Hom_L1M1
{
    AddFilename ( "conversations/C_newdialogue_2_convinit_Hom_L1M1.rsd" 1.000000 )
    SetStreaming ( true )
}

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

C = Conversation
newdialogue = Conversation name
1 = Sequence ID (The order of the dialogue)
convinit = convinit is a normal dialogue stages. noboxconv is used for stage completion dialogue.
Mrg = Character speaking the dialogue.
L1M1 = Mission that this takes place. Sometimes not put depending on circumstances I personally do not understand.

I've provided my documentation at the bottom of this post explaining as much as I personally know on these. I left more detailed information below.

For the actual dialogue, you can extract an RSD file (I recommend from "dialog.rcf" and inside the "conversations" folder - any used for dialogue will work). Then use Lucas' RSD Converter and import a WAV file. When importing the WAV file, make sure it is mono sound with a sample rate of 24000.

So once this is done, you should get a new dialogue. I feel like I left steps out, but as I stated before, I would leave you with a mod download:

Mod Download

If you have any questions, please do not hesitate to ask. One of us would be glad to help you.

Extra information:

Here's information on the SPT file we have in our private documentation that we're preparing to release in some way. It's a bit messy and hard to understand, but I can explain anything you need to know:
------------------------------------------------
FIRST FIELD
------------------------------------------------
C = Conversation
D = Driving
P = Pedestrian
V = Mission(?)
W = Walking

------------------------------------------------
SECOND FIELD (D/P/V/W) - What kind of 
------------------------------------------------
doorbell=Called on door bell
door=When the player is trying to enter a companion's car and it's on the wrong side.
answer=Answering Machines (Unused)
hitbyc=Hit by car
dodge=When an NPC dodges attack. (Unused?)
hitbyw=Hit by walker (kicked; Unsure?)
pass=Passing a player during a race
passed=Player passes you during a race
aidedestroy=Destroying an AI car (Unsure?)
objectw=Collecting cards and other objects while walking
card=Collecting a card
char=Probably kicking a character repeatedly(?)
activate=Pressing a button
burn=Unknown what event triggers this, though used. Burning out? Driving fast?
breakca=Believed to be triggered by breaking a wasp camera. It may be unused, unsure.
air=Getting air time (driving)
arrive=Arriving at a destination
bcrash=Crash Vehicle
break=Break object(?)
carway=Car in the way on the road
damage=Taking damage in car
dcar=Car Damaged (?)
newai=When a new AI is spawned(?)
hitp=Player hit pedestrian
ridereply=Asking for a ride, NPC response
foodreply=Replies when talking to NPC about Food
mvic=Mission Victory
mfail=Mission Failure
missp=Narrowly missed a pedestrian
time=Running out of time
gic=Get in car
goc=Get out of car
nhitbyc=NPC Hit by Character
idlereply=Driving with multiple people(?)
askride=Phonebooth Car Request
askfood=Talking to Apu when hungry. May also work with Moe
turbo=Character Running
springboard=A player jumping on vent
fall=Character falls in area they can't go into. Ex: Water

------------------------------------------------
THIRD FIELD (D/P/W/V) - FOURTH FIELD (C)
Lists the players' codes
------------------------------------------------
Agn=Agnes Skinner
Apu=Apu Nahasapeemapetilon
Bee=Bumblebeeman
Brn=Barney Gumble
Brt=Bart Simpson
Bur=Mr. Burns
Cbg=Comic Book Guy
Clt=Cletus Spuckler
Frk=Professor Frink
Crl=Carl Carlson
Len=Lenny Leonard
Hom=Homer Simpson
Mrg=Marge Simpson
Lis=Lisa Simpson
Hib=Dr. Hibert
Gil=Gil Gunderson
Hbn=Homer Brain (L1M2)
Bkm=Kent Brockman
Rod=Rod Flanders
Todd=Todd Flanders
Sea=Sea Captain
Smi=Smithers
Snk=Snake
Skn=Principal Skinner
Svt=Squeeky Voiced Teen
Qim=Mayor Quimby
Pat=Patty Bouiver
Sel=Selma Boiuver
Jim=Jimbo Jones
Dol=Dolph Starbeam
Nic=Dr. Nick
Grp=Grandpa Simpson
Mol=Hans Moleman
Jas=Jasper Beardly
Kea=Kearney Zzyzwicz
Kru=Krusty The Clown
Loe=Louie (Mobster)
Lou=Lou (Cop)
Mil=Milhouse Van Houten
Moe=Moe Szylak
Nel=Nelson Muntz
Oto=Otto Mann
Ral=Ralph Wiggum
Kod=Kodos
Kan=Kang
Wil=Groundskeeepr Willie
Wig=Chief Wiggum
Fla=Ned Flanders
Mn1=Man 1
Mn2=Man 2
By1=Boy 1
By2=Boy 2
Fm1=Female 1
Fm2=Female 2
Gr1=Girl 1
Gr2=Girl 2
Vm1=Used for Traffic
Vm2=Used for Traffic
Vm3=Used for Traffic, Unused?
Vm4=Used for Traffic, Unused?
Vf1=Used for Traffic, Unused?
Vf2=Used for Traffic, Unused?
Zom=Zombie (Zom)
Zm1=Zombie 1 (Zm1)
Zm2=Zombie 2 (Zm2)
Zm3=Zombie 3 (Zm3)
Zm4=Zombie 4 (Zm4)
Leg=Legs (Unused)

-----------------------------------------------------------------------------------
Conversation Documentation:
Conversations are different from the normal sound fields.
-----------------------------------------------------------------------------------
1st Field = C
2nd Field = Conversation Name
3rd Field = noboxconv OR convinit
4th Field = Player Code (ex: hom for homer)
5th Field = The Mission where the dialog is used. (ex: L1M1 / L1R1 / L1)
Wow, thanks a lot for all of this. I had seen the dialogue document but did not make the connection with the name of the resource. I do understand how to use Lucas' tools, but I was unfamiliar with the archive structures.

That final document is extremely useful. If it is not already available I suggest publishing it! Have you thought at all about outlining function usages and correlating files in a Javadoc or similar documentation system?

If not I might resign myself to starting one when I get home.

Thanks for this overwhelming help!
We're working on a documentation website alongside the other things we're working on but there's a lot to document so it'll take some time.