Author Topic: Auto-Eject Warp Core  (Read 717 times)

Offline JB2005

  • Scripter, Lawyer, Soldier, Spy
  • Posts: 197
  • Cookies: 58
    • Captain's Orders Blog
Auto-Eject Warp Core
« 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:

Code: [Select]
###############################################################################
# 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!
http://captainsordersdevelopmentblog.blogspot.com/2011/12/preview-no-1.html- Captains Orders Development Blog - Last Updated 10/12/2011

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: Auto-Eject Warp Core
« Reply #1 on: September 26, 2021, 07:04:29 PM »
How very cool!!
Good to see ya around here again  😁

Offline Blackrook32

  • BC Files Admin
  • Vice Administrator
  • Posts: 561
  • Cookies: 1077
    • Blackrook32's YouTube Channel
Re: Auto-Eject Warp Core
« Reply #2 on: September 26, 2021, 09:31:15 PM »
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:


" Fortune Favors the Bold "

Offline Nebula

  • BC elder / BCC Vice Admin
  • Administrator
  • Posts: 5499
  • Cookies: 1129
  • KM - Mod Team Member & BC - Elder (2002)
    • 9th fleet HQ
Re: Auto-Eject Warp Core
« Reply #3 on: September 27, 2021, 12:33:11 AM »
oooh Welcome back and with such a nice addition to boot!
Canon is what people argue exists on ships that don't exist.

Offline ACES_HIGH

  • BCC Roleplay Game Narrator
  • Moderator
  • Posts: 1678
  • Cookies: 54
  • while(!(succeed=try()));
    • BCC Roleplay Games
Re: Auto-Eject Warp Core
« Reply #4 on: September 27, 2021, 03:10:17 PM »
it should have like a 75% chance of the ejection system being offline.  :wink:

Offline JB2005

  • Scripter, Lawyer, Soldier, Spy
  • Posts: 197
  • Cookies: 58
    • Captain's Orders Blog
Re: Auto-Eject Warp Core
« Reply #5 on: September 27, 2021, 03:45:29 PM »
Thanks for the feedback :)

Another one, along the same lines:

Code: [Select]
###############################################################################
# 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!
http://captainsordersdevelopmentblog.blogspot.com/2011/12/preview-no-1.html- Captains Orders Development Blog - Last Updated 10/12/2011

Offline Haxxor1337

  • Posts: 83
  • Cookies: 11
    • .~*BC - Galaxy*~.
Re: Auto-Eject Warp Core
« Reply #6 on: October 01, 2021, 02:13:33 AM »
Thank you :) Welcome back  :yay: