Jump to content

Adding a new sound to game.


Winterhart

Recommended Posts

Is it possible to add a new sound to the game? This may sound silly but I don't play with zombies on because the sound they make gives me nightmares. I want to add a softer gentler zombie sound so I can enjoy every part of the game. I think I know enough xpath to figure out how to change the sounds but I have no clue as to where I would add the wave file I want to use.

 

Thank you for your time. :smile-new:

Link to comment
Share on other sites

You would have to import it into Unity and export it as a unity3d package I think.

 

Outside of making it into a modlet style, I think you could add it to your Bundles folder and then just reference it in the xml files.

 

Since I know nothing about Unity it sounds like there is no easy way to do this. Maybe I would be better off substituting a less threatening existing sound. Anyone else have any thoughts?

Link to comment
Share on other sites

Not that hard, really.

 

So is bdubyah on the right track with importing into Unity and exporting as unity3d package? Once I did that what would I do with the package. xml I understand enough to take something that I made that I know works and cut and paste to make it do something else I want, mostly. But I know nothing about Unity and would have to learn it. Being dsylexic makes that not that easy, really. lol I will look into it though.

 

 

Edit: OK maybe not that hard. It is fascinating. I'm going to make some simple games for my 5 year old Gransdon!

Link to comment
Share on other sites

Yeah, it's not as bad as it sounds. Just watch some of xyth's tutorials on Unity stuff.

 

To just import a sound, export it from Unity, and then reference it in the xml file isn't that bad.

 

a bob ross zombie?... whispers...." now im gonna eat you a little bit, just tap tap tap... there... its all good... its just a happy bite... keep looting"

 

Bob Ross the Boss Zombie? I'd be down. Haha.

Link to comment
Share on other sites

Yeah, it's not as bad as it sounds. Just watch some of xyth's tutorials on Unity stuff.

 

To just import a sound, export it from Unity, and then reference it in the xml file isn't that bad.

 

Bob Ross the Boss Zombie? I'd be down. Haha.

 

Got it, thanks. I found the tutorial and have my new sound!

Link to comment
Share on other sites

I don't know what I'm doing wrong.

 

The file that I imported into Unity and then exported was called ZombieSounds. I followed Xyth's tutorial and used the build command to export it. The exported file is called Sounds.unity3d. I have a folder called Sounds in the Mods Folder with the unity file in it.

 

Here is my code:

 

<set xpath="/sounds/SoundDataNode[contains(@name, 'zombie')]/AudioSource[@name=Sounds/AudioSource]">modfolder:Sounds/Sounds.unity3d?ZombieSounds</set>

 

My code is loading without error but it is not changing anything. Can anyone tell me what I'm doing wrong? I think I'm telling the game to replace all the sounds for anything containing "zombie" to the sound in modfolder but it obviously isn't getting the message. lol :crushed:

Link to comment
Share on other sites

.unity3d files go in modname/resources

 

So a resources folder instead of sounds right? OK I changed the name of the folder to resources and the code to:

 

<set xpath="/sounds/SoundDataNode[contains(@name, 'zombie')]/AudioSource[@name=Sounds/AudioSource]">modfolder:resources/Sounds.unity3d?ZombieSounds</set>

 

It still doesn't work.

Link to comment
Share on other sites

Yeah. Look at another modlet if you have downloaded any. Copy the file structure.

 

That's what I did with this.:smile-new:

 

I based it on the Impact Wrench by Elucidus. He was adding an entirely new item though. I'll try and find a mod that's changing a sound instead. Do you know of any?

Link to comment
Share on other sites

No errors? Paste a pic if the hierarchy in unity?

 

Also so an exportcurrentconfigs to make sure the XML changes are applying how you want them to.

 

I've a thread called Xpath error checking here in modding/tutorials that shows you how.

Link to comment
Share on other sites

I also want to know how to change the sound, rather than adding new sound to new items or entities. I just discovered this method and would be really glad to know how.

 

This is what I have tried to do.

 

 

<configs>

 

<remove xpath="/sounds/SoundDataNode[@name=zombiefemalescoutalert]/AudioClip[@ClipName=Sounds/Enemies/Scout_Zombie/zombiefemalescoutalert1]"/>

 

<set xpath="/sounds/SoundDataNode[@name=zombiefemalescoutalert]/AudioClip[@ClipName">#@modfolder:Resources/screamer.unity3d?zombiefemalescoutalert1</set>

 

</configs>

 

This did not work of course. I have tried removing other values, like the channel name "Mouth" and it worked, but removing the audioclip clipname does not seem to work at all.

Link to comment
Share on other sites

Here's a sample of my sounds.xml file

 

  <SoundDataNode name="BellBike"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?BellBike"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 

...so you would just reference BellBike in the sounds section of whatever you are changing (in my case, in vehicles.xml)

 

Here is what my Unity looks like:

 

tmp-Sounds.png

 

...note on the left I have the object and child, the child has the mp3 dragged to it (seen on the right) and then I have the list of sounds (at the bottom) that I group compile into GuppyMobilesSounds.unity3d

 

Hope this helps.

Link to comment
Share on other sites

No errors? Paste a pic if the hierarchy in unity?

 

Also so an exportcurrentconfigs to make sure the XML changes are applying how you want them to.

 

I've a thread called Xpath error checking here in modding/tutorials that shows you how.

 

As expected there is no change to the zombie sounds in the configs :apathy:

 

I don't know if this is what you meant for screen prints, but it shows exactly what I did to get my unity3d file.

 

Step1.jpg.81be1f205989d2e4c7f51dc0bc77387c.jpg

Step2.jpg.f6bf3a111d05915f522f0717fd584d58.jpg

Link to comment
Share on other sites

Can't see your pic clearly but it doesn't appear you have the audio in a child of the parent prefab.

 

That's because it isn't lol. How do I attach that audio to the child of a parent prefab? I'll go research that now. lol I thought all I had to do was drag the file in and export it out. I didn't know I had to attach it to anything.

Link to comment
Share on other sites

Remember also if you are changing the sounds of the zombies you need to also set the xpath for the entityclasses.xml. I do not think you have to do it for each and every zombie. I believe you can code it for every zombie. Like [contains(@name=zombie'). I hope this can help you further @Winterhart.

 

In my case I only wanted to change the sounds for the zombieScreamer.

 

<configs>
<remove xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundRandom']"/>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundRandom']/@value">#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutroamcustom</set>

<remove xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundAlert']"/>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundAlert']/@value">#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalertcustom</set>

<remove xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundAttack']"/>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundAttack']/@value">#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutattackcustom</set>

<remove xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundDeath']"/>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundDeath']/@value">#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutdeathcustom</set>

<remove xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundSense']"/>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundSense']/@value">#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutsensecustom</set>
</configs>

 

I was too excited yesterday I forgot to do exactly that. Then you append xpath as normal in the sounds.xml

 

<configs>
<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutalertcustom"> <AudioSource name="Sounds/AudioSource_Screamer"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalert1"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalert2"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalert3"/>
	<Channel name="Mouth"/>
	<Priority name="3"/>
<maxVoicesPerEntity value="1"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="3"/> 
	</SoundDataNode>
</append>	

<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutattackcustom"> <AudioSource name="Sounds/AudioSource_Screamer"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutattack1"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutattack2"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutattack3"/>
	<Channel name="Mouth"/>
	<Priority name="2"/>
<maxVoicesPerEntity value="1"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="1.8"/> 
	</SoundDataNode>
</append>	

<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutdeathcustom"> <AudioSource name="Sounds/AudioSource_Pain"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutdeath1"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutdeath2"/>
	<Channel name="Mouth"/>
	<Priority name="0"/>
<maxVoicesPerEntity value="1"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="1.111"/>
	</SoundDataNode>
</append>

<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutroamcustom"> <AudioSource name="Sounds/AudioSource_Screamer"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutroam1"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutroam2"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutroam3"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutroam4"/>		
	<Channel name="Mouth"/>
	<Priority name="5"/>
<maxVoicesPerEntity value="1"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="3"/> 
	</SoundDataNode>
</append>

<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutsensecustom"> <AudioSource name="Sounds/AudioSource_Screamer"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutsense1"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutsense2"/>
	<Channel name="Mouth"/>
	<Priority name="4"/>
<maxVoicesPerEntity value="1"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="3"/> 
	</SoundDataNode>
</append>
</configs>

 

But here I also need help. I got an yellow error that it did not apply

 

2019-03-02T11:02:27 16.390 WRN XML patch for "entityclasses.xml" from mod "RobelotoScreamerSound" did not apply: <set xpath="/entity_classes/entity_class[@name=zombieScreamer]/property[@name=SoundRandom]/@value"

I just do not have enough time nowadays to figure it out myself. :(

Look at my pic.

 

Parent object is blank.

 

Child object is also blank. Drag audio clip to child. No longer blank.

 

I hope I get this right also. Tell me if I'm wrong. You need a parent folder for the different sounds. I have a folder for the attack sounds, one for the roam, one for the alert and one for the death sounds. As you see above in my code I have pointed the zombiefemalescoutroam1 to 4 to the folder zombiefemalescoutroamcustom which is the <SoundDataNode name="zombiefemalescoutroamcustom">?

 

screamersounds2.thumb.jpg.4c4d8f9699e0faed8ab7bc5d1803d6f9.jpg

Link to comment
Share on other sites

It doesn't look like you have your sounds in children either; also, you have to remember, unity doesn't care what the sounds are for. Each sound needs a parent and a child; the bundle (.unity3d file) has all of the parents. Think of it as a .zip file, containing lots of parents. You then reference the unity3dfile?parentname in xml, in sounds.xml.

 

The other files (entityclasses, vehicles, items, blocks, etc) all then reference sounds.xml.

 

I did a quick video, but OBS hates my laptop's two video cards so I could only choose one window to capture (unity), but this should give you the gist.

 

 

The XML side still needs to be solved. On your "remove and set", the flaw is that you're removing, then trying to set something you just removed. You'll need to remove all of the "remove's".

 

- - - Updated - - -

 

Here is my entire xpath sounds.xml, which adds the sounds to the game, to be referenced by the other xml's.

 

<configs>

<append xpath="/Sounds">

 <SoundDataNode name="BellBike"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?BellBike"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="HornBattle"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?HornBattle"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="HornCarLong"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?HornCarLong"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="HornDixie"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?HornDixie"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="HornHonk"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?HornHonk"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="HornHuge"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?HornHuge"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="HornShort"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?HornShort"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="SirenFire"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?SirenFire"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="SirenPolice"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?SirenPolice"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

 <SoundDataNode name="StupidSound"> <AudioSource name="Sounds/AudioSource_SmallHorn"/>
   <Noise ID="4" range="30" volume="60" time="3" heat_map_strength="0.2" heat_map_time="90"/>
   <AudioClip ClipName="#@modfolder:Resources/GuppyMobilesSounds.unity3d?StupidSound"/>
     <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="3"/> <MaxEntities name="6"/> <MaxRepeatRate value="0.01"/> 
 </SoundDataNode>

</append>

</configs>

 

- - - Updated - - -

 

Note that there is only ONE .unity3d file, "GuppyMobilesSounds.unity3d", but references to different parents ("BellBike", "HornBattle", etc).

 

You'll see that SoundDataNode name is the only one that's important, because that's what the other xml's reference.

 

Is there a better way? Probably. Does my way work? Yep.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...