Bridge Commander Central

BC Forums => BC Scripting => Topic started by: vonfrank on November 29, 2009, 04:50:26 PM

Title: Borg Shield Drain Torpedoes
Post by: vonfrank on November 29, 2009, 04:50:26 PM
I was wanting to make the Borg torpedoes that you see in "Q Who" that drain shields overall but do no dammage to the hull.
The torpedoes would have to drain all shield vectors evenly by a certain ammount no matter what vector they hit.
Is this possible, and how would i go about scripting it?
Title: Re: Borg Shield Drain Torpedoes
Post by: Worf359Alpha on November 29, 2009, 08:14:04 PM
Here try this one its the same one i use, and it does all that you requested, just paste it over one of your own Borg torps. I did not make it and ive forgoten who did, but props to them, cheers.


###############################################################################
#   Filename:   STFCBorgTorp.py
#   
#   Confidential and Proprietary, Copyright 2000 by Totally Games
#   
#   Script for filling in the attributes of DGPulsarTorp torpedoes.
#   
#   Created:   7/21/05 -   Sonc14
###############################################################################

import App

###############################################################################
#   Create(pTorp)
#   
#   Creates a STFCBorgTorp torpedo.
#   
#   Args:   pTorp - the torpedo, ready to be filled-in
#   
#   Return:   zero
###############################################################################
def Create(pTorp):
   kCoreColor = App.TGColorA()
   kCoreColor.SetRGBA(255.0 / 255.0, 300.0 / 255.0, 255.0 / 255.0, 1.000000)
   kGlowColor = App.TGColorA()
   kGlowColor.SetRGBA(149.0 / 255.0, 192.0 / 255.0, 76.0 / 255.0, 1.000000)
   kFlareColor = App.TGColorA()
   kFlareColor.SetRGBA(149.0 / 255.0, 192.0 / 255.0, 76.0 / 255.0, 1.000000)   

   pTorp.CreateTorpedoModel(
               "data/Textures/Tactical/TorpedoCore.tga",
               kCoreColor,
               0.100,
               1.0,   
               "data/Textures/Tactical/TorpedoGlow.tga",
               kGlowColor,
               1.0,   
               0.5,   
               0.6,   
               "data/Textures/Tactical/TorpedoFlares.tga",
               kFlareColor,                              
               60,      
               0.4,      
               0.10)

   pTorp.SetDamage( GetDamage() )
   pTorp.SetDamageRadiusFactor(0.10)
   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.PHOTON)

   return(0)

def GetLaunchSpeed():
   return(45.0)

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

def GetPowerCost():
   return(5.0)

def GetName():
   return("Sheild Drainer")

def GetDamage():
   return 100.0

def GetGuidanceLifetime():
   return 14.0

def GetMaxAngularAccel():
   return 0.15

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

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

def TargetHit(pObject, pEvent):
   pTarget=App.ShipClass_Cast(pEvent.GetDestination())
   MinYield=GetMinDamage()
   Percentage=GetPercentage()
   pShields = pTarget.GetShields()
   for ShieldDir in range(App.ShieldClass.NUM_SHIELDS):
      pShieldStatus=pShields.GetCurShields(ShieldDir)
      pShieldChunk=pShields.GetMaxShields(ShieldDir)*Percentage
      if (MinYield>pShieldChunk):
         pShieldChunk=MinYield
      if (pShieldStatus<=pShieldChunk):
         pShieldStatus=0
      pShields.SetCurShields(ShieldDir,pShieldStatus-pShieldChunk)
   return

def WeaponFired(pObject, pEvent):
   return
Title: Re: Borg Shield Drain Torpedoes
Post by: vonfrank on November 29, 2009, 10:17:42 PM
there must be another script in your install somewhere that makes it work properly, because for me, it just acts like a regular torpedo
Title: Re: Borg Shield Drain Torpedoes
Post by: teleguy on November 30, 2009, 05:00:21 AM
That torpedo is part of FTA.
http://bridgecommander.filefront.com/file/Future_Technologies_2;31845
Title: Re: Borg Shield Drain Torpedoes
Post by: X_TheUnknown_X on November 30, 2009, 01:31:37 PM
For draining torpedoes, Glenflet created Realistic Technologies mod which work really well IMO. The advantage with RealTech is that to add abilities such as draining and phasing, it just takes two lines of code. Also, if you set it up right, you can control exactly how much you want the shields drained by (by % of current, damage hitpoints, etc.)

The only downsides are that it's tricky to install (Realtech 1.1 has bugs, so patch 1.1.9 must be installed), and the 1.2 version doesn't work at all. Also, not many others use Realtech, so if it's a mod you're planning - the Furture Technologies pack is probably better.

http://bridgecommander.filefront.com/file/Realistic_Technology_11;87144 (http://bridgecommander.filefront.com/file/Realistic_Technology_11;87144)
and patch..
http://bridgecommander.filefront.com/file/Realistic_Technology_11_Patch_9;88203 (http://bridgecommander.filefront.com/file/Realistic_Technology_11_Patch_9;88203)
Title: Re: Borg Shield Drain Torpedoes
Post by: vonfrank on November 30, 2009, 03:23:45 PM
I have KM1.0 installed in my game, so do i stll need to download Future Tech? Or is it a prat of KM?
Title: Re: Borg Shield Drain Torpedoes/Phased Torpedoes
Post by: vonfrank on November 30, 2009, 08:14:01 PM
OK. I downloaded it anyway because i noticed that one of the files in KM was purposely removed so i added it back again and that made it work.

but now i have a problem with the phased torpedo that comes with Future tech. They do an incredible ammount of dammage! they kill EVERYTHING in one hit!?!? is there some way to fix this?
Title: Re: Borg Shield Drain Torpedoes
Post by: teleguy on December 01, 2009, 06:53:05 AM
The damage the torpedo does is determined by the number behind def GetYield():.
Title: Re: Borg Shield Drain Torpedoes
Post by: vonfrank on December 01, 2009, 12:29:03 PM
i have tried to alter that, even to as low as 100, but it still kills anything instantly
Title: Re: Borg Shield Drain Torpedoes
Post by: teleguy on December 01, 2009, 12:46:07 PM
Did you change the GetDamage value?
Title: Re: Borg Shield Drain Torpedoes
Post by: Dalek on December 01, 2009, 02:46:05 PM
Yes, it is the GetDamage that gives the actual payload of the torpedo. I didn't even know there was a GetYield part.
Title: Re: Borg Shield Drain Torpedoes
Post by: USS Frontier on December 01, 2009, 03:32:55 PM
shameless self-advertising...

The EMP Torpedo tech from this little pack (http://bridgecommander.filefront.com/file/Frontiers_Tech_Pack;101079), can do that easily.

Just set up the torpedo to give a very low damage or none at all (the GetDamage part).
And besides that, the EMP options: chance set to 100%, and the % you want drained from the shields.
Title: Re: Borg Shield Drain Torpedoes
Post by: teleguy on December 01, 2009, 05:24:24 PM
Yes, it is the GetDamage that gives the actual payload of the torpedo. I didn't even know there was a GetYield part.

In the case of  FTAs Phased Torpedo GetDamage is supposed to be very low so the shields are not affected. GetYield is the damage that gets translated through the shields.
Title: Re: Borg Shield Drain Torpedoes
Post by: vonfrank on December 01, 2009, 05:30:44 PM
here is the exact file contents

###############################################################################
#   Filename:   PhasedTorp.py
#   By:      edtheborg
###############################################################################
# This torpedo uses my script torpedo mod...
#
# it actually passes through shields and damages the hull of any vessel
# this torpedo also demonstrates how to use the script torpedo mod
#
# please refer to the TargetHit routine at the very bottom of this file
# as this illustrates how to use a custom script for a torpedo
###############################################################################

import App

###############################################################################
#   Args:   pTorp - the torpedo, ready to be filled-in
#   
#   Return:   zero
###############################################################################
def Create(pTorp):
   kCoreColor = App.TGColorA()
   kCoreColor.SetRGBA(240.0 / 255.0, 0.0 / 255.0, 15.0 / 255.0, 1.000000)
   kGlowColor = App.TGColorA()
   kGlowColor.SetRGBA(100.0 / 255.0, 40.0 / 255.0, 40.0 / 255.0, 1.000000)
   kFlareColor = App.TGColorA()
   kFlareColor.SetRGBA(80.0 / 255.0, 60.0 / 255.0, 70.0 / 255.0, 1.000000)      

   pTorp.CreateTorpedoModel(
               "data/Textures/Tactical/TorpedoCore.tga",
               kCoreColor,
               0.2,
               1.0,   
               "data/Textures/Tactical/TorpedoGlow.tga",
               kGlowColor,
               4.0,   
               0.2,   
               0.7,   
               "data/Textures/Tactical/TorpedoFlares.tga",
               kFlareColor,                              
               6,      
               0.7,      
               0.4)

   pTorp.SetDamage( GetDamage() )
   pTorp.SetDamageRadiusFactor(0.1)
   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(50)

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

def GetPowerCost():
   return(40.0)

def GetName():
   return("Phased Plasma")

def GetDamage():
   return 0.00001

def GetGuidanceLifetime():
   return 6.0

def GetMaxAngularAccel():
   return 0.3

# sets the damage the torpedo does to the hull
def GetYield():
   return 100

def TargetHit(pObject, pEvent):
   pTarget=App.ShipClass_Cast(pEvent.GetDestination())
   Yield=GetYield
   pHull = pTarget.GetHull()
   if (pHull==None):
      return
   if (pHull.GetCondition()>Yield):
      pHull.SetCondition(pHull.GetCondition()-Yield)
      return
   pTarget.DestroySystem(pHull)
   return




As you can see, the "GetYield" is set to 100. The torpedo still kills anything in one hit?!?!?
Title: Re: Borg Shield Drain Torpedoes
Post by: teleguy on December 01, 2009, 05:49:52 PM
Try

Code: [Select]
###############################################################################
#   Filename:   PhasedTorp.py
#   By:      edtheborg
###############################################################################
# This torpedo uses my script torpedo mod...
#
# it actually passes through shields and damages the hull of any vessel
# this torpedo also demonstrates how to use the script torpedo mod
#
# please refer to the TargetHit routine at the very bottom of this file
# as this illustrates how to use a custom script for a torpedo
###############################################################################

import App

###############################################################################
#   Args:   pTorp - the torpedo, ready to be filled-in
#  
#   Return:   zero
###############################################################################
def Create(pTorp):
   kCoreColor = App.TGColorA()
   kCoreColor.SetRGBA(240.0 / 255.0, 0.0 / 255.0, 15.0 / 255.0, 1.000000)
   kGlowColor = App.TGColorA()
   kGlowColor.SetRGBA(100.0 / 255.0, 40.0 / 255.0, 40.0 / 255.0, 1.000000)
   kFlareColor = App.TGColorA()
   kFlareColor.SetRGBA(80.0 / 255.0, 60.0 / 255.0, 70.0 / 255.0, 1.000000)      

   pTorp.CreateTorpedoModel(
               "data/Textures/Tactical/TorpedoCore.tga",
               kCoreColor,
               0.2,
               1.0,  
               "data/Textures/Tactical/TorpedoGlow.tga",
               kGlowColor,
               4.0,  
               0.2,  
               0.7,  
               "data/Textures/Tactical/TorpedoFlares.tga",
               kFlareColor,                              
               6,      
               0.7,      
               0.4)

   pTorp.SetDamage( GetDamage() )
   pTorp.SetDamageRadiusFactor(0.1)
   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(50)

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

def GetPowerCost():
   return(40.0)

def GetName():
   return("Phased Plasma")

def GetDamage():
   return 0.00001

def GetGuidanceLifetime():
   return 6.0

def GetMaxAngularAccel():
   return 0.3

# sets the damage the torpedo does to the hull
def GetYield():
   return 100

def TargetHit(pObject, pEvent):
   pTarget=App.ShipClass_Cast(pEvent.GetDestination())
   Yield=GetYield
   pHull = pTarget.GetHull()
   if (pHull==None):
      return
   elif (pHull.GetCondition()>Yield):
      pHull.SetCondition(pHull.GetCondition()-Yield)
      return
   else:
      pTarget.DestroySystem(pHull)
   return
Title: Re: Borg Shield Drain Torpedoes
Post by: vonfrank on December 01, 2009, 10:05:36 PM
it still does an unlimited ammount of dammage  :(
Title: Re: Borg Shield Drain Torpedoes
Post by: jayce on December 09, 2009, 05:47:45 AM
if im reading that script correctly, the getyield = 100 means that the hull will take damage equal to 100% of hull status. a single hit from that torpedo will bring any maximum intergity hull to 0%. if the ship wasn't destroyed on impact from the torpedo, the slightest breeze would be enough to finish it off.

try changing the 100 to 10 = should take 10 hits to destroy
try changing the 100 to 1 = should take 100 hits to destroy

it probably wouldn't hurt to slow the speed of the torpedo down a bit. 50 is quite fast and does have an impact on damage.
Title: Re: Borg Shield Drain Torpedoes
Post by: vonfrank on December 28, 2009, 09:55:28 PM
It's not that, 10 and even 1 for that value still kills it in one hit

besides, i would really like a dammage value not a percentage
Title: Re: Borg Shield Drain Torpedoes
Post by: jayce on January 01, 2010, 03:54:28 PM
Sorry, I was thinking of one of my old script tweaks with a simlar problem. But clearly, damage values are not working as you intend. The first thing you have to do is make sure your target is still standing after just one hit. You want to start out small and go from there. Pecentages does just that, ensuring that you don't overshoot your mark. Try this (included with # comment notes):

Code: [Select]
# sets the damage the torpedo does to the hull
def GetYield():
return 0.5 # Value = 50 Percent/50%

def TargetHit(pObject, pEvent):
pTarget=App.ShipClass_Cast(pEvent.GetDestination())
Yield=GetYield # Returns the same value as above as we will be using Yield from this point on in the equations and not GetYield.
pHull = pTarget.GetHull()
if (pHull==None):
return
if (pHull.GetCondition()>Yield): # Lets say Hull Condition is (3416), which is greater than>0.5 as a number in this case, not a %
pHull.SetCondition(pHull.GetCondition()*Yield) # Changes Hull Condition (Hull Condition (3416)*0.5 = 1708)
return
pTarget.DestroySystem(pHull)
return

Since the script is always looking for the hull's current condition value, any hit with this torpedo should set the hull's new condition value, decreasing it by 50 percent for each hit. This script alone should not "1 shot" the targets. If your targets are still dropping after just one hit, then we may need to change the script so that it will look to the hull's maximum condition instead of its current condition.
Title: Re: Borg Shield Drain Torpedoes
Post by: El on January 02, 2010, 11:25:51 AM
shameless self-advertising...

The EMP Torpedo tech from this little pack (http://bridgecommander.filefront.com/file/Frontiers_Tech_Pack;101079), can do that easily.

Just set up the torpedo to give a very low damage or none at all (the GetDamage part).
And besides that, the EMP options: chance set to 100%, and the % you want drained from the shields.

This looks to be the solution the OP was looking for.