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: Editing Ship Systems  (Read 4933 times)

Vulcan

  • Ensign
  • *
  • Posts: 35
    • View Profile
Editing Ship Systems
« on: November 29, 2012, 08:17:26 PM »

Where is the code for ship systems(as in "abilities") located and how can it edited?

short n sweet question  :P
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Editing Ship Systems
« Reply #1 on: November 30, 2012, 01:25:49 AM »

Where is the code for ship systems(as in "abilities") located and how can it edited?

short n sweet question  :P

From a rough guess, you can either edit the vanilla files(I HIGHLY DONT RECOMMEND THIS) or you can create a new mod, copy in the desired ship system files and all the ones you need to run it, and just edit it there, the files are located in Data/Ship Systems I believe, I can't look myself as I don't have a pc :/
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Editing Ship Systems
« Reply #2 on: November 30, 2012, 07:19:36 AM »

The files are in data/shipsystems. The systems themselves are defined in the .system file, with the in-game usage stats (ammo, cooldown, flux use, etc) controlled by the values in data/shipsystems/ship_systems.csv.

If you want the system to modify your ship's stats, you'll want to put a "statsScript":"<class>" in the .system file, with <class> pointing at the class of the script that implements the bonus (this script must implement ShipSystemStatsScript; you can find several examples in starfarer-core\data\shipsystems\scripts - note that in the case of drones, the bonus is multiplied by each drone).

If you want to write custom AI for your system, add "aiType":"CUSTOM", and "aiScript":"<class>" to the .system file, where <class> is a class that implements ShipSystemAIScript (the only example in core right now is starfarer-core\data\shipsystems\scripts\ai\FastMissileRacksAI.java, but I've worked with this a bit in the last few days and I would be happy to help if you have any questions). The AI we can write only controls WHEN it will use the system, not HOW - in other words, you can tell it to activate the system if there are a certain number of enemies within range, but not to get within range and turn towards the closest enemy first.
Logged

FlashFrozen

  • Admiral
  • *****
  • Posts: 988
    • View Profile
Re: Editing Ship Systems
« Reply #3 on: November 30, 2012, 11:29:50 AM »

Is there any way for a ship to have a custom ai, instead of say just the AI attached to the subsystem?

Say I'm pretty sure that somehow the custom ai can take note of how the actual weapons on the ship are doing, but sort of in a third person way,
I want to make the ship use the ai for the ships weapons specifically xP not sure if that made sense D:
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Editing Ship Systems
« Reply #4 on: November 30, 2012, 12:07:14 PM »

Is there any way for a ship to have a custom ai, instead of say just the AI attached to the subsystem?

Not really. As far as I know, the closest you can get to influencing ships right now is changing the flags the Starfarer AI uses to make decisions, and those are fairly limited:

Code
	public static enum AIFlags {
DO_NOT_USE_FLUX,
DO_NOT_VENT,
DO_NOT_AUTOFIRE_NON_ESSENTIAL_GROUPS,
RUN_QUICKLY,
TURN_QUICKLY,
PURSUING,
HAS_INCOMING_DAMAGE,
KEEP_SHIELDS_ON,

/**
* Fighters only, is set when committed to an attack run.
*/
IN_ATTACK_RUN,

/**
* Whether the ship wants to be escorted by nearby friendlies.
*/
NEEDS_HELP,
}
Logged

Vulcan

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Editing Ship Systems
« Reply #5 on: November 30, 2012, 12:18:48 PM »

how do you set a ship to have a certain system? I cant find where that's located either... 
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Editing Ship Systems
« Reply #6 on: November 30, 2012, 12:20:49 PM »

how do you set a ship to have a certain system? I cant find where that's located either... 

It's in data/hulls/ship_data.csv, under the "system id" column.
Logged

Vulcan

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Editing Ship Systems
« Reply #7 on: November 30, 2012, 01:00:58 PM »

alright, sorry for all the questions. Usually I learn the rope a little quicker lol

So i'm trying to edit a mod(minimash) to put in systems, but since there is no column for systems yet. how would i go about adding that in? add commas or move everything over on a spreadsheet?
Logged

maximilianyuen

  • Captain
  • ****
  • Posts: 358
    • View Profile
Re: Editing Ship Systems
« Reply #8 on: December 02, 2012, 08:40:57 AM »

alright, sorry for all the questions. Usually I learn the rope a little quicker lol

So i'm trying to edit a mod(minimash) to put in systems, but since there is no column for systems yet. how would i go about adding that in? add commas or move everything over on a spreadsheet?

that mod outdated and therefore not compatible with system, but i guess you can just added the system id column at and it should work.

you should mod a mod that is updated to get familiar with it first
« Last Edit: December 02, 2012, 08:42:51 AM by maximilianyuen »
Logged
Fleet construction in progress.