Jump to content
Sign in to follow this  
Jex =TE=

Custom Sounds in Missions

Recommended Posts

Hi all,

I'm trying to get a recording I made play in game. It's just under 3 mb's and I am looking at the editor guide which i'm struggling with. It says...

Quote[/b] ]

If one wants to create his own sound, it has to be defined in the description.ext first. This

sound can be used by typing the respective name into the syntax. This name should be

the one which has been defined in the description.ext before.

MySound=createSoundSource ["SoundName",position Player,[],10]

in the description.ext I put

Quote[/b] ]

class CfgSounds

{

sounds[] = {scottmills};

class scottmills

{

name = "scottmills";

sound[] = {\sounds\scottmills.ogg, db+20, 1.0};

};

};

The sound file is a .ogg and I use a game logic called SM1 to include the initialization...

MySound=createSoundSource ["scottmills",position SM1,[],10]

Now I can see 3 tags here MySound, scottmills and SM1. SM1 is the name of the game logic (which works if I use the little dog example from the editor manual, Dog1=createSoundSource ["LittleDog",position SM1,[],10]), scottmills is already defined in the description.ext but I don't see what MySound is?

When running the preview i used to get get

NoEntry 'bin\config.bin/cfgvehicles.Sound1'.

I have changed that since to a trigger and adjusted the desc.ext but now when I enter the trigger area I get...

"Error 0 elements provided, 3 expected"

I don't get what "MySound" should be though I have a feeling the answer is staring me in the face.

Can anyone help?

Thanks,

Share this post


Link to post
Share on other sites

I have never used or even seen that createSoundSource command before, so I don't know what its intented use is over the "normal" sound commands such as say or playSound.

I suggest you read up on tutorials that utilize these old commands instead. Download a single player mission that uses custom sound files (most does I think), de-pbo it and examine it in the editor and its description.ext.

Copy this setup to your own mission using the original sound. Make sure this works. then try replacing the sound with your own. If it still works, the sound file is at least ok for the given command used. If not, you have to try other save settings in your sound editor.

Share this post


Link to post
Share on other sites

createSoundSource says the sound comes from cfgVehicles, not cfgSounds.

Eg: see sounds.pbo config.cpp

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgVehicles

{

class Sound

{

scope = 0;

side = -1;

animated = "false";

vehicleClass = "Sounds";

icon = "\ca\data\data\vlajka";

mapSize = 10;

};

class LittleDog: Sound

{

scope = 2;

sound = "LittleDogSfx";

displayName = "$STR_DN_LITTLE_DOG";

};

CfgSounds works with commands like: say, playSound

There are many different sound classes and specific commands for each class which are often not interchangable.

Eg:

class CfgRadio

class CfgSounds

class CfgMusic

class CfgSFX

class CfgEnvSounds

class CfgVehicles

There is already some sound details in wiki at Description.ext#Sounds which covers some of the issues you had and which GIJOE94 had too.

Tip: Put all sounds in folder 'sound' not 'sounds', then you don't need the file path/folder prefix anymore.

Tip: The line "sounds[] = {......};" seems to be not required any more.

Tip: If you're not a sound maker, you can play *.ogg files for preview using VLC media player.

Share this post


Link to post
Share on other sites

Thanks for the help but this is confusing. In the Wiki's own example from the link you gave, it gives...

Quote[/b] ]

class CfgSounds

{

sounds[] = {};  

 class wolf1

 {

  name = "";

  sound[] = {"\sound\wolf1.ogg", 1, 1};

  titles[] = {};

 };

 class wolf2

 {

  name = "";

  sound[] = {"\sound\wolf2.ogg", 1, 1};

  titles[] = {};

 };

};

so my sound file should replace where wolf.ogg is, right? But what is the syntax for either the trigger or game logic to make the sound play?

Using a game logic I can get a dog to bark on the spot (presumably "bark.ogg") so I should be able to use my own file. The wiki seems to contradict itself and it's a pain in the ass lol

I'll try what you and carl suggested when I get home from work and see what I can work out.

Thanks again guys smile_o.gif

Share this post


Link to post
Share on other sites

I can get the sound to play if I use playsound, even though it gives me an error but that just plays it everywhere. I need to define the sound to be coming from an object (a radio) and for the sound to play and get louder as the players get closer.

Now the "littledog" syntax in bold in a previous post works on a game logic called SM1. I can hear the dog barking as I get closer and I can walk around it and hear it in different ears.

All I want to do is use my own sound file in place of "littledog".

Share this post


Link to post
Share on other sites

It sounds like (no pun intended) you're looking for setSoundEffect command which is in fact a trigger command, as you've requested. The wiki says whether you need to use: CfgSounds, CfgEnvSounds or CfgSFX for each param.

I haven't tried a custom sound for it yet, but using existing sounds, you can do:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _trig = createTrigger["EmptyDetector", _pos];

_trig setTriggerActivation["ANY", "PRESENT", true];

_trig setTriggerArea[100, 100, 0, false];

_trig setSoundEffect["ICE_null", "", "", 'DogSfx'];

Tip: I couldn't get the 'SoundDet' parameter (4th param) to work without at least defining some sound effect too (1st param), so I created a fake sound in CfgSounds called

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class ICE_null {name = ""; titles[] = {0}; sound[] = {"", 1, 1};

Regarding your other statement, if you want the sound to be localised, don't use 'playSound', but try 'say' instead, depending on your case.

I'm not familiar with the idea of using game logics with sound.

Also, the description.ext wiki page is incomplete since it doesn't give examples for:

class CfgSFX

class CfgEnvSounds

class CfgVehicles

Share this post


Link to post
Share on other sites

Sorry to ask this here, but didn't see the need to make another sound thread for this little questions.

How can I stop a sound from playing when it is playing?

I know I can use the playMusic "MUSIC" to play music and then the command playMusic "" to stop it, but how do I do it for sounds?

Share this post


Link to post
Share on other sites

I haven't found a way to stop a "say" command from playing the sound. To overcome this, I simply moved the object far away [0,0]. I'm not sure what kind of object I used at the time, maybe a game logic. Now I tend to use invisible heli objects to play sound, and they seem to work in multiplayer as long as a addPublicVariableEventHandler is triggered on each client.

But for single player missions, stick with "say" for localized sounds (can be a problem with cameras and intros though). If you want to stop the sound, move it to [0,0] i.e for a radio station you turn on and off.

Share this post


Link to post
Share on other sites

Thanks Guys - the say command is working great with the following syntax for the descr.ext

Quote[/b] ]

class CfgSounds

{

sounds[]= {scottmills};

class scottmills

{

name = "scottmills";

sound[] = {scottmills.ogg, db+0, 1.0};

titles[] = {};

};

};

I put this above because I'm finding the syntax isn't the same in the places I'm looking. Now I just need to get it to loop sad_o.gif (lol - 4 hours of mission editing and 10 hours of reading...)

Thanks again smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×