[XML2 & MUA1] Conversation mod tutorial

Started by scottsum, December 14, 2019, 04:47PM

Previous topic - Next topic
December 14, 2019, 04:47PM Last Edit: April 14, 2020, 08:51PM by BaconWizard17
Why conversation mods?  The makers of MUA clearly realized that just a little bit of voiced dialogue can help bring a character to life.  I felt that doing the same for the Justice League mod characters could do wonders for making them feel like they exist in this world.

As my Supergirl Supergirl & Superman Justice League conversation mod evolved, I started to get a few requests to put some kind of tutorial together for creating new conversations, so I figured I would get the ball rolling here.  I may miss some details to start off, but for now at least I can put a basic summary together to give a starting point to anyone who wants to try this, and I can fill in the gaps as we go along if there is sufficient interest.

What do you need?
XMLB compiler/decompiler https://marvelmods.com/forum/index.php/topic,95.0.html
zsmeditor https://marvelmods.com/forum/index.php/topic,1359.0.html
Audacity audio editor https://www.audacityteam.org/download/
A source of good clean audio/voiceovers for the character that you can work with, such as from another game.

What are the basic items that need to be created/edited to insert a conversation?
1) a conversation file.
2) the corresponding packages/generated/maps file.
3) the scripts file which triggers the conversation(s) at a given point in the game.
4) the sounds (voice) file for the relevant character.

For the walk-through, I'll use the conversation I created between Supergirl and Fin Fang Foom as an example.

Summary of steps:

1) I like to start by going through the available audio that I have (such as the IJGAU/IJ2 audio files) and brainstorming possible conversations based on what's there.  That way, I'm not wasting time dreaming up conversations that I don't have good audio for.  After all, the goal here is to have everything fully voiced.  No silent dialogue.

2) Once you have an idea or concept in mind, decompile the existing conversations in a given area.  For example, I extracted all of the conversations with Fin Fang Foom for Dr. Strange, Magneto, and the default with no player voice.  (For example, 1_heli4_022.engb, and others.)  This way you can review and see what all of the possible NPC (non-playable character) voiced lines are.  Note: Sounds can sometimes be spliced a bit, but this adds another layer of difficulty, so I would recommend avoiding it at first, if at all possible.  Try to just use the NPC lines as they are.

3) Make a simple outline of your new conversation that uses your audio and the available NPC audio, and the lines from your available sound clips, that makes sense and sounds good.  Think of it like writing a script for a movie scene.  Play the sounds clips in order to hear how it all sounds.  If it sounds good, you can create a conversation file.  Take one of the existing conversation files to use as a base, give it a new name, and edit in the lines you've created.  Save the new conversation file, for example, 1_heli4_022_spg.engb.  For "soundtoplay" use the char/spgirl_v instead of voice/supergirl syntax.  The latter will work with hashes, but this give you an extra place to make a mistake, and I've found in most cases it's just make-work.

4) Add the conversation to the packages file for that level. For example, I extracted packages/generated/maps/act1/heli/heli4.pkgb.  I looked for the line that looked like this:
   xml {
   filename = conversations/act1/heli/heli4/1_heli4_022 ;
   }
And added another one just below it that looks like this:
   xml {
   filename = conversations/act1/heli/heli4/1_heli4_022_spg ;
   }

5)   Edit the script to trigger the conversation when the character is present.  There are two main parts to editing the script.  One is writing the line that tells the game to check whether your character is present.
The other is what to do if they are there.  So continuing my example, I edited scripts/act1/heli/heli4/fff_intro.py with the following.  The first is just a simple line that basically says, check to see if this person is here.
     supergirl = isActorOnTeam("Supergirl" )
The next is a simple "if, then" statement.  If this person is here, do this, otherwise, do this.
     if superman == 1
        startConversation("act1/heli/heli4/1_HELI4_022_SPM" ) 
     elif supergirl == 1
        startConversation("act1/heli/heli4/1_HELI4_022_SPG" ) 
     elif magneto == 1
        startConversation("act1/heli/heli4/1_HELI4_022_DLC" ) 
     else
        startCharConversation("act1/heli/heli4/1_HELI4_020", "drstrange", "act1/heli/heli4/1_HELI4_022" )
Note that in this case, there were already a few conversations present.  The game processes the lines in order.  So here the game would read the code as, "If Superman is here, do this.  If not, but Supergirl is here, do this.  If not, but Magneto is here, do this, until you get to the "else" which just means, "finally" or if nothing else applies, do this (which in this case is sort of another weird 'if then' for Dr. Strange, but we can dig into that more later.)

6) At this point, I recommend testing your conversation to see if it works.  Sometimes adding a conversation will cause you to hit the memory wall.  if that's the case, you want to know here, because you're going to have to make a decision about whether to proceed and replace another conversation, or abandon this creation and move on to another part of the game.

7) Once you're sure everything works, it's Audacity time.  You'll need to take the sounds/lines you want and convert them to wav files with a sample rate of 22050 Hz, 16-bit format.  You'll also want to increase the gain on any given audio clip between 7 and 10, or it will most likely be too quiet.

8) Use the zsm audio editor to import your new sounds into the character sound file.  The name of the sound file needs to match the line in the code.  So, if the conversation file has a line reading "soundtoplay = char/spgirl_v/1_heli4_020_010_spg" then the sound file you import into spgirl_v.zss needs to be 1_heli4_020_010_spg

As you're constructing your conversation, I recommend placing your new files in a folder, such as on your desktop, and place the defaults in there as well (renamed), so you can easily revert if something goes wrong.


Best suggestion is to use notepad++. Editing Scripts that is.
Call me Lars. I'm Power Cosmic no more.

"Trying to solve mysteries of modding here"

My Progress:
http://marvelmods.com/forum/index.php/topic,4671.0.html

Feel free to mod my releases, as long you credit me:
http://marvelmods.com/forum/index.php/topic,4488.0.html

Some parts of the game have conversations triggered directly from the maps file. If this is the case, and you want to add, you'll need to change the map to point to a script file so you can create an if-then statement.  Here is an example of how I did this on the helicarrier level to add conversations with scorpion:
The conversation files I created were called 1_HELI1_020_bm.engb and 1_HELI1_020_ww.engb (the latter bring triggered by either of two different wonder woman mods.)

1) Edit maps\act\heli\heli1.engb
   Find and change line from this
      actscript = startConversation('act1/heli/heli1/1_heli1_020')
   To this
      actscript = act1/heli/heli1b/scorpion_conv"

2) Under scripts\act1\heli\heli1b, created a new script file called scorpion_conv.py containing the following:
   
   batman = isActorOnTeam("Batman" )
   wwom = isActorOnTeam("wwom" )
   wwom3 = isActorOnTeam("wwom3" )
   if batman == 1
      startConversation("act1/heli/heli1/1_HELI1_020_bm" )
   elif wwom == 1
      startConversation("act1/heli/heli1/1_HELI1_020_ww" )
   elif wwom3 == 1
      startConversation("act1/heli/heli1/1_HELI1_020_ww" )
   else
      startConversation("act1/heli/heli1/1_HELI1_020" )
   endif

3) Under packages\generated\maps\act1\heli, add the following to heli1.pkgb

      script {
      filename = scripts/act1/heli/heli1b/scorpion_conv ;
      }