Bridge Commander Central
BC Forums => BC Scripting => Topic started by: FekLeyr Targ on December 28, 2018, 04:30:29 PM
-
Hello friends,
after reading a few stories about Starfleet ships temporarily being out of control due to damage to the bridge, I have been wondering: Wouldn't it be interesting to have such a feature in Bridge Commander?
A python script could track the status of a ship's "bridge" subsystem and perhabs override the "critical" flag if set to "1".
Once the bridge is critically damaged or destroyed, the ship temporarily loses control by ceasing fire and keeping its current speed and course. After a random amount of time (e.g. 90-240 seconds), the crew manages to reroute ship control to auxillary control or engineering and the ship returns to its previous AI behavior.
What do you think about this idea?
-
I found a script guy that might be able to do that. AND he'd be able to do it without the crash errors, i think.
-
I found a script guy that might be able to do that. AND he'd be able to do it without the crash errors, i think.
That's sounds great. I'm looking forward to see what he can do. :)
-
found the guy on a Discord server, believe it or not. i sent him a sample script that constantly crashes on me to look at, and apparently a lot of script errors are tabs being replaced with spaces.
-
found the guy on a Discord server, believe it or not. i sent him a sample script that constantly crashes on me to look at, and apparently a lot of script errors are tabs being replaced with spaces.
Sorry for the off topic:
Maybe you should let him look at NanoFX and see if he can get the save function working for SP :funny
-
actually, not as far-fetched as you think. the sample I sent him was FROM Nano! I was having the same three scripts go kaput al the time, so I saved a set in case of corruption for repairs.
-
Doooooooooooood! :bigdance
-
i am so bumping this for updates...
-
I've started a separate thread for the repair topic. please see there for updates.
-
please link that thread here so i can merge the two :)
-
please link that thread here so i can merge the two :)
Certainly:
http://www.bc-central.net/forums/index.php/topic,10581.0.html
Back on topic:
What do you guys think about my idea with the destroyed bridge?
-
lol. and I pulled mine to keep this thread consistent.
frankly, I like the idea.
-
i thought both threads were on the same topic, before reading them...
nvm...
-
This should be fairly simple to do.
First the Bridge subsystem needs to be called, and health status needs to be assessed. A trigger then should be setup, such as when the Bridge subsystem falls below a certain value, or base it upon the disabled percentage of the subsystem (every ship bridge may have differing disability values). Then a check for if the Bridge subsystem is not online or is offline or is < or = to disabled percentage, shut off the impulse subsystem and add a hulk rotation (similar to what happens when ships explode) for x amount of time, or until Bridge subsystem health status is > disabled percentage. I personally would add a buff to the disability, maybe an extra 10 seconds after Bridge health rises above the disabled percentage, as sort of a feature of the helmsman actually working the console to regain control of the ship. It should work with minimal scripting. I could probably write it up in a week if I worked on it for an hour each night. :)
Update: The problem I have encountered early on (within first 15 minutes) is that many of the ship hardpoints do not contain a targetable bridge, and it does not seem to count as a subsystem property (unless I am mistaken and there is a subsystem property, I have not found it). So either we create a new subsystem set for bridges and give it some function (probably exe based, so would be hard) or add a targetable bridge hardpoint to all ship hardpoints (easier). However, I fear it may need both to work (hardest). Though I believe we could steal some stuff from the shuttle launching framework since we can target and affect shuttlebays and shuttle launching via weapon impacts, I believe we can do the same for bridges. In which case it would be on the easier side, only really needing to fetch the disabled percentages and include some code to cut off the engines and spin the hulk. For now, I will see if I can get this feature to work when knocking a shuttlebay offline. If I can do that, its just a matter of copy-pasta, and renaming stuff to avoid conflicts.
-
Bridges are usually 'Hull' properties, (mostly set as 'critical') and I would keep it that way, personally.
Maybe adding the affected bridges' names as another ftech (or dtech or what those were called) in the ship's plugin might be better.
That way, whether destryoing the 'bridge' (or central,or cic,or borg-001 or whatever) destroys the ship or sends it spinning would be a user/ modder choice rather than a single fixed behaviour for all.
-
What do you think about this idea?
I like. Open a feature request on DS9FX github pls. I'll add it once I get an opportunity.
-
I like. Open a feature request on DS9FX github pls. I'll add it once I get an opportunity.
Sweet, this means I don't have to do it :funny It's probably better I don't do it because I tend to mess shit up when I do new and experimental things lol
-
The best way to do that is to set the bridge to "not critical" so that the game engine does not automatically destroy the spaceship and then program its own handler, which in this case becomes active.
-
I like. Open a feature request on DS9FX github pls. I'll add it once I get an opportunity.
Done. Sorry for taking so long to do this. :)
-
from bcdebug import debug
import App
import MissionLib
def SetupEventHandlers():
debug(__name__ + ", SetupEventHandlers")
try:
pPlayer = MissionLib.GetPlayer()
if pPlayer:
pSet = pPlayer.GetContainingSet()
if pSet:
ObjTuple = pSet.GetClassObjectList(App.CT_SHIP)
if ObjTuple:
for pShip in ObjTuple:
if pShip:
pShip.AddPythonFuncHandlerForInstance(App.ET_SUBSYSTEM_DISABLED, __name__ + ".BridgeDisabled")
pShip.AddPythonFuncHandlerForInstance(App.ET_SUBSYSTEM_DESTROYED, __name__ + ".BridgeDestroyed")
except:
pass
def BridgeDisabled (pShip, pEvent):
debug(__name__ + ", BridgeDisabled")
pSubsystem = App.ShipSubsystem_Cast( pEvent.GetSource() )
pBridge = MissionLib.GetSubsystemByName(pShip, 'Bridge')
if (pSubsystem.GetName() == pBridge.GetName()):
pShip.SetAI(None)
pShip.SetAlertLevel(App.ShipClass.GREEN_ALERT)
pShip.CallNextHandler(pEvent)
else:
pShip.CallNextHandler(pEvent)
return
def BridgeDestroyed (pShip, pEvent):
debug(__name__ + ", BridgeDestroyed")
pSubsystem = App.ShipSubsystem_Cast( pEvent.GetSource() )
pBridge = MissionLib.GetSubsystemByName(pShip, 'Bridge')
if (pSubsystem.GetName() == pBridge.GetName()):
pShip.SetAI(None)
pShip.SetAlertLevel(App.ShipClass.GREEN_ALERT)
pShip.CallNextHandler(pEvent)
else:
pShip.CallNextHandler(pEvent)
return
-
I had a different idea:
- Use a global timer and a global dictionary which keeps track of all disabled ships. I would probably listen to the same events as you.
- Timer tick would be 1 second, the dictionary would keep track of all ships which are disabled
- Upon ship being disabled I would disable the impulse engines to make the ship drift, set the flags on the bridge and what not and store the random value of how long the ship will be disabled
- On global timer tick I would check if the ship state should be restored, if it should. Restore the impulse engine state and bridge flag and delete the ship id from the dictionary