Jump to content
  • 0

Custom Sounds when entering new area


monkeybrain

Question

So I want to add a sound to a spot on a map when you walk into that area.

 

Here is what  I have so far.

 

Description.ext

class CfgSounds
{
    sounds[] =
    {introSong,CaveAmbient};
    class introSong
    {
    name="introSong";
    sound[]={introSong.ogg,0.9,1};
    titles[] = {};
    };
    
	class CaveAmbient {
		name="CaveAmbient";
		sound[]={\sound\CaveAmbient.ogg,1,1.0};
		titles[] = {};
	};
};

CaveAmbient is the sound.

 

My trigger located in a scripts folder

if (isServer) then
{
  __this = createTrigger ["EmptyDetector", [6553.4043, 14202.878, 81.481537]];
_this setTriggerArea [100, 100, 0, false];
_this setTriggerActivation ["WEST", "PRESENT", false];
_this setTriggerStatements ["this", "playSound ""CaveAmbient"";", ""];
_trigger_0 = _this;
};

which i exectued in the init folder

 

[] execVM "Scripts\trigger.sqf";

 

Anyone done this before?

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

ok i got the sounds working heres my mission sqm

  class item8
        {
            position[]={6553.4043,81.481537,14202.878};
          activationBy="WEST";
            interruptable=1;
            repeating=1;
            age="UNKNOWN";
            class Effects
            {
                voice="CaveAmbient";
           };
        };

I am also looping my sound

 

Musicloop.sqf:

while {true} do {
    playsound "CaveAmbient";
    sleep 21;
};

but I can't seem to get the deactivation trigger to work. When I teleport away from the area the sound continues looping

 

heres what i have for the trigger

 

_this setTriggerStatements ["this", "playSound ""CaveAmbient""; music = true; nul = [] execVM ""Musicloop.sqf"";", "music=false"];

Link to comment
Share on other sites

  • 0

you are quite confusing and dosnt make much sense, but ill try and explain this for you

 

in your first example you have no activation, deactivation or condition line, making it impossible to do much with your music loop, also you have no way to exit the loop, so it will obviusly keep running until the player logs off.

i propose you do something like this:

 

onactivation:

cave = execVM 'Musicloop.sqf';

ondeactivation:

terminate cave;
Link to comment
Share on other sites

  • 0

on activation I now have

playSound "CaveAmbient"; cave = execVM 'Musicloop.sqf';

on deactivation i now have

terminate cave;

the sound loops keeps playing after i leave the trigger area, i tried without

playSound "CaveAmbient"

but still same problem

 

nvm I turned repeating on and it works now. Thanks!

 

Also do you know if it possible to have a trigger to make part of the map darker? I have a cave but its pretty bright inside. Would be nice to make it darker if that's possible.

Link to comment
Share on other sites

  • 0

on activation I now have

playSound "CaveAmbient"; cave = execVM 'Musicloop.sqf';

on deactivation i now have

terminate cave;

the sound loops keeps playing after i leave the trigger area, i tried without

playSound "CaveAmbient"

but still same problem

 

nvm I turned repeating on and it works now. Thanks!

 

Also do you know if it possible to have a trigger to make part of the map darker? I have a cave but its pretty bright inside. Would be nice to make it darker if that's possible.

 

Unless you want to write custom dialog, it's not possible.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...