Bridge Commander Central
BC Forums => BC Scripting => Topic started by: JB2005 on September 26, 2021, 04:51:19 PM
-
Hi All!
Long time no speak! With GOG re-releasing BC, I've been playing through the game again, and earlier this afternoon had an idea for a little script to protect the ship, before a Core Breach can destroy the ship:
###############################################################################
# Filename: CoreEjectAuto.py
#
# Neither Confidential nor Proprietary, Apologies to Totally Games!
#
# Gives Brex Agency to eject the Warp Core if the damage level reaches
# 95%
#
# Created: 26/09/21 - JB2005
###############################################################################
import Lib.LibEngineering
import Custom.Sneaker.CoreEject.SneakerCoreMenuHandlers
import App
import MissionLib
pButton = None
def init():
global pButton
pButton = Lib.LibEngineering.CreateMenuButton("Eject Core", "Engineer", __name__ + ".Eject")
pButton.SetChoosable(1)
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_WEAPON_HIT, MissionLib.GetMission(), __name__ + ".EjectAuto")
def Eject(pObject, pEvent):
global pButton
print pButton.IsChosen()
if pButton.IsChosen() == 0:
pButton.SetChosen(1)
return 0
if pButton.IsChosen() == 1:
pButton.SetChosen(0)
return 0
def EjectAuto(pObject, pEvent):
pGame = App.Game_GetCurrentGame()
pPlayer = pGame.GetPlayer()
pPlayerPower = pPlayer.GetPowerSubsystem()
pLevel = pPlayerPower.GetCondition() / pPlayerPower.GetMaxCondition()
print(pLevel)
if pLevel > 0.05:
return
if pButton.IsChosen() == 0:
return
Custom.Sneaker.CoreEject.SneakerCoreMenuHandlers.CoreEject(pObject, pEvent)
It requires Sneaker 98's Core Eject Mod to work, and the file just drops into the QBAutostart folder!
-
How very cool!!
Good to see ya around here again 😁
-
How very cool!!
Good to see ya around here again 😁
Agreed! Very interesting script, JB. Definitely adding this to my install! :D
Assimilated and cookied :thumbsup:
-
oooh Welcome back and with such a nice addition to boot!
-
it should have like a 75% chance of the ejection system being offline. :wink:
-
Thanks for the feedback :)
Another one, along the same lines:
###############################################################################
# Filename: AbandonShipAuto.py
#
# Neither Confidential nor Proprietary, Apologies to Totally Games!
#
# Gives Saffi agency to evacuate the ship if the Hull Damage Level reaches
# 95%
#
# Created: 26/09/21 - JB2005
###############################################################################
import Lib.LibEngineering
import Custom.Sneaker.CoreEject.SneakerCoreMenuHandlers
import App
import MissionLib
pButton = None
def init():
global pButton
pButton = Lib.LibEngineering.CreateMenuButton("Auto Abandon Ship", "XO", __name__ + ".Abandon")
pButton.SetChoosable(1)
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_WEAPON_HIT, MissionLib.GetMission(), __name__ + ".AbandonAuto")
def Abandon(pObject, pEvent):
global pButton
print pButton.IsChosen()
if pButton.IsChosen() == 0:
pButton.SetChosen(1)
return 0
if pButton.IsChosen() == 1:
pButton.SetChosen(0)
return 0
def AbandonAuto(pObject, pEvent):
pGame = App.Game_GetCurrentGame()
pPlayer = pGame.GetPlayer()
pHullLevel = pPlayer.GetHull()
pLevel = pHullLevel.GetCondition() / pHullLevel.GetMaxCondition()
Abandon_Ship = __import__("Abandon Ship")
print(pLevel)
if pLevel > 0.05:
return
if pButton.IsChosen() == 0:
return
Abandon_Ship.StartAbandonShip(pObject, pEvent)
Triggers the Abandon Ship Mod if the hull reaches 95% damage.
I tested this one by loading a quick battle game and just sat stationary with the shields off whilst another ship attacked me - luckily I had the Auto-Eject button on, because the AI decided to target the Warp Core!
-
Thank you :) Welcome back :yay: