SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 09-03-10, 07:37 PM   #1
Vorkapitan
Samurai Navy
 
Join Date: May 2006
Posts: 594
Downloads: 1367
Uploads: 0
How do I trigger sounds etc.?

Ok Mates,

I searched everything on "sound" but am at a loss as to what/how to do sound triggers...

ist. What triggers a sound?...I see text like "tube 1 flooding" but there is no sound triggered for it (there is a sound wav for it.)

2nd. Is there a way to trigger this sound based on a menu switch?

3rd. if there is no sound for this, is there a way to "add" a sound?

4th. Can this be done via a script?

I need all the help I can get.

Thank you.
__________________
__________________________________________________ ________
__________________________________________________ ________



Joe
Vorkapitan is offline   Reply With Quote
Old 09-03-10, 07:47 PM   #2
Venatore
Admiral
 
Join Date: Apr 2005
Location: Australia:- Sydney
Posts: 2,049
Downloads: 68
Uploads: 0
Default

I'll will be watching this Thread closely as I too am curious about this.....example; you hear the periscope going up down mechanically whilst inside, however; standing out in the conning tower if the scopes go up/down you hear nothing

Bump:-
Venatore is offline   Reply With Quote
Old 09-03-10, 08:09 PM   #3
Vorkapitan
Samurai Navy
 
Join Date: May 2006
Posts: 594
Downloads: 1367
Uploads: 0
Default

Venatore,

When I did a search on all of Subsim radio room forums, I thought I saw an explanation of the problem you are describing.

I'm not sure that it will help.
__________________
__________________________________________________ ________
__________________________________________________ ________



Joe
Vorkapitan is offline   Reply With Quote
Old 09-03-10, 08:37 PM   #4
Venatore
Admiral
 
Join Date: Apr 2005
Location: Australia:- Sydney
Posts: 2,049
Downloads: 68
Uploads: 0
Default

Vorkapitan,

Hey matey, it was in discussions within my mod thread. I'm as keen as you are to find out the mystery of the triggers for sound

Bump
Venatore is offline   Reply With Quote
Old 09-03-10, 08:44 PM   #5
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,549
Downloads: 26
Uploads: 3
Default

Quote:
Originally Posted by Vorkapitan View Post
Ok Mates,

I searched everything on "sound" but am at a loss as to what/how to do sound triggers...

ist. What triggers a sound?...I see text like "tube 1 flooding" but there is no sound triggered for it (there is a sound wav for it.)

2nd. Is there a way to trigger this sound based on a menu switch?

3rd. if there is no sound for this, is there a way to "add" a sound?

4th. Can this be done via a script?

I need all the help I can get.

Thank you.
1) Crew speech can be added in .aix files (SH5 only, quite possible the preferred method since you can add variation and choose sounds depending on scenario) and/or via StateMachineClass (SH3/SH4, not sure about SH5), and I'm guessing some of it still is hardcoded too.
2/3) Yes, of course: <Button>.OnClickSoundName = "<SDL-identifier>" (to override default button sound) or Menu.PlaySound("<SDL-identifier>")
4) Yes, (see 2/3) but when called from script it is not 3D aware, meaning if you order it from the bridge, it will be as loud as if you were in the torpedo room. This is fine for crew speech (check SubmarineCommandsWrapper.CommandWasGiven-event for the handler to use in such scenario's), but not for location specific sounds.

I have not looked into SH5 to closely, but in SH4, the technique for events like this (since it lacks a script engine), is to trigger them from StateMachineClass controller. You will first need to put an aud node where you want the sound to be heared in the DAT-file, and add the associated SoundInfo controller for it (DSD). And of course add an SDL-sound entry (toggling 3D to make it location aware, 2D for a global sound). Then, in the StateMachineClass controller (can build it from scratch for this purpose alone, but can also reuse the generic sub StateMachineClass DAT-file) you add a handler for the Open/Close tube SH-command, and trigger the sound from there (by calling the node label using PlayAnim or PlaySound, i don't remember).

Last edited by skwasjer; 09-03-10 at 09:07 PM.
skwasjer is offline   Reply With Quote
Old 09-03-10, 09:21 PM   #6
Vorkapitan
Samurai Navy
 
Join Date: May 2006
Posts: 594
Downloads: 1367
Uploads: 0
Default

SKWASJER,

Thank you very much for the detailed info, now if someone could explain what you said.... I'm not sure where to begin...maybe I can get some help from DW or Reaper or anyone else who cares to get involved.

Thanks again for the quick response.
__________________
__________________________________________________ ________
__________________________________________________ ________



Joe
Vorkapitan is offline   Reply With Quote
Old 09-03-10, 09:57 PM   #7
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,549
Downloads: 26
Uploads: 3
Default

Ok, heh...

Well, in the question you only asked for how to add a sound to a command. This in particular could be implemented via different ways, so I just threw in the approaches I could think of.

Using script is probably the easiest, but it may not cover all the situations you want to implement, and as said is not 3D-aware.

Code:
from game import Game
from menu import Menu
 
def sc_CommandWasGiven( e ):
 if e.CommandText == "Open_torpedo_tube":
  Menu.PlaySound( "<sdl-identifier>" )        # Needs an SDL-identifier f.ex.: torpedo.openTube. This is a generic message.
 elif e.CommandText == "Open_sel_torpedo_tube":
  Menu.PlaySound( "<sdl-identifier>" + ( e.Param1 + 1 ).ToString() ) # Needs an SDL-identifier f.ex.: torpedo.openTube1, torpedo.openTube2, etc. This is a message per tube index (Param1 is 0-based tube index).
 
def InitializeScript():
 Game.SubmarineCommands.CommandWasGiven += sc_CommandWasGiven
  
def UnloadScript():
 Game.SubmarineCommands.CommandWasGiven -= sc_CommandWasGiven
I have not tested this script, as this was written outside of the game, but this is roughly what you need...

Last edited by skwasjer; 09-03-10 at 10:12 PM.
skwasjer is offline   Reply With Quote
Old 09-03-10, 10:03 PM   #8
Vorkapitan
Samurai Navy
 
Join Date: May 2006
Posts: 594
Downloads: 1367
Uploads: 0
Default

SKWASJER,

As you will see in the PM I sent, I was more definitive in what I was trying to accomplish.

Your script will give me a base to start with...so thank you very much.

__________________
__________________________________________________ ________
__________________________________________________ ________



Joe
Vorkapitan is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.