Jump to content

Recommended Posts

Hi
Iv made a hostage rescue scenario, and people can play the slot in coop / multiplayer. but I want there to be a flickering film on the screen in the room with a sound looping infinatly.

Description code

class CfgSounds
{
sounds[]={};

class Music1
{
name = "Music1";
sound[] = {"\music\ee3.ogg", db+0, 1.0};
titles[] = {0,""};
};

};


Trigger code.

tor1 say3D ["Music1", 1000, 3]; 


I found this script but it locked my computer up. I think it was working but i dont know how fix it.

while {true} do
{
tor1 say3D ["Music1", 1000, 3];
sleep x;
}  

Share this post


Link to post
Share on other sites

use playSound3D instead.


 

//description.ext by KK

__EXEC (MISSION_ROOT = __FILE__ select [0, count __FILE__ - 15])



// trigger on activation code
if (isServer) then {
_root = parsingNamespace getVariable "MISSION_ROOT";
_sound = _root + "music\ee3.ogg";
playSound3D [_sound, tor1, false, getPos tor1, 10, 1, 50];
};

 

  • Like 1

Share this post


Link to post
Share on other sites

Or init.sqf:

MISSION_ROOT = call
{
	private _arr = toArray (str missionConfigFile);
	_arr resize (count _arr - 15);
	toString _arr
};
// Also KK I believe... 95% sure! This little baby snippet I've been using for years.

 

Share this post


Link to post
Share on other sites


I pasted your code into my description file but i got and error when i ran the mission file
.if: (encountered instead of '='


I tried just the first lin in the description and the code part in my onActivtion but that didnt work either.
 

Share this post


Link to post
Share on other sites

sorry for being an idiot.

so what goes in my onActivation ? every time i change 


tor1 say3D ["Music1", 1000, 3]; 

to
tor1 playSound3D  ["Music1", 1000, 3]; i get errors

tor1 playSound3D "Music1"; didnt work either.

tor1 playSound3D _sound = _root + "music\ee3.ogg"; 
also not working. 

Share this post


Link to post
Share on other sites
3 hours ago, Quack Rejackt said:

while {true} do
{
tor1 say3D ["Music1", 1000, 3];
sleep x;
}  

 

 

Did you checked the 2nd ex. ?

https://community.bistudio.com/wiki/say3D

 

check:

class Music1{name = "Music1";sound[] = {"music\ee3.ogg", db0, 1.0};titles[] = {};};

Share this post


Link to post
Share on other sites

the sound isnt playing after putting that code in my description file and my init.sqf and i cant work out how to write or rephrase the right code into the OnActivation because thats how the sound was being triggered. 

what second "ex" ? there is only 1 x in that script and i imagine it means forever or something. 

Share this post


Link to post
Share on other sites
16 minutes ago, Quack Rejackt said:

putting that code in my description

 

 

class CfgSounds
{
	sounds[] = {};
		
	//adjust the volume from db0

	class Music1{name = "Music1";sound[] = {"music\ee3.ogg", db0, 1.0};titles[] = {};};

};

 

20 minutes ago, Quack Rejackt said:

second "ex"

 

https://community.bistudio.com/wiki/say3D

 

Example 2:

Workaround for dead bodies.
private _dummy = "#particlesource" createVehicleLocal ASLToAGL getPosWorld _corpse;
_dummy say3D "whatever";
_dummy spawn {
    sleep 5; //Atleast the length of your sound
    deleteVehicle _this;
};

 

Share this post


Link to post
Share on other sites

it don't really make sense to me haz j. 

playSound "Music1";   if i type this in the On Act it just plays once and its 2D.

I had it working as a 3D sound but it wouldnt loop for ever.

repleay = true; didnt work.

now iv the code you both wrote for me in the right place but why cant i hear the sound. how do i trigger it in the trigger ? like i was before with the cfg
 

Share this post


Link to post
Share on other sites

you can work with say3d or playSound3D either .

Just to understand you want this sound to play once it's triggered and then play forever , right ?

Share this post


Link to post
Share on other sites

right so this would work 
while {true} do
{
tor1 say3D ["Music1", 1000, 3];
sleep 21;
}  

the audio is 21 seconds

Share this post


Link to post
Share on other sites
2 minutes ago, Quack Rejackt said:

sleep 21;
}  

 

finishing with  };

 

it's good to add the codes in your posts with the code button <>

1 minute ago, Quack Rejackt said:

i could make a 2 hour ogg file but thats got to cost more ?

 

Do you mean about the MB ?

Share this post


Link to post
Share on other sites

yes the MB and time to render and convert it compared to just looping a small file.

yeah sorry. ill try to keep the posts cleaner.

  • Like 1

Share this post


Link to post
Share on other sites

while {true} do
{
tor1 say3D ["Music1", 1000, 3];
sleep 21;
};  

 

i just tried this and it crashed the game again.

Share this post


Link to post
Share on other sites

do you think it crashed because the doppler value is on 3 instead of 1 ? or if i changed the sleep to 7 ? anyway i dont like the way the computer performs when i run this.
while {true} do
{
tor1 say3D ["Music1", 1000, 3];
sleep -;
};  

my sound is loopable.

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

×