Author Topic: Coding help on an EngineSound.cs file? (SOLVED)  (Read 295 times)

Hi,

I'm attempting to paste code from Gunship_Helicopter.cs to Bronx_EngineSound.cs.

The code allows an audio file to play over another audio file for instance: audioCLOSE + audioFAR
to give a distant-like effect using two audio files.

I have been trying to get the code to function on the EngineSound.cs for over three hours with no success.
Either one sound plays or the other. Not both sounds layered on top of each other at varying distances as intended.
Both audio files used in the EngineSound.cs file function, though as stated only one file will play.


Would anyone know the problem or a solution to this?


« Last Edit: December 05, 2021, 06:12:13 PM by Death The Kid »

it sounds like you're playing the audio loops on the same slot - you need to assign the sounds to different slots (4 slots are available, 0 to 3)
have one sound play on slot 0, and the other one on slot 1. and also probably post the code where the sounds are attached to the vehicle.

on a different note: most of us remaining modders are highly active on the BCC (formerly Blockland Content Creators) discord, you can find a link to join it here: https://forum.blockland.us/index.php?topic=320055.0

The code you are looking for are lines 904 and 905 in gunship_helicopter.cs
Code: [Select]

%vehicle.playAudio(0, HelicopterGunshipSound);
%vehicle.playAudio(1, HelicopterGunshipDistantSound);

EngineSounds uses a datablock attribute ES_AudioSlot to determine which audio slot to play to, so you can try putting ES_AudioSlot = 2; in the AudioProfile datablock for the engine sound you're trying to add. Or, you can try changing HelicopterGunshipDistantSound to use slot 2, since ES_AudioSlot defaults to 1 if not set

The code you are looking for are lines 904 and 905 in gunship_helicopter.cs
Code: [Select]

%vehicle.playAudio(0, HelicopterGunshipSound);
%vehicle.playAudio(1, HelicopterGunshipDistantSound);

EngineSounds uses a datablock attribute ES_AudioSlot to determine which audio slot to play to, so you can try putting ES_AudioSlot = 2; in the AudioProfile datablock for the engine sound you're trying to add. Or, you can try changing HelicopterGunshipDistantSound to use slot 2, since ES_AudioSlot defaults to 1 if not set
it sounds like you're playing the audio loops on the same slot - you need to assign the sounds to different slots (4 slots are available, 0 to 3)
have one sound play on slot 0, and the other one on slot 1. and also probably post the code where the sounds are attached to the vehicle.

Thank you all for your help. Problem solved. Locking topic.