Page 1 of 1

wagon sound activated by control value?

Unread postPosted: Mon Jan 14, 2013 3:08 pm
by Chacal
Does anyone know if it is possible to activate a sound for a wagon based on a control value, like we routinely do with engines?

For example, when driving an engine, when you hit the space bar you change a control value like "bell" from 0 to 1. In the sound proxyxml file the bell sound is activated by this control value.

Is this reserved for engines or is this possible for wagons too?

What I'm trying to do is to change a control value using a lua script. Basically, something like "if we're traveling forwards and at speed greater than 20mph and it is between 1AM and 7AM, then turn control value "bell" from 0 to 1". Then in the proxyxml file I'd activate the sound based on this control value.

Re: wagon sound activated by control value?

Unread postPosted: Tue Feb 05, 2013 6:41 pm
by mrennie
Chacal wrote:Does anyone know if it is possible to activate a sound for a wagon based on a control value, like we routinely do with engines?

For example, when driving an engine, when you hit the space bar you change a control value like "bell" from 0 to 1. In the sound proxyxml file the bell sound is activated by this control value.

Is this reserved for engines or is this possible for wagons too?

What I'm trying to do is to change a control value using a lua script. Basically, something like "if we're traveling forwards and at speed greater than 20mph and it is between 1AM and 7AM, then turn control value "bell" from 0 to 1". Then in the proxyxml file I'd activate the sound based on this control value.


That should be perfectly possible. The wagon blueprint has a place to specify "Control values" exactly the same as you do for an engine blueprint. You can define your own custom controls, as long as they're defined also in the keyboard remapper that you reference in the wagon blueprint. It doesn't have to be mapped to a proper key (you can leave it with the default "key" which is mouse 0). It just has to be named in the remapper. Then create an element for it in the wagon's control values, where you define the range and default value. Then you can use it to control a sound via an audio control blueprint (referenced from a sound blueprint). Of course, the last step is to set the value of that control via the lua script.

Re: wagon sound activated by control value?

Unread postPosted: Wed Feb 06, 2013 12:52 am
by Chacal
mrennie wrote:as long as they're defined also in the keyboard remapper that you reference in the wagon blueprint. It doesn't have to be mapped to a proper key (you can leave it with the default "key" which is mouse 0). It just has to be named in the remapper.


*facepalm*
This is the only part that I didn't know. This must be what I've been missing all along.
All the rest you mention I have done, undone and done again.
I spent so many hours poring over those xml files without finding an error I thought I'd go crazy.
I'll test it ASAP.

Thanks!

Re: wagon sound activated by control value?

Unread postPosted: Wed Feb 06, 2013 3:00 pm
by NDORFN
This is exciting...