Struggling while trying to edit in-game gun sounds.

Started by pablo603, July 17, 2018, 01:00:37 PM

Previous topic - Next topic

pablo603

I've followed this guide:
https://rimworldwiki.com/wiki/Modding_Tutorials/Sounds

And it won't work. I changed the sound directory of Shot_BoltActionRifle SoundDef and when I click the button to play the sounds it says "No grains resolved" or something like that, but it works with the default sound path. Could anyone help me? I don't know what am I doing wrong.

[attachment deleted due to age]

Mehni

That tool is a bit dated and doesn't offer mod support. Editing Defs with xpath or otherwise is your best bet.

pablo603

Quote from: Mehni on July 18, 2018, 04:29:48 AM
That tool is a bit dated and doesn't offer mod support. Editing Defs with xpath or otherwise is your best bet.
That means I should create a new mod folder and make a patch to the original file there?

Mehni


pablo603

Ok then, time to learn how to do it. Thanks for help!

pablo603

I don't understand anything from those guides. I guess I'll have to do with the default gun sounds.

pablo603

I improvised and tried doing it

<Operation Class="PatchOperationReplace">
  <xpath>*/SoundDefs[defName = "Shot_BoltActionRifle"]/clipFolderPath</xpath>
  <value>
        <clipFolderPath/>Sounds/Guns/BoltActionRifle</clipFolderPath>
  </value>
</Operation>


It throws up an incompatibility error everytime I try to load the mod. This "code" is probably not even close to what it should be.

Mehni

The xml structure for that is below, where each tag that gets opened is a childnode. To travel down a childnode, you use /


<Defs>
    <SoundDef>
      <defName>Shot_BoltActionRifle</defName>
      <subSounds>
        <li>
          <grains>
            <li Class="AudioGrain_Folder">
              <clipFolderPath>Weapon/BoltActionRifle</clipFolderPath>


So that'd be /Defs/SoundDef[defName = "Shot_BoltActionRifle"]/subSounds/li/grains/li/clipFolderPath - if that's not correct, there are specialised help threads with greater experts than I am ;-). Showing your error would help too.

As for your clipFolderPath: The game assumes you store sounds in the Sounds folder (and Textures in the Textures folder, and Defs in the Defs folder, and Patches in the Patches folder) so you don't have to specify it. The clipFolderPath for RIMWORLD/MODS/MYMOD/SOUNDS/Guns/BoltActionRifle would be <clipFolderPath>Guns/BoltActionRifle</clipFolderPath>, and it would expect a folder there containing sounds (because the AudioGrain_Folder expects a clipFolderPath, not a clipPath).

pablo603

#8
Thanks for trying to help me. The game still throws a "Mods Incompatible or corrupted" error whenever I load the mod. The code looks like this now:
<Operation Class="PatchOperationReplace">
  <xpath>*/Defs/SoundDefs[defName = "Shot_BoltActionRifle"]/subSounds/li/grains/li/clipFolderPath</xpath>
  <value>
        <clipFolderPath/>Guns/BoltActionRifle</clipFolderPath>
  </value>
</Operation>


I followed your instructions carefully.
I went into the debug log and this pops up whenever I load my mod (attachment)
I went to the line 4, I assume position 49 means 49th character, but when it really means 49th character then it doesn't make sense. It expects a "value" in "clipFolderPath" between "Folder" and "Path"




Edit: I went with an easy way. Since you said the game automatically checks for "Sound" "Textures" and etc I realised the "No grains resolved" was because I put the path as follows: "Sound/Guns/BoltActionRifle"
I put it "Guns/BoltActionRifle" and it works now, but I know this isn't a perfect solution because as I read from those guides about xpath and patching, the reason why this whole xpathing was introduced was to make less mod conflicts or something like that. I'd still like to learn the patching though, as it would make things much easier because every update to Rimworld changing something will reset the default file the path was changed in. At least this happened to my customised shotguns where instead of one sprite of pellets they shot multiple pellets in different directions.

[attachment deleted due to age]

Mehni

A * snuck into your xpath which I didn't post. A * is a wildcard that skips a node.

EDIT: an errant / also snuck in after the first clipFolderPath

pablo603

Ah, I didn't notice them. It loads the mod without an error now. I will test it out later. Thanks for your help!