Bridge Commander Central
BC Forums => BC Scripting => Topic started 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.
-
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:
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:
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:
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')
-
would it work to find out the SetOuterCoreColor for a customized shield glow , now i am wondering why it wasn't done again
-
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.
-
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 .