Author Topic: random question about torpedo splitting  (Read 1775 times)

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
random question about torpedo splitting
« on: April 17, 2018, 04:14:09 PM »
Is there a way for a torpedo to fire out and when after impact on shield or hull will separate into smaller torpedoes?

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Re: random question about torpedo splitting
« Reply #1 on: April 17, 2018, 11:00:01 PM »
Actually, the Akira that I acquired from someone who has since disappeared, Zoran Koren, has torpedoes which split into several smaller ones, however they split before any shield/hull impacts. I will see if I can find the scripts he used.

Offline Morgan

  • Moderator
  • Posts: 1340
  • Cookies: 65535
Re: random question about torpedo splitting
« Reply #2 on: April 18, 2018, 11:53:35 AM »
FTech allows for "spread" torpedoes - essentially you fire a torpedo and it spreads into multiple ones right off the bat.  Blackrook's common weapons pack makes use of this.

You could also setup spread properties in the ship hardpoint so that it will fire all the tubes at once in a spread pattern.

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #3 on: April 18, 2018, 02:18:32 PM »
Hmm I guess that can do for now. I thought about actually having the hellbore torpedo for BC to fire out as a slightly powerful torpedo as a whole with a function that when split will become fast homing micro hellbores that spread wide outward then locked on the enemy ship with precision, allowing the torpedoes to hit the ship like it was a DBZ Style Hellzone Grenade.

Offline vonfrank

  • Posts: 447
  • Cookies: 182
Re: random question about torpedo splitting
« Reply #4 on: April 18, 2018, 03:17:12 PM »
You could also setup spread properties in the ship hardpoint so that it will fire all the tubes at once in a spread pattern.

The biggest problem with BC's built-in torpedo spread function is the incredibly long delay between torpedo launch and the time before the torps start to seek the target. By the time they begin to track (about 2 seconds or so) they are sometimes completely past the target, making the spread ability only useful if you fire from very long range.

I really wish there was some way to reduce that seek delay, but I have a feeling it's hard-coded into the game.

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Re: random question about torpedo splitting
« Reply #5 on: April 19, 2018, 12:18:43 AM »
Unfortunately, all I can find is the pyc file. No py file was ever included when he sent me the files. I'm sorry. :(

It can be done, though. I'm not sure who even made the pyc but its named PhotonTorpedoMultiple.py/c

Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: random question about torpedo splitting
« Reply #6 on: April 19, 2018, 04:02:49 PM »
What morgan said!

There is a 'TimedTorpedoes' file in FTB, including a 'MIRVSingleTargetTorpedo' class and a 'MIRVMultiTargetTorpedo' that are used e.g., in

some bcsTNG stuff, not sure which exactly.

An example torpedo has these lines added at the end:
Spoiler: show

Code: [Select]
try:
import FoundationTech
import ftb.Tech.TimedTorpedoes

oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo(
'Spread2', {
'spreadNumber': 2,
'spreadDensity': 7.5,
'warheadModule': 'Custom.BCSTNG.CWP.Scripts.blackelmtype6',
'shellLive': 0,
})
FoundationTech.dOnFires[__name__] = oFire
except:
pass

Offline Morgan

  • Moderator
  • Posts: 1340
  • Cookies: 65535
Re: random question about torpedo splitting
« Reply #7 on: April 20, 2018, 10:51:19 AM »
The biggest problem with BC's built-in torpedo spread function is the incredibly long delay between torpedo launch and the time before the torps start to seek the target. By the time they begin to track (about 2 seconds or so) they are sometimes completely past the target, making the spread ability only useful if you fire from very long range.
This is true.  When I do use BC's built in spread function I tend to only do so at a distance of about 40km - this gives the torpedoes enough time to start tracking without missing and passing the target.  Any closer and you'll want to stick with single launches.

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #8 on: April 22, 2018, 11:54:36 PM »
I guess it really can be a pain in the butt huh? Shame I don't have those MIRV torpedoes. Mind sending them over Krrks along with a tutorial?

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Re: random question about torpedo splitting
« Reply #9 on: April 23, 2018, 12:13:14 AM »
You can decompile pyc now, I did decompile the PhotonTorpedoMultiple.pyc, here ya go :)

scripts/Tactical/Projectiles

PhotonTorpedoMultiple.py
Spoiler: show
Code: [Select]
# File: P (Python 1.5)

import App

def Create(pTorp):
    kGlowColor = App.TGColorA()
    kGlowColor.SetRGBA(1.0, 0.784314, 0.0, 1.0)
    kCoreColor = App.TGColorA()
    kCoreColor.SetRGBA(1.0, 0.45098, 0.0, 1.0)
    pTorp.CreateTorpedoModel('data/Textures/Tactical/TorpedoCore.tga', kCoreColor, 0.2, 1.2, 'data/Textures/Tactical/TorpedoGlow.tga', kGlowColor, 3.0, 0.3, 0.6, 'data/Textures/Tactical/TorpedoFlares.tga', kGlowColor, 8, 0.7, 0.4)
    pTorp.SetDamage(GetDamage())
    pTorp.SetDamageRadiusFactor(0.13)
    pTorp.SetGuidanceLifetime(GetGuidanceLifetime())
    pTorp.SetMaxAngularAccel(GetMaxAngularAccel())
    import Multiplayer.SpeciesToTorp as Multiplayer
    pTorp.SetNetType(Multiplayer.SpeciesToTorp.PHOTONMULT)
    return 0


def GetLaunchSpeed():
    return 20.0


def GetLaunchSound():
    return 'Photon Torpedo'


def GetPowerCost():
    return 20.0


def GetName():
    return 'Multiple Photon'


def GetDamage():
    return 620.0


def GetGuidanceLifetime():
    return 10.0


def GetMaxAngularAccel():
    return 0.15

sYieldName = None
sFireName = ''
import FoundationTech
import ftb.Tech.TimedTorpedoes as ftb
oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo('Photon Single Target', {
    'spreadNumber': 5,
    'spreadDensity': 6.0,
    'warheadModule': 'Tactical.Projectiles.PhotonTorpedo',
    'shellLive': 0 })
FoundationTech.dOnFires[__name__] = oFire

try:
    oYield = FoundationTech.oTechs[sYieldName]
    FoundationTech.dYields[__name__] = oYield
except:
    pass


Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: random question about torpedo splitting
« Reply #10 on: April 23, 2018, 01:23:30 PM »
I guess it really can be a pain in the butt huh? Shame I don't have those MIRV torpedoes. Mind sending them over Krrks along with a tutorial?

They are part of FTech, together with a Readme that includes explanations and how-to s for all included techs.

Ftech can be found on gamefront or the nexus.
https://www.gamefront.com/games/bridge-commander/file/ftech-foundation-technologies
https://www.nexusmods.com/startrekbridgecommmander/mods/1907

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #11 on: April 24, 2018, 11:31:54 AM »
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.

Code: [Select]
###############################################################################
# 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

Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: random question about torpedo splitting
« Reply #12 on: April 24, 2018, 03:07:02 PM »
Are there any exceptions displayed in the console?

Just from the looks your torp seems fine (that TargetHit function rubs me the wrong way for some reason, but idk).

I don't have access to my pc for most of the next 2 weeks, so i can't really test it.

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #13 on: April 25, 2018, 01:19:00 PM »
Idk what I did wrong here. Every time I tried on this code it does not show up in game, the torpedo that's loaded just does not show up

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #14 on: April 27, 2018, 02:36:13 PM »
So yeah I have absolutely no idea why this isn't working.  :idk:

Offline Morgan

  • Moderator
  • Posts: 1340
  • Cookies: 65535
Re: random question about torpedo splitting
« Reply #15 on: April 27, 2018, 05:50:19 PM »
I never played SFC so I'm not familiar with the plasma shotgun.

Did you add in the FTech properties manually?  Or did you use BCUT?

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #16 on: April 27, 2018, 06:06:00 PM »
Mine was manually. Afaik I have no idea how to apply plasma tech and Split torpedo script tech via BCUT. My BCUT is version 1.8.1.0

Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: random question about torpedo splitting
« Reply #17 on: May 01, 2018, 11:36:48 AM »
Try this instead:

Spoiler: show

Code: [Select]
###############################################################################
# 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

try:
import FoundationTech
import ftb.Tech.TimedTorpedoes
oFire = ftb.Tech.TimedTorpedoes.MIRVSingleTargetTorpedo('Plasma Shotgun', {
'spreadNumber': 8,
'spreadDensity': 6.0,
'warheadModule': 'Tactical.Projectiles.SFPPlasmaShotgunSingle',
'shellLive': 0,
})
FoundationTech.dOnFires[__name__] = oFire
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass
   
def TargetHit(pObject, pEvent):
return


Something after the ftech import was preventing your torpedo from compiling properly, not sure what exactly.

Offline Morgan

  • Moderator
  • Posts: 1340
  • Cookies: 65535
Re: random question about torpedo splitting
« Reply #18 on: May 01, 2018, 03:51:29 PM »
Mine was manually. Afaik I have no idea how to apply plasma tech and Split torpedo script tech via BCUT. My BCUT is version 1.8.1.0
It's easy in BCUT.  Just go to the BC Tools button and select "Torpedo Tech Creator" from the menu.  You'll be able to select the torpedo you want to add tech to and which tech you want to add from the menus there.

Offline Flowrellik

  • Posts: 154
  • Cookies: 7
Re: random question about torpedo splitting
« Reply #19 on: May 01, 2018, 06:40:34 PM »
That's the thing Morgan. That split torpedo tech is not there on mine :V