Bridge Commander Central

BC Forums => BC Scripting => Topic started by: baz1701 on June 01, 2009, 06:26:48 AM

Title: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 06:26:48 AM
Hi,
   AS much a I love my new TMP connie the TNG warp sounds are bugging me.

I have seen TMP warp sounds on BC files but these will over write the default warp sfx's

So can I give a ship its own sound files like you can for phasers and torps?

I created a sound plugin with BCUT but have no idea of to associate it with the ship?

Sorry if this is a newbie question.
Title: Re: Changing a ships warps sounds
Post by: teleguy on June 01, 2009, 07:51:51 AM
MLeo explained it in this thread.
http://bc-central.net/forums/index.php/topic,3216.0.html
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 08:55:02 AM
OK, I must be dumb. I've read it through several times looked at example files and can not find any ref to sounddef "warp enter" Etc..

Here is the sound pak I created.


#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


Foundation.SoundDef("sfx/TMPenter warp.wav", "TMPwarpenter", 1)
Foundation.SoundDef("sfx/TMPwarp flash.wav", "TMPwarpflash", 1)
Foundation.SoundDef("sfx/TMPexit warp.wav", "TMPwarpexit", 1)

It is proberley obvious but how to I first off call this up in my ship plugin and how do I assign the right sound to the right action?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 09:12:41 AM
NanoFX looks, per race, for two sounds, based on a naming scheme, both sounds start with the race name and end with either "EnterWarp" and "ExitWarp".

It's in the last section of my post.

Also, use code tags for posting code.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 09:59:55 AM
I see how the game looks for example the fed warp enter sfx when the ship is fedshipdef.

I see the extra lines of code for "overriding" the fed warp flash etc.

Is there an override for the warp enter / exit sounds of do I have to create a "new race" to define the TMP warp sounds.

The last set of code in the example calls up a my breen race define, where the warp sounds are set. I can't see where this code came from.

Sorry to be a pain but I really do want to understand this.
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 10:19:08 AM
Like I said, NanoFX uses a naming convention, meaning there is no code to specify the specific sounds.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 11:04:39 AM
Ok I get most of this. Is there a ship I can look at as an example?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 11:19:41 AM
Every ship uses this.

Here are the steps (consider each block to be it's own file):
Code: [Select]
import Foundation
oBazTMPRace = Foundation.RaceDef("BazTMP", "BTMP")

Code: [Select]
import Foundation
import BazTMPRace

class BazTMPShipDef(Foundation.ShipDef):
    def __init__(self, abbrev, species, dict):
        dict['race'] = BazTMPRace.oBazTMPRace
        Foundation.ShipDef.__init__(self, abbrev, species, dict)

Then, in your ship plugin, you import the new shipdef file (say BazTMPShipDef) and then create your ship plugin using that (so instead of the Foundation.<Something>ShipDef(....) you use BazTMPShipDef.BazTMPShipDef(....)).

NanoFX will now look for BazTMPEnterWarp and BazTMPExitWarp.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 11:34:16 AM
Ok one very stupid question before I try this.

The 2 files I need to create to define "My TMP" race. what file names do I use and do I put them is Scripts/custom/ships?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 11:49:53 AM
Any name you like, anywhere under scripts and in a directory with an __init__.pyc, you can put the two definitions even together in a single file.

It's the first parameter of Foundation.RaceDef that NanoFX looks at.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 11:53:06 AM
Ok will give it a try when I get home.

Thank you for your patience cookie incoming.

Hopefully this will work for me now.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 02:27:48 PM
ok I'm doing something wrong now I have the BSOD and the CD cursor.

I have attached the files I have created
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 02:35:16 PM
While you can name it anything you like, you have to name it consistently.

Meaning, you can't call it "BazTMPRace" at one place, and mean "TMPbcDef" in another.
Title: Re: Changing a ships warps sounds
Post by: USS Frontier on June 01, 2009, 06:12:49 PM
MLeo, while that method will work, it will create "inconsistencies" with the Races for mods that use the Races system...
Since that is a Fed ship, but with this modification will be from a completely different race.

And the shameless advertising:
With Galaxy Charts v2 you'll be able to do this for all your TMP ships in a relatively easy way and still maintain them in the Fed race :P
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 06:35:46 PM
Perhaps the "code" can be used to denote the general race? Or maybe we should introduce a "parent" race.

TBH, I'm not too thrilled with this system, but it's how NanoFX works.


I suppose that's why I had this idea of a FoundationFX in my head... But then again, I've had that since my time on FTB/FoundationTech.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 01, 2009, 06:40:37 PM
Either way it is still not working for me.

I renamed the race files BazTMPRace & BazTMPRace1

They sit happly in the custom/ships folder and the game works.

When I change the connie from foundation.fedshipdef to foundation.baztmpshipdef the game still BSOD on me.
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 01, 2009, 06:52:50 PM
The names should be BazTMPRace.py and BazTMPShipDef.py

And in your ship plugin you should import BazTMPShipDef and then use BazTMPShipDef.BazTMPShipDef(....) instead of the Foundation.FedShipDef(....)
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 02, 2009, 06:10:39 AM
Ok this is where I am at the moment. I'm still getting the BSOD with this files in customer/ships.

File 1 BazTMPRace.py

Code: [Select]
import Foundation
oBazTMPRace = Foundation.RaceDef("BazTMP", "BTMP")

File 2 BazTMPShipDef.py

Code: [Select]
import Foundation


class BazTMPShipDef(Foundation.ShipDef):
    def __init__(self, abbrev, species, dict):
        dict['race'] = Foundation.BazTMPRace
        Foundation.ShipDef.__init__(self, abbrev, species, dict)

File 3 BCrefit.py

Code: [Select]
##### Created by:
##### Bridge Commander Ship Menu Creator v5.6



import App
import Foundation
import BazTMPShipDef


abbrev = 'bcrfit'
iconName = 'bcrefit'
longName = 'Baz1701 Refit Enterprise'
shipFile = 'bcrfit'
species = App.SPECIES_GALAXY
# SubMenu
menuGroup = 'Fed Ships'
playerMenuGroup = 'Fed Ships'


Foundation.ShipDef.bcrfit = BazTMPShipDef.BazTMPShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


# Foundation.ShipDef.bcrfit.fMaxWarp
# Foundation.ShipDef.bcrfit.fCruiseWarp
Foundation.ShipDef.bcrfit.desc = 'After complete its historic 5 year mission the Enterprise under went an 18 month refit. As described by Captain Willard Decker she was almost an totally new ship.'


if menuGroup:           Foundation.ShipDef.bcrfit.RegisterQBShipMenu(menuGroup)
if playerMenuGroup:     Foundation.ShipDef.bcrfit.RegisterQBPlayerShipMenu(playerMenuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]

Is there something else I'm missing?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 02, 2009, 12:52:40 PM
Here are the fixed snippits.
Remember, this tend not to propagate outside of their files, unless requested.


File 1 BazTMPRace.py

Code: [Select]
import Foundation
oBazTMPRace = Foundation.RaceDef("BazTMP", "BTMP")

File 2 BazTMPShipDef.py

Code: [Select]
import Foundation
import BazTMPRace

class BazTMPShipDef(Foundation.ShipDef):
    def __init__(self, abbrev, species, dict):
        dict['race'] = BazTMPRace.BazTMPRace
        Foundation.ShipDef.__init__(self, abbrev, species, dict)

File 3 BCrefit.py

Code: [Select]
##### Created by:
##### Bridge Commander Ship Menu Creator v5.6



import App
import Foundation
import BazTMPShipDef


abbrev = 'bcrfit'
iconName = 'bcrefit'
longName = 'Baz1701 Refit Enterprise'
shipFile = 'bcrfit'
species = App.SPECIES_GALAXY
# SubMenu
menuGroup = 'Fed Ships'
playerMenuGroup = 'Fed Ships'


Foundation.ShipDef.bcrfit = BazTMPShipDef.BazTMPShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


# Foundation.ShipDef.bcrfit.fMaxWarp
# Foundation.ShipDef.bcrfit.fCruiseWarp
Foundation.ShipDef.bcrfit.desc = 'After complete its historic 5 year mission the Enterprise under went an 18 month refit. As described by Captain Willard Decker she was almost an totally new ship.'


if menuGroup:           Foundation.ShipDef.bcrfit.RegisterQBShipMenu(menuGroup)
if playerMenuGroup:     Foundation.ShipDef.bcrfit.RegisterQBPlayerShipMenu(playerMenuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 02, 2009, 03:18:43 PM
right I've posted the new script into the files using notepad++

So thing again bsod death. remove the ship py leave the race files there and it loads.

I have created a new plugin for both feddefship and shipdef and edited them in notepad++ again they game bsod?
Title: Re: Changing a ships warps sounds
Post by: JimmyB76 on June 02, 2009, 03:41:43 PM
what is the console report saying?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 02, 2009, 03:48:09 PM
You will have to post the console report.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 02, 2009, 03:52:56 PM
Code: [Select]
Outdated Foundation, updating functions
Outdated Foundation, installing FolderManager
Foundation Tech loaded
Gravity FX has been loaded.
BridgeFX Enabled...
CameraFX Enabled...
ExplosionFX Enabled...
SpecialFX Enabled...
WarpFX Enabled...
DS9FX Initializing...
AttributeError: PreLoadAssets
Setting Stock System Planets Random Density.
Traceback (innermost last):
  File ".\Scripts\Custom\Autoload\000-Fixes20030305-FoundationTriggers.py", line 25, in __call__
    i(pObject, pEvent)
  File ".\Scripts\Custom\Autoload\LoadEngineeringExtension.py", line 240, in __call__
    LoadQBautostart.ImportQBautostart()
  File ".\Scripts\Custom\Autoload\LoadEngineeringExtension.py", line 163, in ImportQBautostart
    pModule = __import__(dotPrefix + fileName)
  File ".\Scripts\Custom\QBautostart\AIShuttleLaunching.py", line 3, in ?
    import ftb.ShipManager
  File ".\Scripts\ftb\ShipManager.py", line 96, in ?
    LoadExtraPlugins()
  File ".\Scripts\ftb\ShipManager.py", line 92, in LoadExtraPlugins
    pModule = __import__(dotPrefix + pluginFile)
  File ".\Scripts\Custom\Carriers\EnterpriseNCC1701.py", line 34, in ?
    ShipManager.RegisterShipClass( "jjenterprise", jjenterprise)
NameError: jjenterprise
Traceback (innermost last):
  File ".\Scripts\Custom\Autoload\LoadTech.py", line 20, in __call__
    techfunc.ImportTechs()
  File ".\Scripts\techfunc.py", line 26, in ImportTechs
    pModule.Setup()
  File ".\Scripts\Custom\Tech\ShipLaunch.py", line 13, in Setup
    ftb.LaunchShipHandlers.MissionStart()
  File ".\Scripts\ftb\LaunchShipHandlers.py", line 198, in MissionStart
    AddLaunchButtons(ftb.GUIUtils.GetScienceMenu())
  File ".\Scripts\ftb\LaunchShipHandlers.py", line 229, in AddLaunchButtons
    pCarrier = ftb.ShipManager.GetShip(pLaunchShip)
AttributeError: ShipManager
DS9FX: Kobayashi Maru is Installed. Deleting DS9FX Docking Function!
DS9FX: You're not currently running a QB Mission. DS9 Set cannot be reached by Warp!
GravityFX has been deactivated.
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 02, 2009, 04:00:42 PM
Assuming this is a fresh console report, I'll have to quote myself from your other thread:

http://bc-central.net/forums/index.php/topic,4984.0.html
http://bc-central.net/forums/index.php/topic,5340.0.html
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 02, 2009, 04:27:55 PM
I've check all in the first thread and cannot open the second and still not working.

I've just deleted all the old reports and restarted, I'm not even getting a report now?

Can someone try to create the baztmprace on their install so it works and post them here so I can edit them to work with my bcrfit?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 02, 2009, 06:28:25 PM
Please remove scripts/Custom/Carriers/EnterpriseNCC1701.py and it's pyc counterpart (and upload the py here), afterwards, you should be able to continue past this error.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 03, 2009, 04:32:15 AM
Removed buy carrier files and reloaded my BCrefit files and still BSOD.

It is not getting far enough to generate a console report.

Again I remove BCrefit.py from custom/ships and the game works again
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 03, 2009, 04:16:14 PM
ok I've had the file tested by someone else and it BSOD on him too?

Any ideas?
Title: Re: Changing a ships warps sounds
Post by: Kirk on June 03, 2009, 04:30:33 PM
Without a console report (even a "clean" one) it will difficult, or even impossible, to tell.
Quote from: MLeo
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 03, 2009, 04:32:22 PM
Move the ConsoleLogger.py(c) files from scripts/Custom/Autoload to scripts/Custom/Ships, and add ___ infront of both.

Or delete the pyc from Autoload.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 03, 2009, 04:38:59 PM
ok did that and still no report. The cursor flashes up after about 2 seconds after excuting the game.
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 03, 2009, 04:51:24 PM
The 2 seconds are the intro movies.


Problem found, in BazTMPShipDef, there is a line that ends with BazTMPRace.BazTMPRace, which should be BazTMPRace.oBazTMPRace
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 03, 2009, 04:59:26 PM
The 2 seconds are the intro movies.

I don't even get the intro movie!

Problem found, in BazTMPShipDef, there is a line that ends with BazTMPRace.BazTMPRace, which should be BazTMPRace.oBazTMPRace

Still doing it and no report. Here is the last report I got 5 minutes before I retired with "o" added.

Code: [Select]
Outdated Foundation, updating functions
Outdated Foundation, installing FolderManager
Foundation Tech loaded
Gravity FX has been loaded.
BridgeFX Enabled...
CameraFX Enabled...
ExplosionFX Enabled...
SpecialFX Enabled...
WarpFX Enabled...
DS9FX Initializing...
AttributeError: PreLoadAssets
Trying to clean memory
Traceback (innermost last):
  File ".\Scripts\QuickBattle\QuickBattle.py", line 4922, in StartSimulationAction
    pModule = Foundation.FolderManager('ship', sShipType)
  File ".\Scripts\Custom\Autoload\000-Fixes20030402-FoundationRedirect.py", line 315, in __call__
    mod = __import__(i + key)
EOFError: EOF read where object expected

Just confirm that the files are all in the right place the ship plugin BCrefit is in custom/ships

BazTMPRace.py and BazTMPShipDef.py are also in custom/ships
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 03, 2009, 05:04:17 PM
should there be oBazTMP in this script somewhere to in BazTMPShipDef.py?

Code: [Select]
class BazTMPShipDef(Foundation.ShipDef):
    def __init__(self, abbrev, species, dict):
        dict['race'] = BazTMPRace.BazTMPRace
        Foundation.ShipDef.__init__(self, abbrev, species, dict)
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 03, 2009, 06:33:57 PM
Code: [Select]
import Foundation
import BazTMPRace

class BazTMPShipDef(Foundation.ShipDef):
    def __init__(self, abbrev, species, dict):
        dict['race'] = BazTMPRace.oBazTMPRace
        Foundation.ShipDef.__init__(self, abbrev, species, dict)
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 10, 2009, 05:40:59 PM
Ok with a lot of help from Mleo I have my ship working under my "own" race.

I'm having trouble getting the Warp FX to work.

My race def is BazTMP and here is the soundpak I have created in Custom/autoload

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation

Foundation.SoundDef("BazTMPexitwarp.wav", "BazTMPexitwarp", 1)
Foundation.SoundDef("BazTMPwarpflash.wav", "BazTMPwarpflash", 1)
Foundation.SoundDef("BazTMPwarpflash.wav", "BazTMPEnterWarp", 1)

Any pointers as to what I'm doing wrong?
Title: Re: Changing a ships warps sounds
Post by: MLeo on June 10, 2009, 05:50:19 PM
I haven't had the time yet to respond to your PM, but in this case I would say that each filename should start with "sfx/" Unless your wav files are in the same directory as stbc.exe
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 10, 2009, 06:22:15 PM
Ok I've added the sfx/ to the file names still no sound during warp other than the default band with the warp flash?

*edit I edited the soundpak to change from baztmpenterwarp.wav to the default enter warp.wav and it works?

I then renamed my enter warp wav to replace the default fx and tried the sov and my essect worked?

Title: Re: Changing a ships warps sounds
Post by: MLeo on June 10, 2009, 07:17:21 PM
What do you mean with "normal band"?

The Exit Warp won't work, since you have a lower case e for Exit (should be a capital E), then there is the warpflash, NanoFX has no support for a custom warpflash sound.

Another possibility is that the sound isn't encoded properly, please search the BC Modding for the right settings.
Another is that you have another soundpack/plugin where you define the same sounds, in that case, BC won't let you hear anything.
Title: Re: Changing a ships warps sounds
Post by: baz1701 on June 11, 2009, 09:16:34 AM
Ok, Here is where I'm at.

I have a sound PY called BcTMP_soundpak.py in custom autoload. I do not have any other files calling the wav SFX's

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation

Foundation.SoundDef("sfx/BazTMPExitwarp1.wav", "BazTMPExitwarp", 1)
Foundation.SoundDef("sfx/BazTMPEnterwarp1.wav", "BazTMPEnterwarp", 1)

The 2 file BazTMPExitwarp1.wav & BazTMPenterwarp1.wav are in the default SFX folder still no warp sound!

The "Normal band" should read normal Bang. You have the warp enter sfx followed by the flash in the distance that has a bang sounding SFX.

I sourced the TMP warp effect from BC files, may change them after I have them working.