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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


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 03:40 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.