Jump to content

guide: creating narrative moments


davidlallen

Recommended Posts

When Bradford or one of the other cast pops up in a window in the upper right corner and says something, that is a narrative moment. This guide will tell you how to make new narrative moments. If you have a new enemy type or new mission, you may want to add these to help the player understand what is happening.

 

The following steps are involved.
1. Modify the unrealscript to call the new moment
2. Edit ini file
3. Record the wave files
4. Create the package with the wave files
5. Compile and Test

 

This guide assumes you know how to setup a mod using the SDK, create a wave file with the recorded lines, and open the unreal content editor. There are guides on this forum for using the SDK and the content editor.

 

1. Unrealscript

 

The easiest place to add a narrative moment is when sighting a new enemy. For example, in the first minute of the Gatecrasher scenario, Bradford says, "The ADVENT officers seem more capable than the grunts. We're not sure whether to chalk it up to training, or stricter mind control." That is because of this line in X2Character_DefaultCharacters.uc:

 

static function X2CharacterTemplate CreateTemplate_AdvCaptainM1() ...
CharTemplate.SightedNarrativeMoments.AddItem(XComNarrativeMoment'X2NarrativeMoments.TACTICAL.AlienSitings.T_Central_AlienSightings_AdvCaptainM1');

 

It happens that the Advent Mec Mark 2 doesn't have a narrative moment, so we will add one. We will use the "ambient narrative template modifier" technique described here:

 

http://forums.nexusmods.com/index.php?/topic/3839560-template-modification-without-screenlisteners/

 

You may wish to use a one-time screenlistener instead, but either way, the goal is to add a new narrative moment to CharTemplate.SightedNarrativeMoments. This code goes into NMD_TemplateFixer.uc.

class NMD_TemplateFixer extends X2AmbientNarrativeCriteria;

static function array<X2DataTemplate> CreateTemplates()
{
    local array<X2DataTemplate> Templates;
    local X2CharacterTemplateManager CharacterManager;
    local X2CharacterTemplate CharacterTemplate;
    local XComNarrativeMoment NarrativeMoment;    
    // Get the template
    CharacterManager = class'X2CharacterTemplateManager'.static.GetCharacterTemplateManager();
    CharacterTemplate = CharacterManager.FindCharacterTemplate('AdvMEC_M2');    
    // Add the narrative moment to the template
    NarrativeMoment = XComNarrativeMoment(`CONTENT.LoadObjectFromContentPackage("NMD.Moment_MecMk2Sighted"));
    CharacterTemplate.SightedNarrativeMoments.AddItem(NarrativeMoment);    
    return Templates;
}

2. Ini file

 

Narrative moments are defined in Config/XComNarrative.ini. Create the file with these lines:

[XComGame.XGNarrative]
+NarrativeMoments=NMD.Moment_MecMk2Sighted

3. Record the wave file

 

The wave file must be recorded in 16 bit mono PCM format. This guide does not cover the specifics of recording. For this demo, create a wave file MecMk2Sighted.wav.

 

4. Create the package

 

a. In the content editor, create a new package NMD and add it to your modbuddy project. The name must match the prefix of the narrative moment in the unrealscript and ini files.

 

b. Right click on empty space and choose Import from the popup menu. Enter your filename and the following dialog will appear. Make sure to select your package name at the top, and check the "Auto Create Cue" checkbox in the middle. This will create a SoundNodeWave object, and a SoundCue object. The name of the SoundNodeWave object must match the name in the localization file in step 2.

 

http://i.imgur.com/mL2r3tj.png

 

c. On the soundcue object, right click and choose Edit Using Sound Cue Editor. This pops up the following dialog. (Sorry, the names in the screenshot do not match the demo). When you start the dialog, it will have only the speaker, and the wave file. You need to make the dialog look like the screenshot. Right click on the pin on the left side of the wave box, and click "break link". Right click on empty space and choose XComConversationNode, which will place the third box. Left drag to create the two lines in the screenshot. Finally, right click on the extra pin at the right side of the XComConversationNode and choose Delete Input. Now your dialog box should look just like the screenshot.

 

http://i.imgur.com/L9cK9U6.png

 

d. To make sure you get the default values shared by other sighting moments, create your first narrative moment by copying one from the vanilla game. In the content browser left panel, open this long path:

 

XComGame > Content > XCOM_2 > Packages > Sound > X2NarrativeMoments > Tactical > AlienSitings

 

Right click one of the XComNarrativeMoments, choose Create A Copy, and enter your package name (NMD) and moment name (Moment_MecMk2Sighted).

 

e. Right click on the XComNarrativeMoment you just created and choose Properties. The following dialog will appear. (Sorry, the names in the screenshot do not match the demo). You must set the Conversations[0] field to the name of your SoundNodeWave. You can type this in, or use the following trick. Hover the mouse over the green left arrow on the line. The hover help says Use Selected Object in Content Browser. In the main content browser window, left click your SoundNodeWave so it is selected (yellow highlight rectangle). Now click the green left arrow. This fills in the name for you.

 

http://i.imgur.com/lwB65cH.png

 

f. Choose the "head" that will appear when the lines are spoken. Right click the SoundWaveNode and choose Properties. The following dialog box will appear. In the Speaker Template dropdown, there are a huge number of choices, most of which don't work (the viewport window is just blank when the moment plays). You can choose StrategyCentral, HeadScientist and HeadEngineer, which is what most narrative moments use. For advanced users, you can search for SpeakerPortrait in the UC files to see how to bind a 128x128 image to a character template; then you can choose that template in the dropdown.

 

http://i.imgur.com/OuEiMyl.png

 

g. Enter the subtitle text for the moment into the Spoken Text field of the dialog above. There may be several methods for entering this; another modder suggested using the localization file, and entering a SpokenText value for the SoundWaveNode. I was not able to make that work, but entering the text in this dialog does work for me.

 

h. Save the package and exit the content browser.

 

5. Compile and test

 

Double check that you have the uc file, ini file, localization file and package in your modbuddy project. Compile. The easiest way to test is to start the game in debug mode and click the Tactical button to enter "tactical quick launch" mode. Select a map and squad, and start the mission. Place the mouse over a square your soldiers cannot directly see, and enter the console command "dropunit advmec_m2 1". This creates an enemy mark 2 mec. Now move one of your soldiers so they have line of sight on the enemy, and the new narrative moment should play!

Edited by davidlallen
Link to comment
Share on other sites

I've done this before. Having to recompile UnrealScript to get your narrative moments loaded is annoying as hell, I think.

 

It's actually suuuper easy to get the narrative moments loading from the localization int files without requiring any recompiling just to change an audio line. Requires a highlander mod though.

 

One thing that I'm not certain about, is how does alternative languages work? If you have one English and one Russian set of dialog lines, how could you get either/or playing? What does the vanilla game do (I've never changed the language setting so I don't know).

Link to comment
Share on other sites

There is a UDK localization guide on epics site that explains how to do localized audio. Basically you split the cues and wavs into separate packages with a particular folder structure and naming convention and it'll create multiple sound packages, one for each language. The game will load the correct one at runtime.
Link to comment
Share on other sites

Here are some advanced topics. I forgot to reserve post #2 for myself.

 

Skyranger mission briefings

 

If you have added custom missions, you can use a narrative moment to give a briefing while the player is stuck watching the skyranger loading scene. Add the moment in PreMissionNarratives in your localization file for the mission:

[HT_RescueVIP X2MissionTemplate]
PreMissionNarratives[0]="HT_NarrativeMoments.Premission_RescueVIP_NM"

If you add several moments here with [1], [2] etc the game will randomly select one of them. If your mission will occur multiple times, you may wish to record several variants with the same basic information.

 

Conversations

 

One narrative moment may contain several SoundCues, which will be played as a conversation. Usually this makes sense if there are two speakers who alternate, but you could chain one really long speech this way. Set this up in the properties dialog of the XComNarrativeMoment as shown here:

 

http://i.imgur.com/zgNXiTm.png

 

Use the trick shown in step 4e above to insert the SoundCues. Make sure to check the box "Play all conversations" so that it will play the cues in sequence; otherwise it will randomly select one of the cues.

 

No voice actor? Use silence

 

If you can't get a voice actor, or don't feel like it, you can make a wave file which is just silence. This is better than nothing. Most sound editor tools can create this. Make sure the duration of the silence is long enough for the player to read your subtitle. Although there are fields for "text to speech" (tts) in the dialog boxes, I wasn't able to make this work. If anybody can get that, it will make testing quicker, and possibly some mods could be released with computer generated voices.

Edited by davidlallen
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...