Custom sound start and stop

Baz88

New Member
Hello,

I've looked all over this forum trying to find what i'm looking for.
What I want is this.

I have an custom sound file (.ogg) and i want it to go off on the map in a radius of 5
and i want that the sound play once (not over and over again) unless you come in the 5 radius circle agian. (then i want it to go once again)
I'm looking everywhere and just can't figure it out.

Can someone help me please?
 
Well i know what triggers are but how do i stop the trigger that's my question. how do i terminate musicfile

EDIT: I think i found it. will let you know soon!
 
Code:
            expActiv="myvar = [] execVM ""myscript.sqf"";";
            expDesactiv="terminate myvar; titleText [""Terminated"", ""PLAIN DOWN"", 3];";
 
i have it half working now. when i walk into the circle he activates the .ogg file. only he can't find the file that i uploaded. uploaded it in scripts/sound1.ogg and put that in the mission.sqm as well but it will not work.
realy frustrating. someone an idea?
 
description.ext

Code:
class CfgSounds
{
    sounds[] = {};
 
    class mysound
    {
        name="mysound";
        sound[]={Scripts\sound.ogg,0.9,1};
        titles[] = {};
    };
};
you are missing something like this ... not sure this is correct tho
 
Looks correct HalvJearne. :)
I used the protective dome that executes after 1 second (sleep 1) a music for everyone that walks in this area. Don't forget to do like HalvJearne said,and dont forget that the command you need to use to ectivate sound (example with the Description.ext of HalvJearne): playSound "mysound";
Change "mysound" by the one you entered here :
class CfgSounds
{
sounds[] = {};

class mysound
{
name="mysound";
sound[]={Scripts\sound.ogg,0.9,1};
titles[] = {};
};
};
 
Searched a bit more,and found out that you just need to modify a bit of the protective domes :)
Here's a little tutorial by me :)

First :
In your Description.ext :
Add this code after "class vehicles" and before "class markers":
//Begin code
class Sensors
{
items=1;
class Item0
{
position[]={distancefromwest,elevation,distancefromsouth};
a=130;
b=97;
rectangular=1
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="Music1";
expCond="(vehicle player) in thislist;";
expActiv="Music1 = [] execVM ""Music1.sqf"";";
expDesactiv="terminate music1; titleText [""Listen to dah music"", ""PLAIN DOWN"", 3];";
class Effects
{
};
};

};
//End code
Now save that.

Step 2:
Make a new .sqf with this little code in it.
//Begin code
playSound "Music1"
//End code

Step 3:
You can change "Music1" to whatever,but don't forget to replace in the Description.Ext too!
If you want to use MusicExample1 as name,change this line :
//Begin line
name="Music1";
//End line
to
//Begin line
name="MusicExample1";

AND

//Begin line 2
expActiv="Music1 = [] execVM ""Music1.sqf"";";
//End line 2
to
//Begin line 2
expActiv="MusicExample1 = [] execVM ""MusicExample1.sqf"";";
//Begin line 2

AND

//Begin line 3
expDesactiv="terminate Music1; titleText [""Listen to dah music"", ""PLAIN DOWN"", 3];";
//End line 3
to
//Begin line 3
expDesactiv="terminate MusicExample1; titleText [""Listen to dah music"", ""PLAIN DOWN"", 3];";
//End line 3

Step 4 (if you changed Music1 to MusicExample1) :
Rename your Music1.sqf to MusicExample1.Sqf

Step 5
Change this line (in MusicExample1.sqf)
//Begin line playsound
playSound "Music1"
//End line playsound
to
//Begin line playsound
playSound "MusicExample1"
//End line playsound

Step 6 (DONT FORGET THIS)
Put the coordinates where you want the area here :
//Begin code coordinates
position[]={distancefromwest,elevation,distancefromsouth};
//End code coordinates
And use this (copy pasted from Protected Domes DayZ.St tutorial) to check your coordinates.
Player position data copied straight from the database can NOT be used for the dome,
it needs CRITICAL modification for it to work: (do this wrong and the dome will end up in the wrong location)

// This is an example of an player location from the Bliss database:
[186,[1326.18,2482.99,0.176]]

// Make it look like this:
{1326.18,0.176,2482.99};

What did I change? I removed all of the [ ] in it and also 186, (186 is the heading where the character was looking to when it logged out),
and also the second and last bit are switched around. That is IMPORTANT
Now, in this format, it can be used to paste into the position section of the script in the mission.sqm

// Example of the code how it looks with a correct location:
position[]={1326.18,0.176,2482.99};

Last step:
Save everything!

Tadam,not tested yet,but should work.

Is my first tutorial,so yeah,hope you enjoyed. :)
 
wow lot's of code :p well I have it working on my pc so local works perfect. now busy with getting it online! keep you guys up to date. btw thanks for al the help!!
 
All the pleasure is for me. :)
If you want,with the Domes script,in place of killing players when joining area,there are soooo much otheroptions like : only Heroes/bandits can come in the zone :
Change this :
// Below, put the UID of player(s) where it says pasteUIDhere that you want to give access to the dome
if ((getPlayerUID player) in ["pasteUIDhere" , "pasteUIDhere"]) exitWith {

to this :
if (isPlayer _x) && ((_x getVariable ["humanity",0]) < 0) then {
Or removing someones weapon if he enters (after x seconds)
Change this :
player setDamage 1;
to this :
removeAllWeapons player;

Or add the three ! Heres the code :)
PlayerHumanity = (player getVariable"humanity");
if (PlayerHumanity < -5000) then {
titleText ["You are now entering bandit base.", "PLAIN DOWN", 3];
} else {
titleText ["You are entering a restricted area, turn back!", "PLAIN DOWN", 3];
sleep 15;
titleText ["You are entering a restricted area, turn back!", "PLAIN DOWN", 3];
sleep 15;
titleText ["You are entering a restricted area, turn back!", "PLAIN DOWN", 3];
sleep 15;
titleText ["You are entering a restricted area, turn back, you will be killed!", "PLAIN DOWN", 3];
removeAllWeapons player;
sleep 15;
titleText ["You are entering a restricted area, turn back!", "PLAIN DOWN", 3];
sleep 15;
titleText ["Have a nice day!", "PLAIN DOWN", 3];
sleep 5;
player setDamage 1;
};
And sooooo much more..have fun scripting!
 
okey i have i working in the editor if i walk in the circle the sound plays. but... if i put it on my server it won't work. i copied everything the same. what am i doing wrong? can someone help me out without spamming about some dome i don't want?
 
Oh sorry if I was "spamming" you. Look,If you would've asked it nicely,then I would offcourse help you,but look,if i'm spamming you,ask another person.
 
@xBowBii
well you are kinda spamming him ... try scroll up a bit, if you forgot what you wrote

@Baz88
there is no need to be rude like that when he is trying to help you.
if you read through his wall of text (and cut away the unnecessary parts) you will find all youre questions are answered in this very thread ...
 
Lol sorry for my bad words :p have it finaly working!!! thanks a lot i will post the solution here for other people!!
 
Back
Top