View Single Post
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