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

I'm late to the discussion, but in the case of Unity and sound files, there are no parents or children. You dont need to drag them into the scene or hierarchy. Just right click on the sound file and export. Done.

 
I'm late to the discussion, but in the case of Unity and sound files, there are no parents or children. You dont need to drag them into the scene or hierarchy. Just right click on the sound file and export. Done.
I originally just dragged it into assets and exported it. That didn't work.

 
Last edited by a moderator:
@Guppycur hello. Help me please.

How I can write entityclasses for change phrases of trader to my variant?

npcTraderTemplate have no this parametr ((

 
@Guppycur hello. Help me please.
How I can write entityclasses for change phrases of trader to my variant?

npcTraderTemplate have no this parametr ((
If that parameter is not in entityclasses then it cannot be changed there. I don't where you would change it or if you even can.

 
@Guppycur hello. Help me please.

How I can edit entityclasses.xml in my modlet for change phrases of trader to my variant?

entity_class npcTraderTemplate or other have no like this parametr as zombie entity_class((

Now I mast comment out this and orther code, for it work in my modlet

Code:
<!--<SoundDataNode name="traderdislikesaleaccepted"> <AudioSource name="Sounds/AudioSource_VO"/>
<Noise ID="1" range="1" volume="7" time="5" muffled_when_crouched="0.5"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_01"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_02"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_03"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_04"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_05"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_06"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_07"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_08"/>
<AudioClip ClipName="Sounds/VO/Trader/Male/Dislike/trader_male_dislike_sale_accepted_09"/>
<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="1.111"/> </SoundDataNode>-->
 
Perhaps something else was preventing it from working but I do all my sounds this way and they seem to work fine. Your way would also work.

 
I know nothing about traders; their references might be in traders.xml or whatever their xml is called.

 
Sorry for the length....iIf anyone is searching and finds this, I hope it helps. I know this post is a little old but I've been struggling with creating a new sound for a18.3. Followed all the tutorials I can find, tried many things. Finally found what worked (for me). I believe, from all my testing, that a *very specific* version of Unity is needed, or at least a very narrow range of Unity versions will work. It also appears that you need to be using Windows.

I'm a complete Unity noob, so please be gentle if I've misstated the obvious :)

So, for a18.3...

Use a Windows OS (I'm using Windows 10). I've tried the Linux versions (On Ubuntu 18.04 LTS) and have had issues with it. it may work somehow/some way but I'm so tired of experimenting. I had all sorts of issues like buttons not working the same way like windows does (drop downs missing, etc). And I suspect that there may be other issues like when exporting files (because the base OS is not Windows). Maybe its' just my install(s) though. If I try on Unix again I may post how, but I've also had much difficulty getting the UABE working on Ubuntu (it works, once again some options not working the same as Windows) and the new DMT mod maker I cant get working on Ubuntu.

Get a version of Unity installed that's compatible with a18.3 (or whatever version you want to mod for. I believe every game version needs a specific version of Unity (ots documented somewhere on these forums) and for 18.3 its not just any Unity version "2019.x.x" but specifically 2019.1.x and maybe "2019.1.14f1"

- Download Unity Hub from https://unity3d.com/get-unity/download . The Unity Hub is like a "manager" of Unity installs and projects.

- Open Unity Hub, click "installs"

- Click "Add", then click the "Download archive" link

- Find for a18.3 of 7D2D, find version "2019.1.14f1" and click the "Unity Hub" button, which will cause Unity Hub to download that version. Wait forever for it to install.

Note: For the next step I'm not sure if you need to open a "new" project in order to set the Unity "Projects folder" for all projects OR if you can skip setting a default project folder. There's probably several ways to add a project but I'm not sure what is "best". just keep going forward ;)

Now go get the/an example project (this may not be completely necessary but it helps to have anyway, and it works)

- Go to https://github.com/7D2D/Templates-and-Utilities

- Extract the TutorialProjectTemplate2019.1.zip folder <- Note, this repo does not have any specific releases to choose so its possible it will be updated in the future and the zipped tutorial will change/be updated. Since its literally named 2019.1 this is unlikely. The last commit date on the repo I'm using is: Dec 11, 2019.

- From within that folder, copy the XythTutorialsV2 into your Unity Projects Folder. If you don't have a project folder, make one, or it's possible you could just remember where this project folder is.

- Go back to Unity Hub, on the main "page" click "Add" and select the XythTutorialsV2 folder.

- Now in the Hub you will see an item for the Project named "XythTutorialsV2" and *hopefully* the Hub will auto add/discover the Version of Unity to it. If it does not then you have to choose a version of Unity to open it with from the "Unity Version" drop down/column

- Click on the Project to Open it. If the Unity you downloaded and the version of Unity used in the project differ, the Hub will either ask you to "upgrade your project" or "downgrade your project, but it may cause issues". As of this dates posting, I did not get such a pop up with the Project version and Unity version I chose. I did choose other unity versions (as I was testing) and every option I chose caused the sound I made for the 18.2 game to not work.

Now have Unity open to the tutorial project. The tutorial project has a few special things (I have read) in it that you do not get with an empty project:

1. It has a working "flag" demo. For sounds we do not need it

2. It has had all the "tags" from the game added to it. For sounds we don't need to concern ourselves with picking tags for things.

3. It has a c# file in it called "MultiPlatformExportAssetBundle.cs". We need this (badly) as you cannot export .unity3d files without it. Vanilla Unity will not export .unity3d files (maybe someone can explain why this is.). Also, for your notes, there appears to be another c# file called ExportAssetBundles.cs in the https://github.com/7D2D/Templates-and-Utilities project that other people reference in the forums BUT I believe this is an older version and the "MultiPlatformExportAssetBundle.cs" is the proper one to use.

Note: I'm going to cover just exporting 1 sound, but you can do multiple sounds (watch the video tutorials) into a single .unity3d file.

Note: I've seen references to 3 types of sound formats working: .wav, .mp3, and .ogg. For this I'm only going to use .wav files as the UABE extracts these by default.

Now "Import" the sound file unto Unity via drag + drop. Lets say our sound file is named "newsound.wav" and it's on the Windows desktop. Just "drag" the sound file from the desktop into Unity in the "Assets" panel (located under the "Projects" tab). You can drag it onto the Assets folder or into the Assets panel.

At this point: There appear to be 2 differing philosophies in how to export sound(s) into a .unity3d format and use them in the game. Some people claim one or the other works, likely they both work in some contexts.

Export the sound into a .unity3d file:

Method 1: Just export the sound. In Unity, right click on the "newsound.wav" file and choose "Build Multi-Platform AssetBundle From Selection". When the pop up appears, name the file "MyNewSound.unity3d" and save it. Note: The "Build Multi-Platform AssetBundle From Selection" ONLY appears because you have the "MultiPlatformExportAssetBundle.cs" file provided with the tutorial in the Assets folder.

Method 2: Create GameObjects and attach the sound file to it. NOTE: THIS METHOD DID NOT WORK FOR ME but it seems it works for others. I have no idea why. I'm documenting it here just to put both methods side by side.

- In Unity, go to the "Hierachy" tab, then into the "XythTutorials" area and right click on the empty space in the window. A pop up selector will appear. Choose "Create Empty".

- A new item called "GameObject" will be created (a little cube icon). Right click and Rename this object "newsound2". Note: You can name this anything you want, but I would stick to no spaces. I'm specifically not naming this "newsound" so the differences between Method 1 and 2 can be shown.

Note: In the forums this is referenced as the "parent".

- Right click on the "newsound" object. A pop up selector will appear. Choose "Create Empty". A new "GameObject" will appear under the "newsound2" object. Note: In the forums this is referenced as the "child".

- Select "newsound.wav" and drag it onto the "GameObject" icon you just created.

- Drag the "newsound2" game object into the "Assets" folder where your "newsound.wav" is. It will make a new cube icon.

- In Unity, right click on the "newsound2" cube icon and choose "Build Multi-Platform AssetBundle From Selection". When the pop up appears, name the file "MyNewSound.unity3d" and save it.

Add you new sound to a custom modlet.. You should now have a "MyNewSound.unity3d" file created. This is beyond this tutorial, but read the forums and make (or copy) a modlet that uses a custom sound file. I would suggest https://github.com/Khelldon/7d2dModlets/tree/master/Khelldon-GetHorny as it modifies the horns on the vehicles in the game and all you have to do is modify it to add your custom sound for a vehicle in the game then play the horn on a vehicle to hear your custom sound. Ultimately in the modlet you will need:

- A folder in the modlet called "Resources" where you will place your MyNewSound.unity3d" file

- To have something in the modlet that modifies the "sounds.xml" file to add the sound to a SoundDataNode, and then reference that SoundDataNode's "name" to play the sound. I'm choosing here to document what a new SoundDataNode may look like just to show how Method1 and 2 differ in referencing the new sound file:

EXAMPLE SoundDataNode in sounds.xml:

<SoundDataNode name="soundDoughsNewSound">

<AudioSource name="Sounds/AudioSource_Interact"/>

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

<AudioClip ClipName="#@modfolder:Resources/MyNewSound.unity3d?newsound"/>

<Channel name="Mouth"/>

<maxVoicesPerEntity value="1"/>

<LocalCrouchVolumeScale value="1.0"/>

<CrouchNoiseScale value="0.5"/>

<NoiseScale value="1"/>

</SoundDataNode>

So: The I'm not sure if all the sound properties above are needed, but the new sound is added via this line:

<AudioClip ClipName="#@modfolder:Resources/...../>

When using Method 1, the line looks like:

<AudioClip ClipName="#@modfolder:Resources/MyNewSound.unity3d?newsound"/>

When using Method 2, the line looks like:

<AudioClip ClipName="#@modfolder:Resources/MyNewSound.unity3d?newsound2"/>

Notice the slight difference:

- The actual file name of the sound file "newsound.wav" is used in Method 1 to reference the sound, except the file extension is not used. This means how you name the original sound file matters in how you ultimately reference it in the game.

- The actual file name of the sound file "newsound.wav" is NOT used in Method 2 to reference the sound, its actually the name of the parent GameObject you renamed to "newsound2", This means how you name the original sound file does not matter in how you ultimately reference it in the game.

 
Last edited:
I use method 1, it is simpler and it works.

Thanks for the write-up! I'm sure it will be a great help to many.

 
Yeah, for just making some sounds method 1 is very nice. I'm guessing method 2 has to do more with already needing models and attaching sounds to it and having a "structure" of a project to maintain (and setting the camera for sound distance/direction, etc. ) so it's easier to export like that when you have all other sorts of project work and sounds are a small part. Maybe there's some extra setting somewhere that makes method 2 work (for me/my install) and I'm missing it.

Oh! Also: Thanks for the tutorial project and videos!

 
Last edited:
Sorry for the length...
Oh my God thank you so much. I have been trying to figure this out now for a few months with no luck. I'm new to unity and only started learning it a few months ago. Again thank you!!!

 
Glad it was helpful for someone else! I spent a few weeks messing with it on and off trying to figure it out. I literally installed Unity to mess with modding this game and I thought "this wont be so bad". Wrong, I was ;)

 
Glad it was helpful for someone else! I spent a few weeks messing with it on and off trying to figure it out. I literally installed Unity to mess with modding this game and I thought "this wont be so bad". Wrong, I was ;)
I know exactly how you feel. I'm learning unity for that exact reason as well and oh man, its not as easy as I thought it would be lol.

 
Back
Top