Each of our mercenaries has up to ~145 soundfiles. While that seems a lot (especially when you create new ones from sound files out of other games that somehow have no file for their character announcing they'll go to sleep), more would be better. Of course, given that there are so many different situations where a file would or would not fit, this is hard to simply code in. Additionally, standardization of files (which file is played when) would be equally annoying. Even more, text translations are stored in .EDT files. In case you want to hear a 5-minute rant from me on why .edt files are suboptimal, ask me on Discord.

Anyway, thus the solution is to move the entire part of who says what when to a lua function. That way modders can decide exactly that. So I did. Which is what this feature is. For obvious reasons we have no additional dialogue for existing mercs (if we had, it would already be in the game and not be additional, no?). So while creating new mercs out of Mass Effect Andromeda, I also added extra dialogue for them to demonstrate this.

If you are familiar with JA2 (which you are, because you are here), you will notice that these mercs use more lines than normally, and even do so in response to other mercs. This is all defined in lua. To be precise, in Overhead.lua:

-- functions used here:
-- ubProfile: profile number of merc (don't change that unless you know what to do)
-- iFaceIndex: index (don't change that unless you know what to do)
-- path: path and name of soundfile we want to play (in .wav or .ogg format)
-- text: "Text that should appear"
-- SetAdditionalDialogue(ubProfile, iFaceIndex, path, text)
-- Do not use this function in any lua calls outside of HandleAdditionalDialogue(..)!
--
-- path: path and name of soundfile we want to play (in .wav or .ogg format)
-- volume: optional sound volume (65: medium volume, 127: loud), default 65
-- PlaySound(path, volume)
-- handle
-- sSectorX, sSectorY and bSectorZ indicate the sector coordinates
-- ubProfile is the merc for whom this is called
-- iFaceIndex is the face of the merc. DON'T CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
-- usEventNr indicates which event from DialogueActionEvent is used here
-- aData1, aData2, aData3 are additional data, see event description on what they do in each event
function HandleAdditionalDialogue(sSectorX, sSectorY, bSectorZ, ubProfile, iFaceIndex, usEventNr, aData1, aData2, aData3 )
if ( ubProfile == Profil.LARA ) then
-- merc is the 1st one to explore this room, aData1 indicates the room in this event
if ( usEventNr == DialogueActionEvent.ADE_DISCOVER_ROOM ) then
-- surface sectors
if ( bSectorZ == 0 ) then
-- Alma
if ( (sSectorY == SectorY.MAP_ROW_H) and (sSectorX == 14) ) then
if (aData1 == 10) then SetAdditionalDialogue(ubProfile, iFaceIndex, "Speech//Additional//Lara//almastorage1.wav", "Looks like they were always prepared for war.")
end
elseif ( (sSectorY == SectorY.MAP_ROW_I) and (sSectorX == 13) ) then
if (aData1 == 21) then SetAdditionalDialogue(ubProfile, iFaceIndex, "Speech//Additional//Lara//tixa5.wav", "What the hell happened down here?")
end
-- Cambria
elseif ( (sSectorX == 8) and (sSectorY == SectorY.MAP_ROW_F) ) then
... etc. etc.

Basically, HandleAdditionalDialogue is called upon several actions, and allows one or more mercs to say a line. See the comments in the script on what the arguments mean. We can either let a merc talk, like

SetAdditionalDialogue(ubProfile, iFaceIndex, "Speech//Additional//Lara//snowstorm1.wav", "I'm gonna freeze to death out here.")

or just play a simple sound file (in the video we do so when we enter the non-profile merchant's inventory)

PlaySound("Speech//Additional//Sara//merchant15.wav")

The function is called upon the following events:

a merc discovers a room. In the video Scott sometimes talks about the contents of rooms he discovers. We only do so the first time the room is entered at all, otherwise this would get annoying very fast.

another merc uses a voice line. In the video, Sara comments upon meeting Pacos, Fatima and Ira, Scott comments on Ira running out of ammo & Sara talking to herself, while Shepard isn't too happy with Ira for insubordination ;-)

mercs drop into Omerta. Normally only IMPs do a voice line in that case - here Lara, Sara & Scott also do so.

mercs enter a new sector. This is similar to the comments rebels like Ira give on some sectors.

We use friendly/direct/threaten/recruit/repeat choice in dialogue. Provided you have enough voice files, this means you can make the entire dialogue system fully voiced.

We successfully recruit an RPC, as seen with Ira, Sara & Shepard. This would also work via intercepting the voice line, but as the actual numbers of the specific line differ from RPC to RPc, this is a convenience option.

We have sex. Yup. This is kinda amusing to mod, as these files weren't exactly used with that usage in kind originally. Context matters!

The weather in sector the merc is changes, as seen at the end of the video.

We use a skill, like Sara's radio skills.

A delayed grenade is dropped nearby, as demonstrated by Scott on Lara & Shepard.

Of course many more events are thinkable (I assume this thread will see some ideas in that regard). But I think the point should be clear by now.

The sound files itself can be stored and named however the modder likes. I propose using Speech/Additional/name of merc/name of file that is meaningful.ogg or .wav.

As these mercs are obviously not of JA-canon, they will obviously not enter any official 1.13 release, but of course the script with descriptions will (lua will still require the new function to be present, even if it's empty). There are also no options here. If you don't want the sounds, just empty the function contents.

I am somewhat positive this will be useful to future modders. I only really fleshed out Sara, the other mercs are still somewhat limited in what they say, but now I need a few weeks away from listening to endless amounts of .wav files, and look forward to coding something else.

This is fully savegame compatible.

This has been added to the trunk in r8516 & GameDir r2400. Using the new exe without the new GameDir will get you a rating of 13 on Metacritic.

[Updated on: Thu, 11 January 2018 02:06]

Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Introducing new weather conditions is very interesting. It would be nice to make a fog (in the whole sector or in a selected area, for example a river, a lake, a swamp).
Sandstorm in the desert.

Many thanks to all those who make new features for Jagged Alliance 2.

New mod + new map (JA2 map with Drassen, Omerta, Cambria etc, edited or not-it has been repeatedly ) with large sectors + two additional levels + a lot of new tileset + moving vehicles = fun for months, years. Fun with creation, fun playing this mod.

We already have some of that. I've thought about fog, but that either requires altering the palette, which requires reloading tactical at minimum, or making heavy use of overlays, which will still look... off.

Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.