Author Topic: Torpedo Modding Guide  (Read 780 times)

Offline Wintersfrost

  • Posts: 42
  • Cookies: 1
Torpedo Modding Guide
« on: July 23, 2020, 06:02:31 PM »
There used to be a torpedo modding guide. I tried looking for it on here and Gamefront but was unable to locate it. Does anyone have a copy they can post here?

Offline vonfrank

  • Posts: 447
  • Cookies: 182
Re: Torpedo Modding Guide
« Reply #1 on: July 23, 2020, 06:37:37 PM »
I have this torpedo guide saved from quite a while ago:

Quote
Ok, I thought id make this quick guide on how to modify a torpedo since quite a few people dont know how to do this...I will assume that you know what a script is and the basic structure of Bridge Commander...

1) Opening the Script
Go into scripts/Tactical/Projectiles and open up PhotonTorpedo.py OR open up the file included with this guide using a text editor such as WORDPAD.

http://www.universeatwar.org/dgproductions/files/Dragon/PhotonTorpedo.py

2) Torpedo Structure
Torpedoes are usually made up of 3 layers:

Core = The central part of the torpedo.
Glow = A pulsating glow which eminates from the core.
Flare = Small strands which emerge from the core outwards

You can see these parts on the picture below...


IMPORTANT NOTE: The core texture is the one which determines the flares. BC does not allow for seperate flare textures.

3) Editing the Colours

The first section of the script deals with the colours of the torpedo. The Core, Glow and Flare colour...


Quote
   kCoreColor = App.TGColorA()
   kCoreColor.SetRGBA(255.0 / 255.0, 255.0 / 255.0, 128.0 / 255.0, 1.000000)
   kGlowColor = App.TGColorA()
   kGlowColor.SetRGBA(255.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 1.000000)
   kFlareColor = App.TGColorA()
   kFlareColor.SetRGBA(255.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 1.000000)


Each of the layers contains the following information:

Quote
SetRGBA(255.0 / 255.0, 255.0 / 255.0, 128.0 / 255.0, 1.000000)


RGBA = Red, Green, Blue, Alpha

In order to edit the colours of each layer, simply edit the values to increase or decrease the RGB (Red, Green, Blue) to create a specific mixture of colours...make sure that you edit each of these in the following way...

For example, if you wanted to make the core of the torpedo to be very RED, you simply increase the value for the red and decrease the value of the other colours accordingly...


Quote
SetRGBA(855.0 / 255.0, 20.0 / 255.0, 20.0 / 255.0, 1.000000)


Please note: only edit the value before the "/". e.g. 855.0 / 255.0 and leave the 255.0 as it is. (im not sure what this does exactly)

Now you can edit the colour of the torpedo for the 3 layers. Remember that for the Core, Glow and Flare the same rules apply, as can be seen below...


Quote
   kCoreColor = App.TGColorA()
   kCoreColor.SetRGBA(255.0 / 255.0, 255.0 / 255.0, 128.0 / 255.0, 1.000000)
   kGlowColor = App.TGColorA()
   kGlowColor.SetRGBA(255.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 1.000000)
   kFlareColor = App.TGColorA()
   kFlareColor.SetRGBA(255.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 1.000000)


The ALPHA values simply refer to the transparency of that colour...so a high ALPHA means that the colour is less visable and more transparent...simply experement with these values...

4) Editing the physical makup

The next part of the script deals with the physical makeup of the torpedo, from the amount of flares, to the speed of the glow pulse...I will simply explain what each of the values refer to...
You will see something like this:


Quote
pTorp.CreateTorpedoModel(
               "data/Textures/Tactical/TorpedoCore.tga",
               kCoreColor,
               0.115,
               6.0,   
               "data/Textures/Tactical/TorpedoGlow.tga",
               kGlowColor,
               1.0,   
               0.2,   
               0.3,   
               "data/Textures/Tactical/TorpedoFlares.tga",
               kFlareColor,                             
               42,     
               0.42,     
               0.1)


The first thing to note is that as I have said previously, there are 3 parts to every torpedo (Core, Glow and Flares)
However each of these layers are first determined by a texture file which is stored in the following filepath within bridge commander.

data\Textures\Tactical

This guide is not concerned with these textures, however it might be useful to open them to see what they look like inside to help to form the torpedo you want...

One of the first lines of this section looks like this


Quote
"data/Textures/Tactical/TorpedoCore.tga",


As you can see this determines the texture file which is used for the torpedo CORE.


Quote
"data/Textures/Tactical/TorpedoGlow.tga",


Torpedo glow...

Quote

"data/Textures/Tactical/TorpedoFlares.tga",


And torpedo flares...

In order to change the textures for each of these parts, simply rename the texture file that you wish like below...


Quote
"data/Textures/Tactical/DragonsFlares.tga",


Make sure you keep the .tga at the end, because this is the format of the texture files...

In order to simplify this guide and to avoid explaining each value that you must change, I will list what each of the values mean for this section...


Quote
"data/Textures/Tactical/TorpedoCore.tga", = Core Texture File
               kCoreColor,
               0.115, = The Scale of the core in relation the the rest of the torpedo. (Larger = Bigger Core)
               6.0, = The rate at which the torpedo rotates ingame. This affects flares and how fast the rotate(Larger = Faster)               

"data/Textures/Tactical/TorpedoGlow.tga", = Glow Texture File
               kGlowColor,
               1.0, = Specifies the rate at which the glow will pulsate. (Larger = Faster Pulse)   
               0.2, = The Minimum size of the glow. (Larger=Bigger Glow)
               0.3, = The Maximum size of the glow. (Determines how much the glow will increase from the minimum size to the large size)   
               
"data/Textures/Tactical/TorpedoFlares.tga", = Flare Texture File
               kFlareColor,                             
               42, = The Maximum number of flares that spawn from the core. (Larger = More Flares)     
               0.42, = The length of the individual flares. (Larger = Longer Flares)     
               0.1) = The amount of time that the flares will last until they spawn again elsewhere. (Larger = Longer Existence)


Ok, you have now just configured how the torpedo will behave ingame...but remember that this section is a matter of trial and error...Now we will move onto properties ot the torpedo, or as you might consider, the Tactical Data...

5) Configuring the Tactical Data

The following code is what you will see now or similar


Quote
pTorp.SetDamage( GetDamage() )
   pTorp.SetDamageRadiusFactor(0.15)
   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)


There are only two things which need to be edited here...

a) This line determines the radius area effect of the torpedo. It will affect the visual ship damage ingame and the radius surrounding the impact zone.


Quote
pTorp.SetDamageRadiusFactor(0.15)


The 0.15 can be changed to increase or decrease the radius of the torpedoes impact...Increasing the value increases the radius, and Visa Versa.

b) This next line is a little more complicated and is becomming more utilised in advanced technologies (which I wont/cant explain here)


Quote
pTorp.SetNetType (Multiplayer.SpeciesToTorp.PHOTON)


The best way to put it is that this line determines the TYPE of torpedo that you wish to create...the only word that requires changing is the one underlined and it also must be kept in capitals...Since im unsure of ALL the types of Stock torpedoes and their effects, I will simply list the ones in which you can choose to use...just change the word accordingly...

The torpedoes that are present within the stock BC are as follows:

* ANTIMATTER
* CARDASSIANDISRUPTOR
* CARDTORP
* DISRUPTOR
* FUSIONBOLT
* KESSOKDISRUPTOR
* KLINGONTORP
* PHASEDPLASMA
* PHOTON
* POSITRON
* PULSEDISRUPT
* QUANTUM

Im not certain of the effects of each type of weapon. but make sure the name is entered correctly...

The next section is quite simple and sets up the speed, damage and sound for the torpedo...Simply edit the values as you desire to set up your torpedoes ingame abilities...


Quote
def GetLaunchSpeed():
   return(50.0) = Determines the speed that the torpedo is launched, higher values equal faster speed.

def GetLaunchSound():
   return("Photon Torpedo") = Determines the SFX that is played when the torpedo is launched. This is set up using sound plugins and is NOT the name of the SFX file itself...

def GetPowerCost():
   return(5.0) = Determines the power that is used by the torpedo. This applies mainly to disruptors or pulse weapons and is not used for Torpedoes unless they are pulse torps. Higher values means that the weapon uses more power.

def GetName():
   return("Photon Torpedo") = Determines the name of the torpedo that appears ingame.

def GetDamage():
   return 600.0 = Determines the damage that the torpedo does per hit. Higher values cause more damage to shields and hull.

def GetGuidanceLifetime():
   return 6.0 = Determines how long the torpedo exists once it has been fired. I think this is in seconds?

def GetMaxAngularAccel():
   return 2.5 = Determines the speed in which the torpedo can turn to track its target. Higher values mean that the torpedo can maneuver more efficiently.


Thats everything for now, i hope that this will help alot of people to modify their own torpedoes...Now when your torpedo is ready, make sure you rename it to a unique name, remember that Photon Torpedo is already used, so if you want it as a unique weapon, rename it to something new. We (D&G Productions) always put a DG tag before all of our weapons...

Ive told you how to set up a torpedo, now all there remains to do is to add the torpedo to a ship. In order to do that, you will need to add it using the MPE...I wont explain how to do that here now.

One final issue to mention. All scripts within BC can be edited in their .PY state, however once they are loaded ingame a .PYC is created. Make sure you delete this each time you edit the .PY as a precaution...

If you have any questions please ask away...

Dragon

Thanks to Durandals guide which helped me out alot...

Offline Wintersfrost

  • Posts: 42
  • Cookies: 1
Re: Torpedo Modding Guide
« Reply #2 on: July 23, 2020, 07:18:01 PM »
Yeah, that's the one I'm lookin for. Thanks a million!  :)

Offline Digital_Clarity

  • Posts: 82
  • Cookies: 3
Re: Torpedo Modding Guide
« Reply #3 on: March 05, 2021, 08:52:16 PM »
Could we get this stickied for reference?

Cheers,

Digital (Wintersfrost)