Bridge Commander Central
BC Forums => BC Scripting => Topic started by: hjenterprises on April 06, 2009, 06:36:03 AM
-
Anybody know how to make a ship to have the Torpedo Yield option in game?
-
The Torpedo Yield mod installs an example torpedo that consists of the files
PhotonTorpedo_YieldHigh.py
PhotonTorpedo_YieldMed.py
PhotonTorpedo_YieldLow.py
in scripts/Tactical/Projectiles.
To use this torpedo you just have to add one of these files to the hardpoint of a ship with MPE like you would normally install a torpedo.
If you want other torpedoes to have the yield option you have to create them yourself.
Lets say you want to modify the quantum torpedo.
1. Go to \scripts\Tactical\Projectiles and open QuantumTorpedo.py with notepad.
2a. Find
def GetName():
return ("Quantum Torpedo")
and replace 'Quantum Torpedo' with 'Quantum High Yield'. You can change how much damage this torpedo does by editing the number behind
def GetDamage():
return
Save the file as QuantumTorpedo_YieldHigh.py but keep it open in notepad.
2b. Now replace 'Quantum High Yield' with 'Quantum Med Yield', modify the damage and save the file as QuantumTorpedo_YieldMed.py but don't close it yet.
2c. Same drill as 2a and 2b only with 'Low' now.
3. Go to scripts\Custom\qbautostart and open TorpYield.py. (It would be prudent to make a backup now.)
a Search for
pYieldMain = App.STMenu_CreateW(App.TGString("Photon Yields"))and
if (pTacticalMenu != None):
pButton = pTacticalMenu.GetSubmenu("Photon Yields")
if (pButton != None):
pTacticalMenu.DeleteChild(pButton)and replace 'Photon Yields' with 'Torpedo Yields' respectively.
b Now go to '# do a torpedo name check '
and add
elif (pTorpedoType.GetAmmoName() == "Quantum High Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Quantum Med Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Quantum Low Yield"):
MenuSetup()so that it looks like this
if (TorpedoSystem):
iNumTypes = TorpedoSystem.GetNumAmmoTypes()
for iType in range(iNumTypes):
pTorpedoType = TorpedoSystem.GetAmmoType(iType)
if (pTorpedoType.GetAmmoName() == "Photon High Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Photon Med Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Photon Low Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Quantum High Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Quantum Med Yield"):
MenuSetup()
elif (pTorpedoType.GetAmmoName() == "Quantum Low Yield"):
MenuSetup()3c. Go to 'def LowYield(pObject, pEvent):'
and between
the last FelixLine(None, None) line
and # med yield damage definition
add
elif (pTorpedoType.GetAmmoName() == "Quantum
High Yield"):
iTorpType =
pTorpedoType.SetTorpedoScript("Tactical.Projectiles.QuantumTorpedo_Yiel
dLow")
pLowButton.SetDisabled()
pMedButton.SetEnabled()
pHighButton.SetEnabled()
FelixLine(None, None)
elif (pTorpedoType.GetAmmoName() == "Quantum
Med Yield"):
iTorpType =
pTorpedoType.SetTorpedoScript("Tactical.Projectiles.QuantumTorpedo_Yiel
dLow")
pLowButton.SetDisabled()
pMedButton.SetEnabled()
pHighButton.SetEnabled()
FelixLine(None, None)
elif (pTorpedoType.GetAmmoName() == "Quantum
Low Yield"):
iTorpType =
pTorpedoType.SetTorpedoScript("Tactical.Projectiles.QuantumTorpedo_Yiel
dLow")
pLowButton.SetDisabled()
pMedButton.SetEnabled()
pHighButton.SetEnabled()
FelixLine(None, None)
3d. Scroll down to # high yield damage definition,
and between
FelixLine(None, None)
and
# high yield damage definition
add
elif (pTorpedoType.GetAmmoName() == "Quantum
High Yield"):
iTorpType =
pTorpedoType.SetTorpedoScript("Tactical.Projectiles.QuantumTorpedo_Yiel
dMed")
pLowButton.SetEnabled()
pMedButton.SetDisabled()
pHighButton.SetEnabled()
FelixLine(None, None)
elif (pTorpedoType.GetAmmoName() == "Quantum
Med Yield"):
iTorpType =
pTorpedoType.SetTorpedoScript("Tactical.Projectiles.QuantumTorpedo_Yiel
dMed")
pLowButton.SetEnabled()
pMedButton.SetDisabled()
pHighButton.SetEnabled()
FelixLine(None, None)
elif (pTorpedoType.GetAmmoName() == "Quantum
Low Yield"):
iTorpType =
pTorpedoType.SetTorpedoScript("Tactical.Projectiles.QuantumTorpedo_Yiel
dMed")
pLowButton.SetEnabled()
pMedButton.SetDisabled()
pHighButton.SetEnabled()
FelixLine(None, None)
3e. Do the same as 3c and 3d with
def HighYield(pObject, pEvent):
only this time it's
Tactical.Projectiles.QuantumTorpedo_YieldHigh .
4. Save the file.
I've also included the modified file in case I forgot something.
I've not tested if that also works if you equip a ship with more than one variable yield torpedo.
-
I've not tested if that also works if you equip a ship with more than one variable yield torpedo.
It works only there are two Torpedo Yield buttons now.
-
Thanks for posting this.
-
i recently downloaded a ship not sure wich one it was as i installed several at one time and now I have this torpedo yield option in qb i checked to see if i could see a photon low med high and same for quantum in my tactical projectiles folder and couldn't readily identify any. My question is this how can I find what torpedo has this so I can equip to more vessels and also is there a mod package that has the above described script in a complete format (with readily made torpedo's to work with it) so i could just copy drop and paste into my install I really like this idea. any help greatly appreciated :bow:
-
Usually this gives you the path to the yield torp script for example: Tactical.Projectiles.QuantumTorpedo_YieldMed. Look in the script source code for something similar and you'll find it. However why would anyone want to use this train wreck of a script I wrote a long time ago? And no there are no know mod packages for this script.
Also, please don't revive old threads just open a new one.
-
Usually this gives you the path to the yield torp script for example: Tactical.Projectiles.QuantumTorpedo_YieldMed. Look in the script source code for something similar and you'll find it. However why would anyone want to use this train wreck of a script I wrote a long time ago? And no there are no know mod packages for this script.
Also, please don't revive old threads just open a new one.
Sorry mario will do for now on :P. I did a search on the site and this topic had the most relevance. train wreck??? I think this is cool lil mod, did you make an updated verision of this?
ok found what script it is now under qbautostart the https://www.dropbox.com/s/ccen23ba92xgwlt/SentinelTorpYield.py (https://www.dropbox.com/s/ccen23ba92xgwlt/SentinelTorpYield.py) it's from http://bridgecommander.filefront.com/file/USSSentinel;49297 thanks for the help Mario.
-
train wreck???
Yes, a few reasons why:
1. Code is bad
2. Mod is not user friendly
a) Mod doesn't allow you to easily plug in additional torpedo scripts
b) You have to edit a script to plug in additional torpedo yields which potentially results in multiple versions of the same script
c) No plugin system support of any kind
3. Mod really serves no purpose if you ask me
4. Mod doesn't have AI support
5. It's one of my early scripts and usually a programmer will always be critical of his early work. In this instance an 8 year old script makes me want to cry. Especially if I look at this from a position of a professional senior developer which I've become and look back at my amateur days.
I think this is cool lil mod, did you make an updated verision of this?
No.