Author Topic: adding splitting torpedo tech  (Read 1838 times)

Offline Kingly

  • Posts: 4
  • Cookies: 0
adding splitting torpedo tech
« on: August 14, 2010, 10:32:01 PM »
im trying to add ftech to a torpedo so that it splits into multiple torpedoes after launch.

this is what the ftech user guide says:
Quote
There are 2 types of splitting projectiles, single target and multi target.
Single target splitting projectiles split and converge at the same target.
Multi target splitting projectiles split and pick their own (enemy) targets. And both do this after 100 game units distance from the parent ship.
With splitting torpedoes it?s important that you have 2 projectiles.
1 is the ?shell? and the other the ?warhead?. The shell is what gets fired from the ship. The warhead is what comes out of the shell. So it?s important that the warhead and the shell aren?t the same, or you would get infinite (well until BC can?t handle it anymore) torpedoes on the screen. This is something you don?t want to be happening. It is of course all right to have multiple stage cluster projectiles, just try and prevent a loop of any sort with these.
And here is the example for a Single Target Splitting Projectile:
Code: [Select]
sYieldName = ??
try:
import FoundationTech
import ftb.Tech.TimedTorpedoes
oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo(
?Name for tech?, {
?spreadNumber?: 3,
?spreadDensity?: 6.5,
?warheadModule?: ?PathToModule?,
?shellLive?: 0,
})
FoundationTech.dOnFires[__name__] = oFire
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass
And here is a quick rundown. Name for Tech is the name you give to this configuration.
spreadNumber is the amount of warheads the projectile will fire.
spreadDensity is the distance between 2 warheads when they spread out from the shell (after which they will converge on their target). It?s defined in degree.
warheadModule is the path to the new projectile that is to be spawned (same structure of path as

however i cant seem to get it to work, this is what i have: (yes i know its an odd choice of torpedoes, but i just want it to work first)
Code: [Select]
###############################################################################
# Filename: GodDefiantQuantum.py
#
# Confidential and Proprietary, Copyright 2000 by Totally Games
#
# Script for filling in the attributes of quantum torpedoes.
#
# Created: 11/3/00 - Erik Novales
###############################################################################

import App

###############################################################################
# Create(pTorp)
#
# Creates a quantum torpedo.
#
# 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 / 255.0, 98.0 / 255.0, 239.0 / 255.0, 1.000000)

pTorp.CreateTorpedoModel(
"data/Textures/Tactical/Quantum01.tga",
kCoreColor,
0.1,
0.0,
"data/Textures/Tactical/Quantum01Glow.tga",
kGlowColor,
2.0,
0.2,
0.17,
"data/Textures/Tactical/TorpedoFlares.tga",
kGlowColor,
62,
0.12,
0.5)

pTorp.SetDamage( GetDamage() )
pTorp.SetDamageRadiusFactor(0.14)
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(65.0)

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

def GetPowerCost():
return(30.0)

def GetName():
return("Quantum")

def GetDamage():
return 20000.0

def GetGuidanceLifetime():
return 25.0

def GetMaxAngularAccel():
return 0.2

sYieldName = ?Single Target Splitting Projectile?
try:
import FoundationTech
import ftb.Tech.TimedTorpedoes
oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo(
?Cluster missle?, {
?spreadNumber?: 10,
?spreadDensity?: 6.5,
?warheadModule?: ?Tactical.Projectiles.Mark9Tactical?,
?shellLive?: 0,
})
FoundationTech.dOnFires[__name__] = oFire
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass


Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2200
  • Cookies: 1707
  • Life is life
Re: adding splitting torpedo tech
« Reply #1 on: August 14, 2010, 11:02:54 PM »
Because you've got so many syntax errors, I don't know where to start lol

Code: [Select]
sYieldName = 'Single Target Splitting Projectile'
try:
import FoundationTech
import ftb.Tech.TimedTorpedoes
oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo('Cluster missle', {'spreadNumber': 10, 'spreadDensity': 6.5, 'warheadModule': 'Tactical.Projectiles.Mark9Tactical', 'shellLive': 0,})
FoundationTech.dOnFires[__name__] = oFire
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
print 'There seems to be a problem with this torpedo tech.'
Acta, non verba.
aka USS Sovereign

Offline Kingly

  • Posts: 4
  • Cookies: 0
Re: adding splitting torpedo tech
« Reply #2 on: August 14, 2010, 11:17:31 PM »
well thats why im asking, iv never really tried to do anything fancy with torpedoes, im just looking to get a working example

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: adding splitting torpedo tech
« Reply #3 on: August 15, 2010, 08:39:52 AM »
Umm, did you read the answer I gave you at forums.filefront.com?

Offline Kingly

  • Posts: 4
  • Cookies: 0
Re: adding splitting torpedo tech
« Reply #4 on: August 15, 2010, 08:54:30 AM »
it diddnt work, BCUT lets you add all the torpedo tech except splitting torpedoes

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2200
  • Cookies: 1707
  • Life is life
Re: adding splitting torpedo tech
« Reply #5 on: August 15, 2010, 10:41:19 AM »
I believe I posted a corrected code. Have you tried that?
Acta, non verba.
aka USS Sovereign

Offline Kingly

  • Posts: 4
  • Cookies: 0
Re: adding splitting torpedo tech
« Reply #6 on: August 15, 2010, 03:19:31 PM »
yes, thank you, it works  :yay:

Offline flarespire

  • The one who breaks the cycle.
  • Posts: 1230
  • Cookies: 47
  • God Green God Dammit!
Re: adding splitting torpedo tech
« Reply #7 on: August 15, 2010, 05:47:09 PM »
maybe this is on bcfiles or if not you should add it...

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: adding splitting torpedo tech
« Reply #8 on: August 15, 2010, 06:49:13 PM »
it's part of FTech already...
the code is given in the manual...

Offline flarespire

  • The one who breaks the cycle.
  • Posts: 1230
  • Cookies: 47
  • God Green God Dammit!
Re: adding splitting torpedo tech
« Reply #9 on: August 15, 2010, 08:05:04 PM »
well ill look into adding that to my install later