BOB PEARSON - Sound Clarification Needed

manjoe

Still Learning
Hello Bob, if you are out there. I understand you have knowledge of the PLAY A SOUND RULE. I have opened a thread "Sound Clarification Wanted", and understand you may possibly have some input to how I might be able to TRIGGER a sound only when it is wanted with this particular rule. My idea is to have the sound only play when the locomotive is at the bottom of the screen in DCC mode, and not to play when that locomotive is not at the bottom of the screen.

As I stated in the mentioned post, I dont want to hear "Fire In The Hole" when I am in front of a hospital!:hehe: Thanks, and hoping you are still around.
 
Yes, I'm out here someplace though most of the time I seem to be lost in a fog.

I'm sorry to say that I don't have any particular knowledge of the play a sound rule and don't work with rules in general. I do some scripting though. The API provides 2 methods to play wav files - World.Play2DSound() and World.PlaySound(). To play a sound that behaves as a local sound with limited audio distance you have to use World.PlaySound() and in addition to the sound file and distance limits you have to pass into it a target asset and an attachment point id on that asset. Without the latter 2 it will behave as a 2D sound and be heard everywhere. I suspect the problem with the rule is that the trigger that sends the message probably doesn't have an attachment point you can specify so it can only be heard as a 2D sound.

There may be ways to use other tracksides that do have attachent points as triggers or possible create custom triggers to use but I leave that for others to work out.

Bob Pearson

Edit: I just checked the built-in Play Sound rule and it uses World.Play2DSound(). It isn't associated with any mapobject nor does it recieve any messages that it can determine the source asset from so it's not possibe for it to play a local sound. The intent was I guess to be a child rule that's triggered by actions of it's parent.
 
Last edited:
Thank you, thank you, thank you. Fabulous explanation. I have been forever baffled by this rule. I kept thinking I was incorrectly trying to make it work. As you have so clearly stated, it was designed to work this way. I guess I will remain limited to the excellant group of sounds that we have that are localized. I truly appreciate your fast and informative answer. Take care. :wave:
 
Back
Top