Jump to content
Sign in to follow this  
thegunnysgt

Vehicles to Play Music

Recommended Posts

How can I get a vehicle to play a selection of music? I know of the 'say' command, but it is hard to hear the music over the vehicles. Is there a way to make it where you can hear them louder over the vehicles?

Thanks

Share this post


Link to post
Share on other sites

yes this one is easy. its difficult too explain because step by step is kinda hard, but all you have to do is learn mission editor, and do it with scripts. now there are many severals ways to do what you, want but its possible

Share this post


Link to post
Share on other sites

My issue is that I can get it to play from the vehicle, but there are the following problems with it:

1. The level of the music is too low so you can't hear it, even with vehicle engines off

2. Just as above states, but with the engines on

3. Can't get it to stop playing once it's started (not really high on my list at the moment, as I want to get the first two solved)

I have tried to up the db level, but all that does is overrides the 'say' command and plays the music no matter where your at.

Share this post


Link to post
Share on other sites

Heya mate, I am not sure of any other way to get the music louder but to make it stop and start as you wish use this FAQ over at OFPEC, (getin, getout EH"s) works a treat.

Odin

Share this post


Link to post
Share on other sites
Heya mate, I am not sure of any other way to get the music louder but to make it stop and start as you wish use this FAQ over at OFPEC, (getin, getout EH"s) works a treat.

Odin

I can get music to start and stop with no issue, it is when I use them as sounds that I need to get them to start and stop. So I can use the 'say' command.

Share this post


Link to post
Share on other sites

I mucked about with Getting music louder than the vehicle and found that setting the music and voice .ogg's, in an editor like Audacity to something like +12 or +15 decibles then exporting as .ogg to mission folder,drowns out the vehiclesound, with out mucking with the decible level in the description.exe

Quote[/b] ]it is when I use them as sounds that I need to get them to start and stop. So I can use the 'say' command.

Not really sure what you mean here but I will take a stab and assume that the music is invehicle as a radio background ambience type thing and you need to be able to turn it down when the units inside engage in conversation.

if it is I would use the fademusic comand in your script when then convrsation starts and ends.

eg;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> playmusic ["mymusictrack", 0]

~5

5 fadeMusic 0.01

~2

dude say "chat1"

~2

5 fadeMusic 1

~5

5 fadeMusic 0.01

~2

dude1 say "chat2"

~2

5 fadeMusic 1

~5

5 fadeMusic 0.01

~2

dude2 say "chat3"

~2

5 fadeMusic 1

Just need to muck about with the sleep times so they corrispond with with the conversation to going soft and loud again.

hope that helps ya a bit

Share this post


Link to post
Share on other sites

Wanted to do a similar thing a while back. I think I used getIn and getOut eventhandlers to try to fade music up and down in volume. I had a weird bug back then, that the track would actually restart instead of fade, but only on one of the directions (fade up OR fade down, can't remember anymore). I'm not sure if this bug is still present with the engine.

Share this post


Link to post
Share on other sites
Guest

Taken from an old thread about vehicle radios

it does allow on/off as well, and provides quality as far as not showing ugly center screen text that is residual and some other things to keep it from interfering with game play quality.

SpedsVehicleRadio v1.1

Updated:

Works on multiple vehicles

Single player mission use only

Make a name for each vehicle that u want the radio in, then put the following in each vehicles init, and be sure to put the name of the vehicle in the two areas here that say :ThisVehicleName

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

this addEventHandler ["getin",{[1,ThisVehicleName] exec "Radio.sqs"}];this addEventHandler ["getout",{[2,ThisVehicleName] exec "Radio.sqs"}]

For reference, heres a description.ext you can copy and paste, then just use your own music file name, if your using your own instead of one imbedded in Arma

Description.ext

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgMusic

{

tracks[]={};

class Spaced

{

name = "";

sound[] = {\music\Spaced.ogg, db+0,1.0};

};

};

//End of file

Heres the scripts:

Radio.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_InorOut = _this select 0

_vehicle = _this select 1

#IN

? _InorOut > 1:goto "OUT"

; if you dont want ugly action for radio on stuck on screen, this part is needed (it will force players to hit enter twice tho)

_vehicle addaction ["", "nothing.sqs"]

_vehicle addaction ["Radio on", "musicOn.sqs"]

Exit

#OUT

;Unit has gotten out of vehicle

;stop the music

playmusic ""

;set this variable to zero for use as a counter below

_NextIdNumber = 0

#RemoveActions

;added many removeactions to ensure no matter what the id are numbers are for the added actions, they will be removed

;id numbers for each addaction created do stack on a particular object, so this many is being safe

_vehicle removeaction _NextIdNumber

_NextIdNumber = (_NextIdNumber +1)

?_NextIdNumber > 1000: goto "EndScript"

goto "RemoveActions"

#EndScript

EXIT

musicOn.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;play music and add in the action 'radio off'

_vehicle = _this select 0

_id = _this select 2

playMusic "Spaced"

; remove the action once it is activated

_vehicle removeAction _id

_vehicle addaction ["Radio off", "musicOff.sqs"]

Exit

musicOff.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;turn off the music (play empty music file) and remove 'turn off' action

_vehicle = _this select 0

_OffId = _this select 2

playMusic ""

; remove the action once it is activated

_vehicle removeAction _OffId

_vehicle addaction ["Radio on", "musicOn.sqs"]

Exit

nothing.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Exit

This has been thorughoughly tested, works perfect. There is one thing tho. Due to the fact that addAction likes to keep text in center of screen for new actions, I added in the 'nothing' script, which adds an action that has no text, although this removes that issue, there is still a slightly lingering(10 secs or so) appearance of players action list (and their corresponding icons/text, depending on what player has selected) during each action selection in that vehicle, but text no longer stays 'stuck' on screen from the new added actions (which it did previously until the 'nothing' action was added). Its a small inconvenience, and I dont think theres a better way to do this. Due to the added 'nothing' action, players initially - that is only for the first time they have entered the vehicle- will have to hit enter twice for that vehicle to bring up the action menu (so what tounge2.gif).

So, anyhow, its a fully funcitonal on/off switch for a vehicle radio. I did try to find a way to 'timeout' the sound play per sound, but its not reasonably possible, so, if the song ends, one can just hit 'radio off' and then radio on and can replay it.

This will also deactivate addactions for the vehicle when player has disembarked, so you cant activate the actions from outside the vehicle, will only keep 'radio on' or 'radio off' on your action menu, depending on if your playing music or not, and will also remove chances of actions 'stacking' on a vehicle from leaving and entering multiple times (unless one does that like 200 times in a mission tounge2.gif). And of course, this will also remove ugly center screen text that initially would come up as soon as you enter the vehicle.

Share this post


Link to post
Share on other sites

Good examples for music, but how can I play them via the say command so they sound like they are coming from the vehicle itself just like any other sound coming from teh vehicle such as the engine sound.

I can get the music to play as sounds and using the say command, but the I can't them to play over the sound of the vehicle's engine.

Share this post


Link to post
Share on other sites

Update:

Well I fixed the levels of the sounds so they can be heard, but how can I stop a sound from playing.

I know when your using the playMusic command, you can use playMusic "" to stop it.

How can I stop a sound from playing when using the say command, using the playSound "" doesn't work like the music command.

Thanks.

Share this post


Link to post
Share on other sites

You could possibly constantly move an object so that it is "attached" to the vehicle. Maybe game logic will do, not sure. This object will then play the sound via the say command. If you want to stop it, you have to move it to a way off position, such as [0,0]. I don't know of any other way to "stop" a say command.

Share this post


Link to post
Share on other sites

Right now the say command is using the vehicle itself. I'll have to go into some scripting to get the object to follow the vehicle when it's in motion.

I'll see what I can do, trying to limit the amount of scripts as much as I can trying to make this as simple as possible.

Thanks.

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  

×