Jump to content

Recommended Posts

Posted (edited)

Here's a very rough guide on how to add a new voice to Pillars of Eternity 2, without replacing an existing one. From the code side of things it's not too complicated, you'll just need 2 blocks of code. The main complication lies in creating the audio files and naming them correctly so that the game will know what to do with them.

Go to the PillarsOfEternityII_Data directory, you can find this by default:
Steam: C:\Program Files (x86)\Steam\steamapps\common\Pillars of Eternity II Deadfire\PillarsOfEternityII_Data\
GOG: C:\Program Files (x86)\GOG Games\Pillars of Eternity II Deadfire\PillarsOfEternityII_Data\

Inside the override folder (if this doesn't exist, create it) create a new folder, give it the name of your mod (E.g. Something like “Custom Voice”, “Zealous Voice”, something along those lines but it's really up to you). Inside this folder right-click and create a new notepad file. Give it the name of your mod and put .gamedatabundle (no .txt) at the end.
Open it with Notepad (or your choice of code editor) and paste the following template:

{
    "GameDataObjects": [{
            "$type": "Game.GameData.SpeakerGameData, Assembly-CSharp",
            "DebugName": "DEBUG_NAME_1",
            "ID": "GUID_1",
            "Components": [{
                    "$type": "Game.GameData.SpeakerComponent, Assembly-CSharp",
                    "Gender": "GENDER",
                    "ChatterFile": "936c726d-d219-4771-80bb-83dd61c16cce",
                    "ExternalChatterVOID": "00000000-0000-0000-0000-000000000000",
                    "ChatterPrefix": "FILE_PREFIX",
                    "WwiseChatterEventOverride": "",
                    "WwiseChatterVoiceOverride": ""
                } 
            ]
        }, {
            "$type": "Game.GameData.PlayerVoiceGameData, Assembly-CSharp",
            "DebugName": "DEBUG_NAME_2",
            "ID": "GUID_2",
            "Components": [{
                    "$type": "Game.GameData.PlayerVoiceComponent, Assembly-CSharp",
                    "DisplayName": 465,
                    "SpeakerReferenceID": "GUID_1",
                    "Conditionals": {
                        "Operator": 0,
                        "Components": []
                    }
                }
            ]
        }
    ]
}

Change the following:

  1. DEBUG_NAME_1: change to something distinctive to your mod. This way if something isn't working, you can easily search for errors in the output.log.   e.g. “DebugName”: “SPK_Player_Custom_F”
  2. GUID_1: Generate a GUID and paste it over GUID_1 (inside the quotes). e.g. "ID" : GUID_1.png.7be9f42635c92031407b17f085cb51da.png
  3. GENDER: Put Male or Female inside the quotes depending on which gender you want the voice to be available for.   e.g. “Gender”: “Female”
  4. FILE_PREFIX: Change to something short, something easy to retype and remember. You will use this later as the name of the folder for your audio and as a prefix on all your audiofiles. Don't use spaces in the name. Use_underscores_ instead_to_separate_words. e.g. “ChatterPrefix”: “player_custom_f”
  5. DEBUG_NAME_2: same idea as DEBUG_NAME_1 but make sure they aren’t exactly the same. e.g. “DebugName”: “Voice_Custom_Female”
  6. GUID_2: Generate another different GUID and paste it over GUID_2 (inside the quotes). e.g. GUID_2.png.8eddb292f448e47c8aceab9617b029fb.png
  7. For “SpeakerReferenceID” paste the first GUID you generated over GUID_1 again. e.g. "SpeakerReferenceID": GUID_1.png.7be9f42635c92031407b17f085cb51da.png

Finally:

  • Make sure everything you've replaced still has quotes around it.
  • Make sure there are no spaces inside of the “quotes”.
  • Save your file.

Your finished code should look something like this:

Spoiler

867162267_FinishedCode.png.975ab53ab782f73f5412574e05b84580.png

Setting up your Audio files:

Now go to: PillarsOfEternityII_Data\StreamingAssets\Audio\Windows\Voices\English(US)\ and create a new folder there naming it the same as what you have put in place of FILE_PREFIX. This is where all your audio files will go once they are converted to .wem and have the correct names.

The naming of audio files goes like this:
ch_FILE_PREFIX_USE_NODE.wem

E.g. ch_player_custom_f_confirm_0025.wem , ch_player_custom_f_battlecry_0028.wem

There are 121 audio files that'll make up this voice. I've attached a .txt file that contains all the file names. For your convenience use Find & Replace (crtl+h) to change all the lines with FILE_PREFIX to that of your ChatterPrefix.

I would strongly suggest that you create a work files type folder for your project outside of the game's directory. And that you build your voice in stages, so as to avoid burning yourself out.

The voice should still work if there are less than 121 files, but there will be silence for actions where there is no corresponding audio file or if there is additional line. E.g. if there is only one audio clip for when you clicking on the character there will be gaps in-between the character repeating that line.

You can test the voice at any time by going into character creation, creating an adventurer at an Inn, or by opening the customization menu on an existing character. When loading it is worth clicking on your character a few times till they say something before going into the customization menu as voices don't always immediately load.

Finishing touches:

  • Create a mod manifest as described by BMac.  The versions that support this mod should be: "Min" : "1.2.0.0017", "Max" : "5.0.0.0040" 
  • Currently your voice slot has the name “Test” when you look at it in game. Adding a piece of custom text to serve as your voice's name is a little finicky as it requires adding an entry to the gui.stringtable file. You can find some information on to do this in a few places. Once you have done this open up the .gamedatabundle file you made and replace 465 with the numbers that point to your text entry.

Custom Voice Lines.txt

 

 

Edited by Kvellen
  • Like 4

Share this post


Link to post
Share on other sites

Very nice! Thank you for this comprehensive guide. 


Deadfire Community Patch: Nexus Mods

Share this post


Link to post
Share on other sites

Would you be able to make a Wwise project file or tutorial that would allow us to make a custom soundtrack, replacing the original?  I have a bunch of classical music that I'd prefer to play as each scene changes rather than just have a dumb playlist going.  Spending at least 10 hours learning Wwise doesn't seem worth it to me, because then it's probably another 10 hours to make sure my changes work---but maybe this would be easy for you to explain?  It would be awesomely appreciated.

 

It's also cool that you figured out how to do this.  I think it could have a big long-term impact and people will do fun things with it like they did in BG2.

Share this post


Link to post
Share on other sites

Sorry took me so long to reply.

On 8/31/2019 at 12:46 PM, Grape_You_In_The_Mouth said:

Would you be able to make a Wwise project file or tutorial that would allow us to make a custom soundtrack, replacing the original?  I have a bunch of classical music that I'd prefer to play as each scene changes rather than just have a dumb playlist going.  Spending at least 10 hours learning Wwise doesn't seem worth it to me, because then it's probably another 10 hours to make sure my changes work---but maybe this would be easy for you to explain?  It would be awesomely appreciated.

 

It's also cool that you figured out how to do this.  I think it could have a big long-term impact and people will do fun things with it like they did in BG2.

Sadly Wwise is as much a mystery to me. Anything more advanced than converting a few audio files in Wwise is outside my knowledge. and it's a similar answer with replace/adding music I'm afraid. My only guess (and I have no evidence to support this) is that all music tracks might be stored in a .bnk somewhere and are then called by the audio.gamedatabundle for certain events?

Sorry that I couldn't be of any help.

Share this post


Link to post
Share on other sites

Yep there's a music text file and I tried to replace one of the songs referenced in that text file, and the music stopped working.  There are multiple types of references though so maybe I replaced the wrong file.  I think with maybe 20 hours of tinkering around it could be learned pretty easily but the conversion and copying take quite a long time.  So the actual testing of ideas is time consuming.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...