Jump to content
Sign in to follow this  
ayser

Music on a moving vehicle?

Recommended Posts

Is there a way to add music to a car? I've never seen it before, but i'd really love for this to happen.

Basically I want the song to play in a continuous loop (the .ogg file), and fade away while you get further away.

Is this a possible script / Action?

Share this post


Link to post
Share on other sites
say3D :)

I'm still fairly new to scripting ArmA, bare with me please :P

I went to the vehicle and on the Init I put

"this say3D "Qom_Nasheed""

I have a file in "/Music/Qom_Nasheed.ogg"

And in description I have

class CfgMusic

{

tracks[] = {Qom_Nasheed};

class Qom_Nasheed

{

name = "Qom_Nasheed";

sound[] = {\Music\Qom_Nasheed.ogg, db + 0, 1.0};

};

};

And everytime I go into briefing / ingame I see "Qom_Nasheed" not found. I know i'm doing something wrong, but I can't tell what, any clue?

---------- Post added at 08:01 AM ---------- Previous post was at 07:45 AM ----------

I changed some of the code and managed to not get any errors while loading up briefing/ingame, but I hear no music, pretty much the code doesnt kick in I guess?

class CfgSounds

{

sounds[] = {Qom};

class Qom

{

name = "Qom"; // how the sound is referred to in the editor (e.g. trigger effects)

sound[] = {"Scripts\Qom_Nasheed.ogg", 10, 1}; // filename, volume, pitch

titles[] = {};

};

};

With " this say3D "Qom" " as the Init on the vehicle

Share this post


Link to post
Share on other sites

Hi...try it this way...

description.ext

class CfgSounds
{
sounds[]= {music1};

class music1
{
	name = "music1";
	sound[] = {\music\Qom_Nasheed.ogg, 1, 1.0};
	titles[] = {};
};
};

Then do...

playsound "music1";   //is non 3D sound

or...

_obj say3D "music1";   //is 3D sound

EDIT: I'm not sure about the looping part... I think you're going to have to time it and then play the sound again to get the loops.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

Hi,

Put this code on the init line of any vehicle

nul = [this] execVM "music.sqf";

Now create music.sqf and put this code in it.

_object = _this select 0;

while {alive _object} do { _object say3D "Qom_Nasheed"; sleep 15;};

For a 35 seconds sound write

sleep 35

With this code the sound will be played in a continuous loop until the vehicle destruction

Edited by Hardballer

Share this post


Link to post
Share on other sites

I've tried both of your solutions, and I finally got the song to play, but i'm having problems, it doesnt fade away on how far you are from it. I run close, its the same volume, I run 100m away, it's still the same. Any clue for this?

Description.ext

class CfgSounds

{

sounds[] = {Qom_Nasheed};

class Qom_Nasheed

{

name = "Qom_Nasheed";

sound[] = {"Music\Qom_Nasheed.ogg", -100, 0.0};

titles[] = {};

};

};

Qom_Nasheed.sqf

_object = _this select 0;

while {alive _object} do { _object say3D "Qom_Nasheed"; sleep 194;};

Song is in /Music/Qom_Nasheed.ogg.

The command I put in the init is nul = [this] execVM "Qom_Nasheed.sqf";

Any clue? Really need this fade to work :(

---------- Post added at 04:30 PM ---------- Previous post was at 04:24 PM ----------

Correction: I just did a test again, and it does fade, but only when your very far away, I don't want this guys song to be blasting from his car, is there any way to change the distance the fade starts?

Share this post


Link to post
Share on other sites

Try with

{"Music\Qom_Nasheed.ogg", 0.05, 1};

If you want your volume to be lower you can change 0.05 to 0.005 etc

Share this post


Link to post
Share on other sites

Your soundfile needs to be mono, not stereo.

Also,

sound[] = {"Scripts\Qom_Nasheed.ogg", [b]1.0[/b], 1.0}; // filename, volume, pitch

Change your "volume" value to 1 rather than 10.

This value directly influences the distance the sound can be heard at, though it is not a range in meters but rather a general factor for increasing/decreasing the audible distance.

A value from 0.10 to 0.15 will give your sound a range roughly equivalent to what PC loudspeakers would achieve in a park on a normal day.

Share this post


Link to post
Share on other sites

Sorry to not contribute but I can't help but notice Qom is the same music as the Project Reality BF2 bombcar music :D.

Suicide bombing mission, I presume?

Share this post


Link to post
Share on other sites
Your soundfile needs to be mono, not stereo.

Good tip. Thanks for mentioning it... I forgot about this.

Share this post


Link to post
Share on other sites

I had it working PERFECTLY, But it just randomly stopped working out of the blue! I have no clue what I did, and I'm looking at the code, everything is fine. What could be wrong?

CfgSounds

class CfgSounds

{

sounds[] = {Qom_Nasheed};

class Qom_Nasheed

{

name = "Qom_Nasheed";

sound[] = {"Music\Qom_Nasheed.ogg", 1.0, 1.0};

titles[] = {};

};

};

Whole Descriptions.ext file

// Online manual (http://www.ferstaberinde.com/f2/en/)

class Header

{

gameType = Coop;

minPlayers = 1;

maxPlayers = 20;

};

// Respawn / JIP / Other Settings

respawn = 1;

respawndelay = 3;

#include "f\common\f_JIP_kitpicker.h"

#include "f\common\f_JIP_grppicker.h"

// #include "f\common\f_spect\spectating.hpp"

// #include "f\revive\dialogs\revive.cpp"

// #include "f\common\f_gearSnippets.hpp"

class Params

{

class DayTime

{

title = "Time Of Day";

values[] = {2, 13, 8, 16};

texts[] = {"Dark Night", "Night with Full Moon", "Sundown", "Evening"};

default = 16;

};

class Weather

{

title = "Weather:";

values[] = {2, 0.5, 0.75, 1};

texts[] = {"Random", "Cloudy", "Overcast", "Storm"};

default = 2;

};

class f_param_debugMode

{

title = "$STR_f_param_debugMode";

values[] = {0,1};

texts[] = {"Off","On"};

default = 0;

code = "f_var_debugMode = %1";

};

class Grass

{

title = "Grass Options";

values[] = {1, 2};

texts[] = {"Low", "Normal"};

default = 2;

};

};

class CfgSounds

{

sounds[] = {Qom_Nasheed};

class Qom_Nasheed

{

name = "Qom_Nasheed";

sound[] = {"Music\Qom_Nasheed.ogg", 1.0, 1.0};

titles[] = {};

};

};

class f_param_lives

{

title = "Number of Lives:";

values[] = {2000,1000,20,10,7,5};

texts[] = {"No Revive","Infinite - Cadet","20 - Easy ","10 - Normal","7 - Hard","5 - Extreme"};

default = 10;

code = "f_param_lives = %1";

};

class RscTitles

{

#include "f\common\f_recog\recogOverlay.hpp"

};

};

Qom_Nasheed.sqf

_object = _this select 0;

while {alive _object} do { _object say3D "Qom_Nasheed"; sleep 90;};

I go ingame with no errors, but I hear no music, once again. Any clue what I did wrong?

Sorry to not contribute but I can't help but notice Qom is the same music as the Project Reality BF2 bombcar music :D.

Suicide bombing mission, I presume?

And yes :)

---------- Post added at 09:56 PM ---------- Previous post was at 09:43 PM ----------

I'm also now getting "No entry CfgSounds/Qom_Nasheed.titles" Whats up? Did it break itself?

Share this post


Link to post
Share on other sites

I copied the description.ext into a new ext and formatted it properly and I think you should try removing that last }; at the bottom of the file. This may or not be your problem.... but try it anyway. Something looks fishy.

Here's a tip... When you are posting code use the "Code" or "PHP" tags.... not the "Quote" tags. The code will be a lot easier for everyone to read.

Share this post


Link to post
Share on other sites

I moved the Qom_Nasheed.sqf to my main mission folder, and now I hear the music, odd, it was working in the "Scripts" folder before... Oh well, not a big deal. But everytime I get into briefing/ingame I see the "No entry CfgSounds/Qom_Nasheed.titles". Whats wrong with it? I have

class Qom_Nasheed
{
		name = "Qom_Nasheed";
		sound[] = {"Music\Qom_Nasheed.ogg", 1.0, 1.0};
		titles[] = {Qom_Nasheed};
};

---------- Post added at 10:00 PM ---------- Previous post was at 09:58 PM ----------

I copied the description.ext into a new ext and formatted it properly and I think you should try removing that last }; at the bottom of the file. This may or not be your problem.... but try it anyway. Something looks fishy.

Here's a tip... When you are posting code use the "Code" or "PHP" tags.... not the "Quote" tags. The code will be a lot easier for everyone to read.

You posted once I posted, Seconds of a difference :P

Got rid of the last " }; " And that seemed to be the problem, Many thanks! Time to create this jihad mission :bounce3:

Share this post


Link to post
Share on other sites
Correction: I just did a test again, and it does fade, but only when your very far away, I don't want this guys song to be blasting from his car, is there any way to change the distance the fade starts?

This may prove useful:

http://forums.bistudio.com/showpost.php?p=1400306&postcount=65

from:

http://forums.bistudio.com/showthread.php?p=1400306#post1400306

In one of my missions, I needed a playing radio with looped few tracks, a jingle and with static noise in the background, but with distance sound disappearing too slowly, so I tried this third parameter. Effect was good.

My Description.ext was looking like that:

class CfgSounds
{
sounds[] = {};
 class Bushes
 {
  name = "Bushes";   
  sound[] = {"sound\Bushes3.ogg", 20, 1, 150};   
  titles[] = {};
 };
 class Inter
 {
  name = "Inter";   
  sound[] = {"sound\InterC.ogg", 20, 1, 150};   
  titles[] = {};
 };
 class Vintner
 {
  name = "Vintner";   
  sound[] = {"sound\Vintner2.ogg", 20, 1, 150};   
  titles[] = {};
 };
 class autumn
 {
  name = "autumn";   
  sound[] = {"sound\autumn1.ogg", 20, 1, 150};   
  titles[] = {};
 }
};

Don't know, if it is optimal, but, again, effect was realistic and good. Fading occurs earlier.

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  

×