wagon sound activated by control value?

Discussion of rolling-stock creation & re-painting.

wagon sound activated by control value?

Unread postby Chacal » Mon Jan 14, 2013 3:08 pm

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.
Over the hill and gathering speed
Chacal
Site Admin
 
Posts: 6621
Joined: Tue Jul 05, 2011 1:11 pm
Location: Quebec, Canada

Re: wagon sound activated by control value?

Unread postby mrennie » Tue Feb 05, 2013 6:41 pm

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.
User avatar
mrennie
 
Posts: 3214
Joined: Wed May 30, 2012 12:22 pm

Re: wagon sound activated by control value?

Unread postby Chacal » Wed Feb 06, 2013 12:52 am

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!
Over the hill and gathering speed
Chacal
Site Admin
 
Posts: 6621
Joined: Tue Jul 05, 2011 1:11 pm
Location: Quebec, Canada

Re: wagon sound activated by control value?

Unread postby NDORFN » Wed Feb 06, 2013 3:00 pm

This is exciting...
NDORFN
 
Posts: 1231
Joined: Mon Nov 28, 2011 8:12 pm
Location: Matamata, New Zealand


Return to Rolling-Stock Design

Who is online

Users browsing this forum: No registered users and 1 guest