Tired of having to switch between different engine sound mods just to use the sound you really want? Fret not! With this simple tutorial, you can add any engine sound you want to any vehicle! Before attempting any of this, be sure to download the patch that is attached to this post. There's also an example for the Moonhawk provided as well, demonstrating that this really does work! Without further ado, here's how it works (we'll be using the Moonhawk as an example): 1) Download the 'moonhawk_engine.ogg' file and place it in your 'vehicles/moonhawk' folder. Alternatively, you can download the attached example. 2) Create a new file called "sounds.cs" in the folder of where your vehicle is located: vehicles/moonhawk/sounds.cs: Code: singleton SFXProfile(MoonhawkEngine) { fileName = "vehicles/moonhawk/moonhawk_engine.ogg"; description = "AudioDefaultLoop3D"; }; Everything should be self-explanatory. In this case, our new engine sound is called MoonhawkEngine. We then link to an .ogg file containing our engine sound (paths must be fully qualified, i.e. 'vehicles/<carname>/<soundFileName>.ogg'). Don't change the 'description' property! You can define as many of these as you want, for example: Code: singleton SFXProfile(MoonhawkEngine) { fileName = "vehicles/moonhawk/moonhawk_engine.ogg"; description = "AudioDefaultLoop3D"; }; singleton SFXProfile(MoonhawkEngineBeefy) { fileName = "vehicles/moonhawk/moonhawk_engine_beefy.ogg"; description = "AudioDefaultLoop3D"; } 3) Next, in your JBeam, preferably one that defines the engine(s) for the vehicle, set it up like so: vehicles/moonhawk/moonhawk_engine.jbeam (~line 40): Code: "engine":{ "engineSound":"MoonhawkEngine", "idleRPM":700, "shiftDownRPM":1800, "shiftUpRPM":4200, "maxRPM":4500, "inertia":0.17, "friction":28 "brakingCoefRPS":0.15 "burnEfficiency":0.30 "throttleSensitivity":1.5 "torqueReactionNodes:":["e1l","e2l","e4r"] }, We add a new field callled 'engineSound', which is the name of the SFXProfile you defined in 'sounds.cs'. NOTE: The 'engineSound' property is optional and does not take a filename, but rather the name of an SFXProfile that is currently defined. The default is 'EngineTestSound'. You can also define a default "global" engine sound by going to the primary JBeam and doing so: vehicles/moonhawk/moonhawk.jbeam (~line 85): Code: "engine":{ "engineSound":"MoonhawkEngine" "onBeamBreakDisableDriveshaft":["driveshaft"] "waterDamage": {"[engineGroup]:":["moonhawk_engine_intake"]} }, This allows for the specified sound to be the default unless overridden by new engine types! Now when the Moonhawk has the '378 CUI V8 Engine', it'll use our custom sound! For practice, try adding a new sound for the 'Supercharged 378 CUI V8 Engine' Enjoy! UPDATE: I've included a "generic" sound pack that gives unique sounds for the D15, Bolide, and Moonhawk. A great example of custom sound packs! (Credits to Nemesis' sound pack for the D15 and Bolide sounds)
Make this without editing the global lua files if possible BeamNG supports custom lua per vehicle now, eg. hatch/lua/sounds.lua. You should see if that's possible, because I'm not sure(Lua noob). Ah well, worth a try
This method is much easier and requires less work. Having a lua file just for custom engine sounds would cause compatibility issues.
OP updated, generic sound pack now included! I might see if there's a way to assign engine sounds via Lua instead of modifying the JBeam files.
You'd have to look in the 'sounds.lua' file to understand why it's pretty much impossible to pull off. And not only that, but it would break the ability to add an 'engineSound' property to a JBeam. Ideally, this sort of system should be implemented into BeamNG anyways Besides, it's not like I'm changing any major functionality... Old code: Code: if engineSound == nil then engineSound = createSFXSource("EngineTestSound") end New code: Code: if engineSound == nil then engineSound = createSFXSource(v.data.engine.engineSound or "EngineTestSound") end It really was that easy. EDIT: This is why you don't program at 3 in the morning... Code: // Unique vehicle sounds mod // by Fireboyd78 // Last updated: 7/18/2018
Hey Fireboyd78 I hope you don't mind if i kind of steal your topic here but I actually managed to pull off the "impossible". Yesterday in Skype DrowsySam was whining so much about this mod modifying the stock lua files that I gave it a shot and worked out a way to do it. What you basically have to do is this: Go to your vehicles folder (e.g vehicles/hatch) Create a new folder called "lua" in there. This is the new per-vehicle lua feature so every script in that folder gets loaded with the vehicle. Put the attached custom_sounds.lua in that folder. This contains your modified copy of the sounds.lua code and replaces it on initilization. Edit your vehicle's name.cs to create the SFXProfile for you. Example for the Covet Code: %vehicleName = "Ibishu Covet"; singleton SFXProfile(HatchEngine) { fileName = "vehicles/hatch/moonhawk_engine.ogg"; description = "AudioDefaultLoop3D"; }; (very hacky I know) Place an audio file in the proper directory that you have defined above. Edit the .jbeam as explained in the first post to point to your custom SFXProfile. That should be all and you are now able to release your vehicles including custom sounds without any modification of stock script files. I've also attached a complete example for the Covet. Just extract it inside vehicles/hatch/
I don't see why there's any need to freak out over having to modify a global lua file. If people decide to include it in their mods, the people who install it can install the sound mod at their own discretion. With the per-vehicle mod, if people decide to include it, it would require every single vehicle using the mod to update their "custom_sounds.lua" file whenever the BeamNG team decides to update 'sounds.lua'. And not only that, but using the 'name.cs' file to setup custom sounds is hacky. I am not a big fan of that myself. On top of that, you lose the capability to place sounds in 'vehicles/common' and have them shared across multiple vehicles. Not a very good tradeoff... If we can't release mods editing global files, then why let us edit the files? Just because we have per-vehicle lua now doesn't mean we shouldn't edit the other files in the game. /rant
ok i cant get this to work none of the cars have sound now? all i got is the wind/tires sound what did i do rong? or can someone upload the vehicles that have the sound on.
Which files did you download? Reinstall the patch and download the "soundpack-generic.zip" attachment. Replace files if prompted.
i did all three none of them are working and i get a error when i load up a map but i cant see it but my pc goes BING BING.
Since I don't know what all it is that you have done to your game, my only other suggestion is to force update the game. Make sure the game runs after this, then try reinstalling the mod. Don't install the Moonhawk example if you just want to have the sound pack I made.
I've done custom sounds by copying the default sounds.lua to the vehicle's lua folder and adding new entries to art\datablocks\audioProfiles.cs. Looks like I can move the new sound profiles to name.cs now, no need to edit any default files that get reset in updates. Custom lua for sounds is quite complex, but you're not limited to just one sample for the engine and you can make the sounds work the way you want, if you can code it. Some official support for custom sounds would be good, even as a placeholder until the sounds are redone properly. I don't even feel like driving cars with default sounds anymore after doing new sounds for a few of my cars.
The zip file is set up so that you drag the "vehicles" folder over the one in your BeamNG installation.
oh COCK <james may quote i have been putting them into the common folder - - - Updated - - - that still didnt work.