Bridge Commander Central

BC Forums => BC Scripting => Topic started by: webxro on August 23, 2010, 01:06:11 PM

Title: Weapon proprieties
Post by: webxro on August 23, 2010, 01:06:11 PM
Hy i'm working on a shield upgrade , now does anyone know a way to get the proprieties of the weapon that's hitting my shield , and explain simple , i'm new to python , but i know well AS3 and PHP.
Title: Re: Weapon proprieties
Post by: teleguy on August 23, 2010, 02:24:07 PM
I recently did this for a script. I used FTechs "OnDefense" which is called every time a ship is hit. You can get more info about it from the readme that comes with FTech.


Your script would then look like this:

Ftech stuff:
Code: [Select]
class ShieldtechDef(FoundationTech.TechDef):
        def OnDefense(self, pShip, pInstance, oYield, pEvent):

                if oYield:
                        if oYield.IsPhaseYield() or oYield.IsDrainYield():
                                return

Code to get the weapon properties:
Code: [Select]
                pWeapon = App.Weapon_Cast(pEvent.GetSource())

pWeapon.GetRechargeRate()
pWeapon.GetNormalDischargeRate()
pWeapon.GetMaxCharge()
pWeapon.GetMinFiringCharge()
pWeapon.GetFireSound()
pWeapon.GetFireStartSound()
pWeapon.GetFireLoopSound()
pWeapon.GetPowerSetting()
pWeapon.GetMaxDamage()
pWeapon.GetMaxDamageDistance()
pWeapon.GetChargeLevel()
pWeapon.GetChargePercentage()

more Ftech stuff:

Code: [Select]
        def OnBeamDefense(self, pShip, pInstance, oYield, pEvent):
                return self.OnDefense(pShip, pInstance, oYield, pEvent)

        def OnPulseDefense(self, pShip, pInstance, pTorp, oYield, pEvent):
                return self.OnDefense(pShip, pInstance, oYield, pEvent)

        def OnTorpDefense(self, pShip, pInstance, pTorp, oYield, pEvent):
                return self.OnDefense(pShip, pInstance, oYield, pEvent)

        def Attach(self, pInstance):
                pInstance.lTechs.append(self)
                pInstance.lTorpDefense.insert(0, self)
                pInstance.lPulseDefense.insert(0, self)
                pInstance.lBeamDefense.insert(0, self)


oShieldtech = ShieldtechDef('Shieldtech')






Title: Re: Weapon proprieties
Post by: webxro on August 23, 2010, 04:18:27 PM
would it work to find out the SetOuterCoreColor for a customized  shield glow , now i am wondering why it wasn't done again
Title: Re: Weapon proprieties
Post by: teleguy on August 23, 2010, 04:29:28 PM
For a phaser use pWeapon.GetOuterCoreColor() but I don't know if it's possible to change the shield glow color on the fly. BC treats some parts of the hardpoint pretty inflexibly I've been told.
Title: Re: Weapon proprieties
Post by: webxro on August 24, 2010, 06:34:58 AM
Thanks i will try that , when i have time , for the torpedo i think that i found a think in Ftech to do the job .