Author Topic: Torpedo Yield?  (Read 1284 times)

Offline hjenterprises

  • Posts: 37
  • Cookies: 0
Torpedo Yield?
« on: April 06, 2009, 06:36:03 AM »
Anybody know how to make a ship to have the Torpedo Yield option in game?
url=http://www.stexcalibur.com][/url

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Torpedo Yield?
« Reply #1 on: April 06, 2009, 09:58:28 AM »
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
 
Code: [Select]
pYieldMain = App.STMenu_CreateW(App.TGString("Photon Yields"))and
Code: [Select]
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
Code: [Select]
                       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
Code: [Select]
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
Code: [Select]
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
Code: [Select]
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.

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Torpedo Yield?
« Reply #2 on: April 06, 2009, 11:15:55 AM »
Quote
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.

Offline Digital_Clarity

  • Posts: 82
  • Cookies: 3
Re: Torpedo Yield?
« Reply #3 on: May 01, 2009, 11:48:06 AM »
Thanks for posting this.

Offline Maverick

  • Posts: 79
  • Cookies: 1
Re: Torpedo Yield?
« Reply #4 on: February 14, 2014, 10:50:27 PM »
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:
Qprisbrey

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2186
  • Cookies: 1706
  • Life is life
Re: Torpedo Yield?
« Reply #5 on: February 14, 2014, 11:33:44 PM »
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.
Acta, non verba.
aka USS Sovereign

Offline Maverick

  • Posts: 79
  • Cookies: 1
Re: Torpedo Yield?
« Reply #6 on: February 14, 2014, 11:53:09 PM »
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  it's from http://bridgecommander.filefront.com/file/USSSentinel;49297 thanks for the help Mario.
Qprisbrey

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2186
  • Cookies: 1706
  • Life is life
Re: Torpedo Yield?
« Reply #7 on: February 15, 2014, 10:24:16 AM »
Quote
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.

Quote
I think this is cool lil mod, did you make an updated verision of this?

No.

Acta, non verba.
aka USS Sovereign