Jump to content
Sign in to follow this  
Winters

Making a car radio. how to?

Recommended Posts

Hello all i know all about converting files to the correct format and have used custom sounds and music often. What i need to do is add an action that will only appear in the menu when i am in my car and that starts a music file playing (a car radio).

Share this post


Link to post
Share on other sites

I did this for one of my massive MP missions.

Well, what you can do is create a script that is always running, inside do:

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

@(vehicle Player != Player)

#repeat

playMusic "boomboom";

~3

?(vehicle Player == Player):goto "stopMusic";

~3

?(vehicle Player == Player):goto "stopMusic";

~3

?(vehicle Player == Player):goto "stopMusic";

~3

?(vehicle Player == Player):goto "stopMusic";

~2.9

?(vehicle Player == Player):goto "stopMusic";

goto "repeat";

#stopMusic

_musicLevel = musicVolume;

0 fadeMusic 0;

~12

0 fadeMusic _musicLevel;

goto "top";<span id='postcolor'>

This was for a small short loop, you can change the @condition to </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">@Player in theVehicle<span id='postcolor'> where theVehicle is your target vehicle with radio.

Also, if you don't want to loop a small sample you can simply do </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">@vehicle Player == Player

0 fadeMusic 0;<span id='postcolor'> later on (you can play silence instead of 0 fadeMusic 0wink.gif.

Share this post


Link to post
Share on other sites

Hello,

Thanks for the help, i found a solution in a map i had depbo'ed as well. I set the repeating trigger and in it i had it activate once i got in the car and i added the action to the car and not the person (thats what i was doing wrong).

Thanks Again. smile.gif

Share this post


Link to post
Share on other sites

you can download a template of a car radio mission at our homepage in the cookbook/scripts section. It even fades the sound the further you go away from the car. No script , only 3 triggers.

Share this post


Link to post
Share on other sites

Damn, i am still having trouble.

here is what i have done

i make a trigger that is set to repeatedly.

in the condition field i put:

player in car1

in the on activation field i put:

car1 addAction ["CD Player Track 1", "carradio1.sqs"]; car1 addAction ["CD Player Track 2", "carradio2.sqs"]; car1 addAction ["CD Player Off", "carradio3.sqs"]

Now what happens is everytime i get in the car all 3 actions will appear in the car. Thats fine if i was only getting in once but 3 more will appear EVERYTIME i get in the car confused.gif . How do i make it so they appear one time and not add 3 actions everytime i enter the car.

Thanks for the help smile.gif

Share this post


Link to post
Share on other sites

You need to remove all the actions in the on-deactivation field of the trigger.

activation:

carAct1 = car1 addAction ["CD Player Track 1", "carradio1.sqs"];

deactivation:

car1 removeAction carAct1;

but actually, that is a strange way of doing it. Is it insufficient to just add the action to the car? If not then how about adding the action to the Player himself?

Share this post


Link to post
Share on other sites

only adding it to player would make him a wandering jukebox biggrin.gif

you have to read out if player is in car and then add actions to player.if player leaves car remove actions.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Balschoiw @ Oct. 08 2002,11:38)</td></tr><tr><td id="QUOTE">only adding it to player would make him a wandering jukebox biggrin.gif<span id='postcolor'>

Not when he is in the car... umm, if he only has the actions when he is in the car then logic dictates.....

The rest I explained already. wink.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bn880 @ Oct. 08 2002,17:32)</td></tr><tr><td id="QUOTE">deactivation:

car1 removeAction carAct1;<span id='postcolor'>

This does not work, whenever i return to the car all the actions are once again added to the list on top of the original ones mad.gif

But, thanks for trying to help smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Winters @ Oct. 08 2002,16:44)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bn880 @ Oct. 08 2002,17:32)</td></tr><tr><td id="QUOTE">deactivation:

car1 removeAction carAct1;<span id='postcolor'>

This does not work, whenever i return to the car all the actions are once again added to the list on top of the original ones mad.gif

But, thanks for trying to help smile.gif<span id='postcolor'>

I just tried it, it works.

Are you sure you read the previous message carefully? I added something else... wink.gif

Share this post


Link to post
Share on other sites

i added everything just as you said and it does not work, do i have to use your script in order for it to work?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bn880 @ Oct. 08 2002,17:32)</td></tr><tr><td id="QUOTE">activation:

carAct1 = car1 addAction ["CD Player Track 1", "carradio1.sqs"];

deactivation:

car1 removeAction carAct1;<span id='postcolor'>

Thats everything that i did. and it didnt work.

Share this post


Link to post
Share on other sites

Hmmmm,

It seems to be working now. smile.gif

go figure confused.gif

Oh well, Thanks for the help biggrin.gif

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  

×