Author Topic: Phased Torpedoes  (Read 1534 times)

Offline DKealt

  • Posts: 110
  • Cookies: 4
Phased Torpedoes
« on: August 18, 2009, 01:17:43 PM »
I'm in desperation here. After seeing numerous mods and various ways of doing it...how do you create a phased torpedo?

I'm working within all the standard KM1.0 Technologies and I just can't make a good one, or one that works.

Also if there are multiple ways of doing this, anyone got a preferred scripting method?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Phased Torpedoes
« Reply #1 on: August 18, 2009, 01:45:52 PM »
From personal experiece, use the FoundationTechnologies way.

It should be included in KM, and there should be a readme on FTech included with KM, and that should include instruction for changing a projectile to phase through shields.
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...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline Worf359Alpha

  • Master HardPointer, Novice Scripter!
  • Posts: 131
  • Cookies: 14
  • Peace Thru Superior Firepower
Re: Phased Torpedoes
« Reply #2 on: August 18, 2009, 05:51:49 PM »
This is my Phased Torpedo Script, copy it into one of your own Torpedo scripts and you shoud be good to go. Rename it to what ever you want, you will need FTECH for it to work.



###############################################################################
#   Filename:   PoleronTorp.py
#   By:             Andy      
###############################################################################
# This torpedo uses the FTA mod...
#
# it actually passes through shields and damages whatever subsystem it was
# targeted at
#
# please refer to the bottom of this file for details on changing effects
###############################################################################
import App
pWeaponLock = {}


###############################################################################
#   Args:   pTorp - the torpedo, ready to be filled-in
#   
#   Return:   zero
###############################################################################
def Create(pTorp):
   kCoreColor = App.TGColorA()
   kCoreColor.SetRGBA(222.0 / 255.0, 222.0 / 255.0, 253.0 / 255.0, 1.000000)
   kGlowColor = App.TGColorA()
   kGlowColor.SetRGBA(61.0 / 201.0, 98.0 / 255.0, 239.0 / 255.0, 1.000000)   

   pTorp.CreateTorpedoModel(
               "data/Textures/Tactical/TorpedoFlares.tga",
               kCoreColor,
               0.1,
               0.8,   
               "data/Textures/Tactical/TorpedoCore.tga",
               kCoreColor,
               0.1,   
               0.2,   
               0.1,   
               "data/Textures/Tactical/TorpedoCore.tga",
               kGlowColor,                              
               400,      
               0.3,      
               0.05)

   pTorp.SetDamage( GetDamage() )
   pTorp.SetDamageRadiusFactor(0.50)
   pTorp.SetGuidanceLifetime( GetGuidanceLifetime() )
   pTorp.SetMaxAngularAccel( GetMaxAngularAccel() )

   # Multiplayer specific stuff.  Please, if you create a new torp
   # type. modify the SpeciesToTorp.py file to add the new type.
   import Multiplayer.SpeciesToTorp
   pTorp.SetNetType (Multiplayer.SpeciesToTorp.QUANTUM)

   return(0)

def GetLaunchSpeed():
   return(32.0)

def GetLaunchSound():
   return("ZZ_Shockwave")

def GetPowerCost():
   return(33.0)

def GetName():
   return("Phased")

def GetDamage():
   return 0.00001

# Sets the minimum damage the torpedo will do
def GetMinDamage():
   return 170

# Sets the percentage of damage the torpedo will do
def GetPercentage():
   return 0.25

def GetGuidanceLifetime():
   return 9.0

def GetMaxAngularAccel():
   return 0.10

def TargetHit(pObject, pEvent):
   global pWeaponLock
   pTorp=App.Torpedo_Cast(pEvent.GetSource())
   pShip=App.ShipClass_Cast(pEvent.GetDestination())
   if (pTorp==None) or (pShip==None):
      return
   try:
      id=pTorp.GetObjID()
      pSubsystem=pWeaponLock[id]
      del pWeaponLock[id]
   except:
      pSubsystem=pShip.GetHull()
   if (pSubsystem==None):
      return
   Dmg=pSubsystem.GetMaxCondition()*GetPercentage()
   if (Dmg<GetMinDamage()):
      Dmg=GetMinDamage()
   if (pSubsystem.GetCondition()>Dmg):
      pSubsystem.SetCondition(pSubsystem.GetCondition()-Dmg)
   else:
      pShip.DestroySystem(pSubsystem)
   return

def WeaponFired(pObject, pEvent):
   global pWeaponLock
   pTorp=App.Torpedo_Cast(pEvent.GetSource())
   pTube=App.TorpedoTube_Cast(pEvent.GetDestination())
   if (pTorp==None) or (pTube==None):
      return
   pShip=pTube.GetParentShip()
   if (pShip==None):
      return
   try:
      pWeaponLock[pTorp.GetObjID()]=pShip.GetTargetSubsystem()
   except:
      return
   return


500+ HardPointed Ships and counting! Man where do i find the time!

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #3 on: August 18, 2009, 08:32:32 PM »
Thanks a bunch.

I think I just needed a working example to fully understand how it worked

Offline tiqhud

  • BCFiles File Poster
  • Posts: 1763
  • Cookies: 1067
  • San Francisco Shipyards (HPer) file manuiplater
Re: Phased Torpedoes
« Reply #4 on: August 18, 2009, 08:41:48 PM »
Thanks a bunch.

I think I just needed a working example to fully understand how it worked
Yep, a working model is always good.
TiqHud
you sir, are unable to strike, the port or starboard parts of hull , of a bovine storage facility.
Canon , what people argue exists, that doesn't really  exist.
It is all the little details, that cause headaches.
"Never judge wealth with Money"
'Intelligence has Nothing to do with Politics'
it is Late, Do you know where your Towel is?

Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Phased Torpedoes
« Reply #5 on: August 18, 2009, 11:27:41 PM »
Really? FTech for it to work?

Seems like its something else... Kinda like... FTA perhaps? :P
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download

Offline hellewellth

  • Posts: 4
  • Cookies: 0
Re: Phased Torpedoes
« Reply #6 on: August 19, 2009, 09:28:52 AM »
Seems like its something else... Kinda like... FTA perhaps? :P
That would be why i could not get it to work.  It seams Kobayashi Maru 1.0 removed that part of FTA.

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #7 on: August 19, 2009, 02:58:40 PM »
I tried applying the script modifications with FTech.

Just didn't work not sure why tho, i added what it said in the Readme and I came up with this, anyone see why it didn't work?
Code: [Select]
import App

def Create(pTorp):
kCoreColor = App.TGColorA()
kCoreColor.SetRGBA(255.0 / 255.0, 250.0 / 255.0, 100.0 / 255.0, 1.000000)
kGlowColor = App.TGColorA()
kGlowColor.SetRGBA(230.0 / 255.0, 230.0 / 255.0, 10.0 / 255.0, 1.000000)

pTorp.CreateTorpedoModel(
"data/Textures/Tactical/TransphasicCore.tga",
kCoreColor,
0.1,
6.0,
"data/Textures/Tactical/TransphasicGlow.tga",
kGlowColor,
1.0,
0.25,
0.3,
"data/Textures/Tactical/TorpedoFlares.tga",
kGlowColor,
12,
0.15,
0.1)

pTorp.SetDamage( GetDamage() )
pTorp.SetDamageRadiusFactor(10.0)
pTorp.SetGuidanceLifetime( GetGuidanceLifetime() )
pTorp.SetMaxAngularAccel( GetMaxAngularAccel() )

import Multiplayer.SpeciesToTorp
pTorp.SetNetType (Multiplayer.SpeciesToTorp.PHOTON)

return(0)

def GetLaunchSpeed():
return(30.0)

def GetLaunchSound():
return("Transphasic Torpedo")

def GetPowerCost():
return(25.0)

def GetName():
return("Transphasic")

def GetDamage():
return 500000.0

def GetGuidanceLifetime():
return 2.0

def GetMaxAngularAccel():
return 0.3

def GetLifetime():
return 12.0

try:
sYieldName = ?Phased Torpedo?
import FoundationTech
try:
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass
except:
pass

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Phased Torpedoes
« Reply #8 on: August 19, 2009, 03:03:26 PM »
The first example is FTA (I think), the last is FoundationTechnologies.

And here is the fixed version:
Code: [Select]
import App

def Create(pTorp):
kCoreColor = App.TGColorA()
kCoreColor.SetRGBA(255.0 / 255.0, 250.0 / 255.0, 100.0 / 255.0, 1.000000)
kGlowColor = App.TGColorA()
kGlowColor.SetRGBA(230.0 / 255.0, 230.0 / 255.0, 10.0 / 255.0, 1.000000)

pTorp.CreateTorpedoModel(
"data/Textures/Tactical/TransphasicCore.tga",
kCoreColor,
0.1,
6.0,
"data/Textures/Tactical/TransphasicGlow.tga",
kGlowColor,
1.0,
0.25,
0.3,
"data/Textures/Tactical/TorpedoFlares.tga",
kGlowColor,
12,
0.15,
0.1)

pTorp.SetDamage( GetDamage() )
pTorp.SetDamageRadiusFactor(10.0)
pTorp.SetGuidanceLifetime( GetGuidanceLifetime() )
pTorp.SetMaxAngularAccel( GetMaxAngularAccel() )

import Multiplayer.SpeciesToTorp
pTorp.SetNetType (Multiplayer.SpeciesToTorp.PHOTON)

return(0)

def GetLaunchSpeed():
return(30.0)

def GetLaunchSound():
return("Transphasic Torpedo")

def GetPowerCost():
return(25.0)

def GetName():
return("Transphasic")

def GetDamage():
return 500000.0

def GetGuidanceLifetime():
return 2.0

def GetMaxAngularAccel():
return 0.3

def GetLifetime():
return 12.0

try:
sYieldName = 'Phased Torpedo'
import FoundationTech
try:
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass
except:
pass


Notice the '' around Phased Torpedo, instead of the fancy ones.
And the indendation before the last pass.
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...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #9 on: August 19, 2009, 04:35:22 PM »
Okay cool thanks,

That script loads, but it doesn't work. The torp doesn't pass through the shields and it just completely drains the vector it hits.

Second shot will destroy the ship,

Any idea why that is?

Offline Dalek

  • Posts: 1529
  • Cookies: 206
Re: Phased Torpedoes
« Reply #10 on: August 19, 2009, 04:38:40 PM »
Cos the damage is so flipping powerful. :P


Code: [Select]
def GetDamage():
return 500000.0


It's still not phasing but its exceedingly powerful.
"To live on as we have is to leave behind joy, and love, and companionship, because we know it to be transitory, of the moment. We know it will turn to ash. Only those whose lives are brief can imagine that love is eternal. You should embrace that remarkable illusion. It may be the greatest gift your race has ever received."

 - Lorien

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #11 on: August 19, 2009, 04:58:23 PM »
OK so the problem is then that the script still won't actually phase.

Im using this on a KM1.0 install, anyone know if this tech should work on it.

I've located the phasing strip etc, and it seems that it should work?

P.s. It's for a custom transphasic torp script so it needs to take down Cubes, hence the super power

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Phased Torpedoes
« Reply #12 on: August 19, 2009, 05:18:21 PM »
Code: [Select]
Could you try this version of the projectile (mind the damage, I didn't change it):
[code]import App

def Create(pTorp):
kCoreColor = App.TGColorA()
kCoreColor.SetRGBA(255.0 / 255.0, 250.0 / 255.0, 100.0 / 255.0, 1.000000)
kGlowColor = App.TGColorA()
kGlowColor.SetRGBA(230.0 / 255.0, 230.0 / 255.0, 10.0 / 255.0, 1.000000)

pTorp.CreateTorpedoModel(
"data/Textures/Tactical/TransphasicCore.tga",
kCoreColor,
0.1,
6.0,
"data/Textures/Tactical/TransphasicGlow.tga",
kGlowColor,
1.0,
0.25,
0.3,
"data/Textures/Tactical/TorpedoFlares.tga",
kGlowColor,
12,
0.15,
0.1)

pTorp.SetDamage( GetDamage() )
pTorp.SetDamageRadiusFactor(10.0)
pTorp.SetGuidanceLifetime( GetGuidanceLifetime() )
pTorp.SetMaxAngularAccel( GetMaxAngularAccel() )

import Multiplayer.SpeciesToTorp
pTorp.SetNetType (Multiplayer.SpeciesToTorp.PHOTON)

return(0)

def GetLaunchSpeed():
return(30.0)

def GetLaunchSound():
return("Transphasic Torpedo")

def GetPowerCost():
return(25.0)

def GetName():
return("Transphasic")

def GetDamage():
return 500000.0

def GetGuidanceLifetime():
return 2.0

def GetMaxAngularAccel():
return 0.3

def GetLifetime():
return 12.0

try:
sYieldName = 'Phased Torpedo'
import FoundationTech
try:
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
print "Sorry, no Phased Torpedo Tech installed"
pass
except:
pass

And have you checked that you have a scripts/Custom/Techs/PhasedTorp.py and it's pyc counterpart?[/code]
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...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: Phased Torpedoes
« Reply #13 on: August 19, 2009, 05:30:30 PM »
MLeo, i think there might be a problem with
Code: [Select]
[/quote]

And have you checked that you have a scripts/Custom/Techs/PhasedTorp.py and it's pyc counterpart?
being in the script :P

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #14 on: August 19, 2009, 06:00:31 PM »
Got it.

Took a hunch that there was a line of code missing from the readme.
After the line...
Code: [Select]
import FoundationTechThere should have been another line after that...
Code: [Select]
import Custom.Techs.PhasedTorpAnd that's why it didn't work!!!

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Phased Torpedoes
« Reply #15 on: August 19, 2009, 06:08:09 PM »
Phased Torpedoes should automatically load whenever the mutators are loaded.

Could you attach scripts/Custom/Autoload/LoadFoundationTech.py
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...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline Worf359Alpha

  • Master HardPointer, Novice Scripter!
  • Posts: 131
  • Cookies: 14
  • Peace Thru Superior Firepower
Re: Phased Torpedoes
« Reply #16 on: August 19, 2009, 06:08:39 PM »
Really? FTech for it to work?

Seems like its something else... Kinda like... FTA perhaps? :P

Sorry, my bad!
500+ HardPointed Ships and counting! Man where do i find the time!

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #17 on: August 19, 2009, 06:43:25 PM »
This is the "LoadFoundationsTech.py" that I have on my install...
Code: [Select]
import Foundation
import FoundationTech

import ftb.Tech
import ftb.Tech.ATPFunctions

mode = FoundationTech.mode

Foundation.SoundDef('Custom/FTB/Sfx/Weapons/RomPlasmaBurst.wav', 'FTB Plasma', 1.0, { 'modes': [ mode ] })
#oIPhasers = Foundation.OverrideDef('Inaccurate Phasers', 'TacticalControlHandlers.FireWeapons', 'FoundationTech.FireWeapons', { 'modes': [ mode ] } )

Foundation.LoadExtraPlugins("scripts\\Custom\\Techs")
#Foundation.LoadExtraPlugins("scripts\\ftb\\Tech")
#Include standard techs to initialize them
from ftb.Tech import AblativeArmour,DamperWeapon,DisablerYields,Shields,BreenDrainer,TachyonProjectile,FedAblativeArmor


Foundation.ERA_ENT = 1
Foundation.ERA_TOS = 2
Foundation.ERA_TMP = 4
Foundation.ERA_PRETNG = 8
Foundation.ERA_TNG = 16
Foundation.ERA_DS9 = 32
Foundation.ERA_NEMESIS = 64

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Phased Torpedoes
« Reply #18 on: August 19, 2009, 06:47:11 PM »
In which case I think it should already have been loaded.
Oh well, if this works.
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...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Phased Torpedoes
« Reply #19 on: August 19, 2009, 08:29:15 PM »
Just to check, the phased torp script is located in...

scripts/Custom/Techs folder,

Does the line in the script ...

Foundation.LoadExtraPlugins("scripts\\Custom\\Techs")

actually load the contents? (I don't know how the double backslash works)