Ok so I'm gonna need some help. I tried combining scripts together for a single torpedo.
I'm trying to recreate a custom version of SFC's "Plasma Shotgun".
For some stupid reason it's not working, and I have no idea what I'm doing here because I cannot seem to fix this.
###############################################################################
# Filename: PositronTorpedo.py
#
# Confidential and Proprietary, Copyright 2000 by Totally Games
#
# Script for filling in the attributes of positron torpedoes.
#
# Created: 11/3/00 - Erik Novales
###############################################################################
import App
import MissionLib
###############################################################################
# Create(pTorp)
#
# Creates a positron torpedo.
#
# Args: pTorp - the torpedo, ready to be filled-in
#
# Return: zero
###############################################################################
def Create(pTorp):
kCoreColor = App.TGColorA()
kCoreColor.SetRGBA(128.0 / 255.0, 235.0 / 128.0, 108.0 / 255.0, 1.000000)
kGlowColor = App.TGColorA()
kGlowColor.SetRGBA(1.0 / 128.0, 108.0 / 5.0, 1.0 / 255.0, 1.000000)
kFlareColor = App.TGColorA()
kFlareColor.SetRGBA(128.0 / 255.0, 255.0 / 128.0, 118.0 / 255.0, 1.000000)
pTorp.CreateTorpedoModel(
"data/Textures/Tactical/JLH03.tga",
kCoreColor,
0.50,
2.0,
"data/Textures/Tactical/JLH03a.tga",
kGlowColor,
9.0,
0.2,
0.0,
"data/Textures/Tactical/TorpedoFlares.tga",
kFlareColor,
100,
0.2,
0.3)
pTorp.SetDamage( GetDamage() )
pTorp.SetDamageRadiusFactor(0.20)
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.PHASEDPLASMA)
return(0)
def GetLaunchSpeed():
return(14.0)
def GetLaunchSound():
return("RomTorpJLH")
def GetPowerCost():
return(40.0)
def GetName():
return("Plasma-SG")
def GetDamage():
return 2000.0
# this sets the distance in kilometers at which the torpedo will have the yield set in GetDamage()
def GetDamageDistance():
return 15
# this sets the maximum damage the torpedo will ever do
def GetMaxDamage():
return 8000
def GetGuidanceLifetime():
return 7.0
def GetMaxAngularAccel():
return 0.35
def GetLifetime():
return 30
# all the following is the code that actually does the variable damage
# this routine is called by fta when this torpedo is fired
def WeaponFired(pObject, pEvent):
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
pTarget=pShip.GetTarget()
if (pTarget==None):
return
distance=App.UtopiaModule_ConvertGameUnitsToKilometers(MissionLib.GetDistance(pShip,pTarget))+0.01
damage=GetDamage()*(GetDamageDistance()/distance)
if (damage>GetMaxDamage()):
damage=GetMaxDamage()
pTorp.SetDamage(damage)
return
sYieldName = None
sFireName = ''
import FoundationTech
import ftb.Tech.TimedTorpedoes as ftb
oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo('Plasma Shotgun', {
'spreadNumber': 8,
'spreadDensity': 6.0,
'warheadModule': 'Tactical.Projectiles.SFPPlasmaShotgunSingle',
'shellLive': 0 })
FoundationTech.dOnFires[__name__] = oFire
try:
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass
def TargetHit(pObject, pEvent):
return