Jump to content
Sign in to follow this  
6thStorm

Make sound follow a car

Recommended Posts

Hi all. smile_o.gif

Im trying to make music follow an object like a car like he is hearing radio. So far i've added the sound into my description.ext (called radio) and in the editor i have placed a unit called Mano and an empty car.

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

{

   sounds[] =

     {

         Radio

     };

 

   class Radio

 

   {

     name = "Radio";

     sound[] = {"\Sound\Radio.ogg", 1, 1.0};

     title[] = {};

   };

};

The unit has<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Mano moveindriver Car1;Mano say "radio" in his initfield. But for some reason i keep only hearing the sound as for all.. and not just from him.

Any ideas or solution?

Share this post


Link to post
Share on other sites

You've got to find the right db value for the sound.

Don't forget to reload your mission in ArmA after every description.ext change.

e.g.

sound[] = {"\Sound\Radio.ogg", db-50, 1.0};

Try it first without moving the car, I've read about some disortion when adding say sounds to moving vehicles.

And you should name the car and then let itself emit the say sound. Won't make a difference for now but it's more logical to attach the "radio" to the car.

Share this post


Link to post
Share on other sites
You've got to find the right db value for the sound.

Don't forget to reload your mission in ArmA after every description.ext change.

e.g.

sound[] = {"\Sound\Radio.ogg", db-50, 1.0};

Try it first without moving the car, I've read about some disortion when adding say sounds to moving vehicles.

And you should name the car and then let itself emit the say sound. Won't make a difference for now but it's more logical to attach the "radio" to the car.

About adding the sound to the car.. it' cant be done as far as i know cuz the sound needs to be played by AI. I've tried adding a game logic and moved it in the car as the "sayer" but still no go. The music plays but still only as normal trigger track like.

Im gonna try to set the db lower as you say and hope it works. smile_o.gif

Share this post


Link to post
Share on other sites

Man.. i dont understand how this can be so hard. I've tried so many different options by now and i still cant make the sound simply following the object. help.gif

Share this post


Link to post
Share on other sites

Are you doing this in a cutscene watched through a camera? That can bug a say sound to play annonymous no matter what you do.

Otherwise just reduce the db value in big steps until you hear nothing and then move it up in small steps. Don't forget reloading the mission every time in ArmA for any description.ext changes to take effect.

Share this post


Link to post
Share on other sites
Are you doing this in a cutscene watched through a camera? That can bug a say sound to play annonymous no matter what you do.

Oh yea i am. Dang how could i forget to mention that? whistle.gif

Ok im just gonna stick with what i can get for now then and thx for your help mate. smile_o.gif

Share this post


Link to post
Share on other sites

About adding the sound to the car.. it' cant be done as far as i know cuz the sound needs to be played by AI.

Wrong. I did it and it certainly works.

Why don't you try attaching an event handler to the car in its init-line, e.g.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> this addEventHandler ["GetIn", {this say "yourSound"}]

I have only tested it successfully with an init-event handler and as part of an addon (within the config file). The GetIn-event, however, might not even work, but you might try and/or find a tiny workaround nevertheless (quote from biki):

Quote[/b] ] GetIn

Triggered when a unit enters the object (only useful when the event handler is assigned to a vehicle). It does not trigger upon a change of positions within the same vehicle. It also is not triggered by the moveInX commands. emphasis added by me

Share this post


Link to post
Share on other sites

I was told about this camera bug by Mandoble, but I've also seen cutscenes in which at least talking AIs seemed to play their say sounds directional.

So maybe in this case you're right when you put the car radio into the driver himself. First find out the right db value outside of this cutscene then return to it and let the driver say "radio". It's possible that it'll be played directional then.

Share this post


Link to post
Share on other sites

Try this:

Init-line of the vehicle (name is car):

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler["GetIn", {(_this select 0) say "yourSound"}];

Init-line of the unit (name is driverUnit, could as well replace with this) to get in as driver:

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

Works for me. Naturally, you don't have to use my unit namings. Let me know if that's what you wanted and if/not it worked.

Share this post


Link to post
Share on other sites
Why don't you try attaching an event handler to the car in its init-line, e.g.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> this addEventHandler ["GetIn", {this say "yourSound"}]

When i do this i get no sound at all. I tried setting the db higher and lower but no dice.

Share this post


Link to post
Share on other sites

lol yes of course. wink_o.gif

I also tried your other suggestion but it still only plays for all to hear and not from the car only.

Share this post


Link to post
Share on other sites

Edit: I should have payed more attention to the contents of this thread and not how to do what I want. Apologies, got it wrong then, my ideas won't help ... at all.  icon_rolleyes.gif

Edit 2: Mh, wait a moment. You want sound to be bound to a unit, e.g. the vehicle. The sound should be emitted from the car, bystanders would only hear it from exactly that source, directional. Is that correct? Or do you mean you want sound only to be heard by the driver in, i.e. inside, the car only? Then again, I do not know how even my code snippets will work in a cutscene environment. Good luck smile_o.gif

Share this post


Link to post
Share on other sites
Edit: I should have payed more attention to the contents of this thread and not how to do what I want. Apologies, got it wrong then, my ideas won't help ... at all.  icon_rolleyes.gif

lol well thx for trying. biggrin_o.gif

I guess there's no way to do it if you use a camera while playing the music. So im just gonna stick to what i can do. smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]I guess there's no way to do it if you use a camera while playing the music.

I also had the problem and I did a workaround by placing a game-logic as speaker at a relative position to camera and had the game-logic say the sound. It´s like you have an invisible speaker.

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  

×