Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: AI captain  (Read 561 times)

BaBosa

  • Captain
  • ****
  • Posts: 445
    • View Profile
AI captain
« on: February 07, 2023, 07:34:40 PM »

I want to make it so I can have automated ships in my fleet but not normal ships until I get the automated human ships skill.

The idea I had to do this was to make a human ship hullmod to put on every ship and have it act like the automated ship hullmod. The problem I have is that I either need to make it only apply to the players fleet and not other factions or to give every enemy fleet a admiral with the human ships skill without messing with the other skills they should have.

I don't know how to do either so does anyone have a hint?
Logged

Zsar

  • Captain
  • ****
  • Posts: 279
    • View Profile
Re: AI captain
« Reply #1 on: February 07, 2023, 08:45:10 PM »

I have not tried, but each faction has this field:
Code
factionDoctrine | commanderSkills
It is an array, so if you put a faction file with just this field into your mod, it should merge the entries with all other mods and core.
Maybe putting the skill into that field could work, but I fear there is no way to mark it as mandatory, so factions with too low
Code
factionDoctrine | officerQuality
may end up having another skill instead.

I have tried to track down fleet generation and I got to
Code
FleetFactoryV3#createFleet
. There should (in vanilla) not exist any CreateFleetPlugin (But check that via debugger! I just glossed over it.), so you should be able to create your own and register it in an implementation of ModPlugin#onApplicationLoad . That should do it.

(In your CreateFleetPlugin, you can call
Code
FleetFactoryV3#addCommanderAndOfficers
and modify the resulting admiral.)
« Last Edit: February 07, 2023, 08:48:42 PM by Zsar »
Logged

BaBosa

  • Captain
  • ****
  • Posts: 445
    • View Profile
Re: AI captain
« Reply #2 on: February 07, 2023, 09:10:40 PM »

I thought the same thing about factionDoctrine not being able to make it mandatory and not replace another skill.

If I added another admiral to a fleet that already have one, would both of their fleet skills work? That would work. I'll have a shot at it.

Thanks for the help Zsar.
Logged