• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Adding a new sound to game.

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

 
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.

 
Look at my pic.

Parent object is blank.

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

 
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.

Code:
<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

Code:
<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.jpg

 
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.


- - - 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.

 
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.


First I actually tried to make one parent to several sounds which of course did not work. Then I tried making several parents with the same name. So in this case, 4 of the zombiefemalescoutroamcustom (not the same name as the original though as that would create an error). So I had the child and sound in each of the parents with the same name. I followed the tutorial and built the file, but still no sound at all.

Last try I did the parent and child for each sound as usual. But then I dropped them in a folder called zombiefemalescoutroam custom and built it. But it did not work either.

I can make it fine with one sound, but as you can see, I have a bit of trouble with getting several sounds work with the same SoundDataNode. =/

edit: sorry if I am hijacking this thread Winterhart, but we do "kinda" have the same problem. Getting the new sounds to the zombies.

 
Last edited by a moderator:
So basically we don't know yet if you are having a unity issue or xml issue.

Let's work on one at a time.

On the unity as you saw in my video, I had several sounds selected at one point. What I did in real life was keep those selected and build ONE unity3d file with all of those sounds, and as you saw from my XML I reference them from one unity3d file, but different parents.

So now let's assume that you did the unity correctly, so now it's an XML issue.

Find the sticky post in tutorials about xpath error checking and run exportcurrentconfigs to see what your xml final result is and that'll help you narrow down the XML issue.

First make sure the sounds.xml is working, then you can diagnose the entityclasses.

 
So basically we don't know yet if you are having a unity issue or xml issue.
Let's work on one at a time.

On the unity as you saw in my video, I had several sounds selected at one point. What I did in real life was keep those selected and build ONE unity3d file with all of those sounds, and as you saw from my XML I reference them from one unity3d file, but different parents.

So now let's assume that you did the unity correctly, so now it's an XML issue.

Find the sticky post in tutorials about xpath error checking and run exportcurrentconfigs to see what your xml final result is and that'll help you narrow down the XML issue.

First make sure the sounds.xml is working, then you can diagnose the entityclasses.
The sounds.xml is not working as I see no edited values. The entityclasses one is working though.

This is how I set it up with 3 sounds for one SoundDataNode.

entityclasses..

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

Code:
<configs>
<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutalertcustom"> <AudioSource name="Sounds/AudioSource_Screamer"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalertcustom1"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalertcustom2"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutalertcustom3"/>
	<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>		
</configs>
 
...and you're not seeing that entry at the bottom of sounds.xml? Something is wrong then, because the xpath looks correct.

 
It's working!!!!!!

sounds.xml

<append xpath="/Sounds">

<SoundDataNode name="ZombieSounds">

<AudioSource name="Sounds/AudioSource_Pain"/>

<Noise ID="1" range="1" volume="7" time="3" muffled_when_crouched="0.5"/>

<AudioClip ClipName="#@modfolder:resources/ChangeSounds.unity3d?ZombieSounds"/>

<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="0.9"/>

</SoundDataNode>

</append>

entityclasses.xml

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundRandom' and @value='Enemies/Base_Zombie_Female/zombiefemaleroam]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundAlert' and @value='Enemies/Base_Zombie_Female/zombiefemalealert]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundAttack' and @value='Enemies/Base_Zombie_Female/zombiefemaleattack]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundHurt' and @value='Enemies/Base_Zombie_Female/zombiefemalepain]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundDeath' and @value='Enemies/Base_Zombie_Female/zombiefemaledeath]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundSense' and @value='Enemies/Base_Zombie_Female/zombiefemalesense]/@value">ZombieSounds</set>

 
Last edited by a moderator:
...and you're not seeing that entry at the bottom of sounds.xml? Something is wrong then, because the xpath looks correct.
Sorry. Now that I have doublechecked it is indeed in the bottom of the sounds.xml. I probably checked on the wrong gameworld save.

Code:
	<SoundDataNode name="zombiefemalescoutalertcustom"><!--Element appended by: "RobelotoScreamerSound"--> <AudioSource name="Sounds/AudioSource_Screamer" />
	<AudioClip ClipName="#@modfolder(RobelotoScreamerSound):Resources/screamersounds.unity3d?zombiefemalescoutalertcustom1" />
	<AudioClip ClipName="#@modfolder(RobelotoScreamerSound):Resources/screamersounds.unity3d?zombiefemalescoutalertcustom2" />
	<AudioClip ClipName="#@modfolder(RobelotoScreamerSound):Resources/screamersounds.unity3d?zombiefemalescoutalertcustom3" />
	<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>
</Sounds>
But still not getting the sound. Thank you for helping us this far. It is probably something I am doing wrong when building in Unity. I know I am not missing anything when making parent and a child for every sound. I also reset the transform values. But it must be something else. Going to try for myself a bit more and see if I can manage to solve it.

 
@Winter: Okay, you're getting close! At least the xml part is right, as it's trying to read the .unity3d file looking for the sound.

In your case, you're confusing the parent name with the unity3d file name. The unity3d file is what you save the BUNDLE as when you right click that script. What you want to reference is the parent name, NOT the child name. The child name is immaterial. So, LEAVING YOUR XML ALONE...

...in Unity, change the PARENT name to ZombieSounds, and then when you rightclick to bundle it, change the .unity3d file name to ChangeSounds.unity3d, then you should be good to go.

@Robeloto: Are you getting the same error as Winter is?

Your xml still looks right, so see the above as I think you're doing what Winter is doing.

 
@Winter: Okay, you're getting close! At least the xml part is right, as it's trying to read the .unity3d file looking for the sound.
In your case, you're confusing the parent name with the unity3d file name. The unity3d file is what you save the BUNDLE as when you right click that script. What you want to reference is the parent name, NOT the child name. The child name is immaterial. So, LEAVING YOUR XML ALONE...

...in Unity, change the PARENT name to ZombieSounds, and then when you rightclick to bundle it, change the .unity3d file name to ChangeSounds.unity3d, then you should be good to go.

@Robeloto: Are you getting the same error as Winter is?

Your xml still looks right, so see the above as I think you're doing what Winter is doing.
I now tried only with one sound.

entityclasses.xml

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

Code:
<configs>
<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutdeathcustom"> <AudioSource name="Sounds/AudioSource_Pain"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutdeath1"/>
	<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>
</configs>
Unity video: https://streamable.com/ytilx

My second try:

I changed the SoundDataNode name to the same name as the audioclip name.

Code:
<configs>
<append xpath="/Sounds">
<SoundDataNode name="zombiefemalescoutdeath1"> <AudioSource name="Sounds/AudioSource_Pain"/>
	<AudioClip ClipName="#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutdeath1"/>
	<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>
</configs>
Then I of course changed the entityclasses.xml too.

Code:
<configs>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundDeath']/@value">#@modfolder:Resources/screamersounds.unity3d?zombiefemalescoutdeath1</set>
</configs>
In unity I also changed the name of the parent to zombiefemalescoutdeath1. I reset the transform values and I build the file. The xml's are alright. No error when I exportcurrentconfigs. But either way I am not getting any sound when I kill the screamer. It is just silent. :(

I do notice that Winterhart does not point to the unity3dfile in the entityclasses.xml!

Code:
<set xpath="/entity_classes/entity_class[@name='zombieArlene']/property[@name='SoundSense' and @value='Enemies/Base_Zombie_Female/zombiefemalesense']/@value">ZombieSounds</set>
Maybe I need to get rid of the #@modfolder:Resources/screamersounds.unity3d? code?

 
Last edited by a moderator:
Entityclasses:

Code:
<configs>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundDeath']/@value">zombiefemalescoutdeath1</set>
</configs>
You're only importing the sound to sounds.xml, the only thing you do in entityclasses or items or blocks or vehicles is REFERENCE the sounddatanote name you gave it.

 
Entityclasses:

Code:
<configs>
<set xpath="/entity_classes/entity_class[@name='zombieScreamer']/property[@name='SoundDeath']/@value">zombiefemalescoutdeath1</set>
</configs>
You're only importing the sound to sounds.xml, the only thing you do in entityclasses or items or blocks or vehicles is REFERENCE the sounddatanote name you gave it.
Haha and I just noticed the same time you posted this! :D Now I hope it is working!

 
Looks like you figured it out while I was typing. =)
Haha yes! Thanks you so so very much for all your help! Man, I spent the whole damn saturday and sunday morning with this game, but it was worth it! Now it works perfectly! Time for bed! ^^

 
...in Unity, change the PARENT name to ZombieSounds, and then when you rightclick to bundle it, change the .unity3d file name to ChangeSounds.unity3d, then you should be good to go.
What I finally did (before I read this) that is working is create a parent object named ChangedSounds, and then leaving the child object named Game Object and attaching the sound to it. It is all working now. I edited the post to show that.

Thank you for all your help. It really isn't all that hard IF you know what you're doing lol

 
Back
Top