X4: Foundations

X4: Foundations

78 ratings
Bailing Extension
2
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
60.918 KB
Mar 27, 2024 @ 8:52am
1 Change Note ( view )

Subscribe to download
Bailing Extension

Description
BAILING EXTENSION

This mod is a complete rewrite of the base bailing system in X4: foundations, which improves the logic behind bailing and enables NPCs to cause other NPCs to bail. Additionally large and x-large ships will now bail a reasonable numbers of crew, and non-military ships may even fully abandon ship. Finally the player will receive a notification of an abandoned ship if the player has an advanced satellite in the sector the ship bailed in.

BAILING LOGIC

Bail checks run on any ship (including those attacked by NPCs) whose shields and hull drop below 20% and 75% respectively, much like in the base game. However rather than checking if a ship will bailing every 30s, if the player is involved in the combat the checks will now run every 5s. To compensate for this increased frequency each check has a lower probability of triggering crew to bail**.

The probability a ship will bail crew is now determined by the logic below:

Prob(Will Bail) = BASE + SIZECOMP + FIGHTCOMP + MORALCHECK
For players max(Prob(Will Bail)) = 20% and min(Prob(Will Bail)) = 3%
For NPCs max(Prob(Will Bail)) = 10% and min(Prob(Will Bail)) = 1%

BASE: Base chance for a ship to bail.
= 10% when a player triggered bailing conditions (including player owned ships*)
= -5% for NPC vs NPC bailing events
SIZECOMP: Size comparison between attacker and target:
= 5*(min( (Attacker max HP/Target max HP) -1, 1). I.e. for ships with equal size = 0%. Small attacker/large target = -5%. Large attacker/small target = 5%
FIGHTCOMP: Relative ability to fight between attacker and target.
= min(5, 10*((Attacker time-to-kill/target time-to-kill)/2 - 1)). Similar to size comparison, however -ve bias when target has a chance to fight back.
MORALCHECK
= +10% for the least skilled crew possible, -10% for the most skilled crew.

The bail chance is then halved if the target can escape (target max speed > 1.2*attacker max speed).

Pilot panic: Each time a player triggers a bailing event the target's "panic level" will increase. On subsequent bailing checks this panic is added to the final probability to bail, 0.5% each check to a maximum of 10%. This has been included to reduce the probability that you spend ages trying to get a ship to bail, which won't bail because of bad rolls on the bail check.

EJECTING CREW

The base game would only ever eject 1-3 crew at a time, which is incredible considering: How many crew even a medium transport ship has. That the bail checks ran at most every 30s. The probability of bailing could be as low as 1%. All without ever telling you this, those "panic" dialogs have no impact on the logic.

In the Bailing Extension mod between 20% to 100% of the crew will bail when the eject chance is passed. L and XL military ships will only bail crew up-to their (crew capacity)*(hull percentage/2)*** and the pilot will never bail (captain always goes down with his ship). For example if a military L ship's capacity is 100 crew and the hull percentage is 40% then 20+ crew will be left after the ship bails.

BAILED SHIPS AND CLEAN-UP

If the player has a advanced satellite in a sector where a ship is abandoned, the player will receive an notification and a log message.
Bailed ships will be deleted after roughly 2 hours, unless the player is in the same sector as the bailed ship.
Ships from factions who can claim abandoned ships (Yaki in vanilla X4) will only attempt to capture a ship every 5 minutes with a 1 in 4 chance. I implemented this change because in vanilla X4 if a yaki ship found an abandoned ship it would spam all its marines to claim the ship.

INSTALLATION AND COMPATIBILITY

Nexus mod page: https://www.nexusmods.com/x4foundations/mods/1342/

To install extract the .zip into X4's /extension folder and make sure it is activated in the extension menu in game.

The mod is compatible with X4 6.0+, it's probably compatible with older versions too but I haven't tested it. The mod is also safe to add to an on-going save, and remove from a save game.

I actually built this mod primarily for Star Wars Interworlds, and it is compatible with at least SWI 0.72/0.73.
Any other bailing mods (better piracy/improved bail chance/enhanced bailing etc) will almost certainly conflict with this mod.

ACKNOWLEDGEMENTS

This is my first mod, so firstly a big thanks to everyone in the modding community. I used as many references as possible to learn how to mod the game, even scouring over other mods code on github. So big props to those who've published their code online!

I started this mod by reading and learning the Star Wars Interworlds mod code, so huge appreciation and thanks to everyone on that team. Really awesome mod, can't recommend highly enough. From this I learnt the Interworlds bailing logic is a modified version of the "Enhanced Bailing" mod (https://www.nexusmods.com/x4foundations/mods/741) and while it hasn't been updated for the latest version of X4, I learnt a huge amount by looking through MoonShadowFan's code.


* - Semi-interesting fact: in the base game player owned ships can cause other ships to bail, however it is extremely rare and you really have to work hard to get the right conditions for it to occur (I tested it by setting the probability of a ship to bail to 100%).
** - The base game chance of bailing could actually be 0%, so if you ever found yourself endlessly trying to get a ship to bail (that wasn't story related) this is probably why.
*** - Due to the way the game ejects crew, the remaining crew can sometimes drop below this threshold by 1 or 2 crew. However subsequent bails will respect this limit and the pilot shouldn't bail. Please let me know if you see a mil ship fully bail, as I'm not sure why the game ejects more crew than the code tells it to.
46 Comments
Not a Bot May 27 @ 8:28pm 
so, if a captain of a military ship never bails then what is the point of this mod? The military ships are the ones I want. I can spam marines if I want freighters or constructors.
Ratsmacker69 Apr 10 @ 2:30am 
Can also confirm, this DOES NOT work on Xenon ships. Marines just vanish.
Spags Apr 2 @ 12:25pm 
can confirm, cannot claim bailed xenon ships as the bailed xenon ships for some reason still have a captain (can spacewalk and manually claim with repair laser then they just start moving again)
zonumx4 Mar 10 @ 3:03pm 
This mod is nearly perfect for me, works as intended. I had to disable it temporarily because NPC vs NPC gets out of hand, over 10 bailed ships at getsu fune in 30-60 play session(TER vs Xenon). Would like to see an option to disable NPC vs NPC. 7.5 in VRO though it works perfectly because S and M ships tends to get decimated too quick for vanilla Bail system.
Damien Mar 9 @ 8:39am 
Is there any way to change values in this mod so that there is a chance of the xl ships being capped in npc vs npc? I don't want my game flooded with them, just some to find from time to time
Siveen Feb 27 @ 7:54pm 
A fix for claiming Xenon Ships - right now they Marines just dissipate into thin air and the ship remains unclaimed.
Vindicator  [author] Feb 27 @ 7:37pm 
It kind of was, but I'm looking to do an update soon. I can confirm the mod works with the latest version (7.5) of X4 though :). Any requests for features in the next version?
Siveen Feb 24 @ 11:54am 
Is this mod abandoned?
Fidel Castro Oct 18, 2024 @ 1:10am 
Hey is there any chance to disable NPC on NPC bailing? I love the mod except for that fact
Terraformer Sep 27, 2024 @ 8:01am 
causes CTDs