Jump to content
Sign in to follow this  
AudioRejectz

Add your own custom sounds

Recommended Posts

Hi, im hoping someone can help with this.

I have some custom sounds in my mission file, and i am trying to set them up so they have something like a 5% chance of activating the trigger

At present i have this:

I created a folder called sounds i put into my mission file, in there i have scream.ogg and scream2.ogg

I created a description.ext file and used

class CfgSounds
{
// List of sounds (.ogg files without the .ogg extension)
sounds[] = {scream,scream2};

// Definition for each sound
class scream
{
name = "scream"; // Name for mission editor
sound[] = {\sounds\scream.ogg, 0.4, 1.0};
titles[] = {0, ""};
};
class scream2
{
name = "scream2"; // Name for mission editor
sound[] = {\sounds\scream2.ogg, 0.4, 1.0};
titles[] = {0, ""};
};

Now in my mission.sqm i have

class Sensors
   {
       items=1;
       class Item0
       {
           position[]={7795.5649,83.821281,9173.4346};
           activationBy="WEST";
           interruptable=1;
           age="UNKNOWN";
           class Effects
           {
               voice="scream";
           };

I just have no idea how to randomize the chance of the trigger, does anyone know how i could do this please

Kind Regards

Edited by AudioRejectz

Share this post


Link to post
Share on other sites

That's a good question. As far as I know you can't make a trigger activate randomly. Though it wouldn't surprise me if it was possible, I've just never heard of literal, random trigger activations. Here's something to try, idk if it will work. You could set a trigger to repeat, and set a condition. Lets make up a variable, say randomTrig. Also, set the activation up to play the sound. On the deactivation, put randomTrig=false ... In a seperate sqf file you could put bis_fnc_random into a loop. maybe someone else has a better solution, that's all I could come up with atm.Place a functions module on the map.

condition:

randomTrig

activation (play your sound)

deact:

randomTrig=false

randomScript.sqf

waituntil {!isnil "bis_fnc_init"};

while {true} do

{

_rand = [1,2,3] call BIS_fnc_selectRandom;

switch (_rand) do {

               case 1: {randomTrig=true};
               case 2: {};
               case 3: {};

                        };
sleep 10;

};

Edited by Iceman77

Share this post


Link to post
Share on other sites

Don't use BIS_fnc_selectRandom, ref this thread. Condition:

this && ((random 1) < 0.05)

For activation you could also choose to delay and delete remaining triggers, or make sure all are set off by combining the condition, like:

(this && ((random 1) < 0.05)) || alarmsactivated

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  

×