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)

Pages: 1 ... 567 568 [569] 570 571 ... 706

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1699984 times)

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8520 on: February 21, 2022, 01:08:30 PM »

If not, would a every frame combat script that run setPersonality on the PersonAPI's of relevant ships work?

It should, yes. I do this with a couple of my ship system AIs and those are EveryFrameCombatScripts iirc. They at least work very similarly in function.
Logged

cptdash

  • Ensign
  • *
  • Posts: 32
  • aka SpeedRacer
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8521 on: February 21, 2022, 08:23:38 PM »

Hello,
I have been investigating mod options for adding additional quests to the bar. As a basic start, I wanted to play around with the mission frequency of the CheapCommidityMission. I attempted the following changes:

bar_events.csv - changing 'freq' to 9999 and 99999999999 for cheapCom entry -- no change in quest frequency
bar_events.csv - adding 'priority' tag to cheapCom entry -- no change in frequency
bar_events.csv - duplicating cheapCom entry to add cheapCom2-cheapCom30 entries -- no change in frequency
person_missions.csv - adding cheapCom2-cheapCom30 entries duplicated off original cheapCom -- no change in frequency
rules.csv - duplicating table entries for cheapCom, changing 'id' column names to cheapCom2-30 -- no change in frequency

All changes were tested by starting a new game and visiting at least 15 stations. Usually I only found 1 quest of the cheapCom variety.
Am I missing something, or is the logic for quest frequency expanded somewhere else?
« Last Edit: February 21, 2022, 08:26:07 PM by cptdash »
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8522 on: February 22, 2022, 01:40:58 AM »

Is there anything similar to ShipAPI.isDefenseDisabled() but for Ship Systems?

I notice there is something for ShipAPI.setShipSystemDisabled(boolean), and I'm just curious if the AI script I'm coding should be running if for some reason the ship has its ship systems disabled.

Also, is there a getControlStringForEnumName for something like Hold Fire.. I can't seem to find any mentions of this enum anywhere...

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8523 on: February 23, 2022, 04:48:48 PM »

Is there something i'm missing to get the maximum number of elite skills the players officers can have?

      MutableCharacterStatsAPI playerStats = Global.getSector().getPlayerFleet().getFleetData().getCommander().getStats();
      int maxElite = (int)Global.getSettings().getInt("officerMaxEliteSkills") + (int)playerStats.getDynamic().getValue(Stats.OFFICER_MAX_ELITE_SKILLS_MOD);

Doing this returns two, but the character has Cybernetic Augmentation + Officer Training, so it should be 4..
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8524 on: February 23, 2022, 05:35:40 PM »

ello,
I have been investigating mod options for adding additional quests to the bar. As a basic start, I wanted to play around with the mission frequency of the CheapCommidityMission. I attempted the following changes:

bar_events.csv - changing 'freq' to 9999 and 99999999999 for cheapCom entry -- no change in quest frequency
bar_events.csv - adding 'priority' tag to cheapCom entry -- no change in frequency
bar_events.csv - duplicating cheapCom entry to add cheapCom2-cheapCom30 entries -- no change in frequency
person_missions.csv - adding cheapCom2-cheapCom30 entries duplicated off original cheapCom -- no change in frequency
rules.csv - duplicating table entries for cheapCom, changing 'id' column names to cheapCom2-30 -- no change in frequency

All changes were tested by starting a new game and visiting at least 15 stations. Usually I only found 1 quest of the cheapCom variety.
Am I missing something, or is the logic for quest frequency expanded somewhere else?

Offhand, that seems like it should work, but it's possible that there simply isn't a "cheap commodity" mission available at that particular colony - iirc it requires a local surplus of a legal commodity. I'd try changing the frequency on some of the other missions to see if it works for those.

Is there anything similar to ShipAPI.isDefenseDisabled() but for Ship Systems?

I notice there is something for ShipAPI.setShipSystemDisabled(boolean), and I'm just curious if the AI script I'm coding should be running if for some reason the ship has its ship systems disabled.

No and no. The system would be disabled if the ship's CR is 0%, btw, but then it wouldn't work at all regardless of if the AI tried to use it.

Also, is there a getControlStringForEnumName for something like Hold Fire.. I can't seem to find any mentions of this enum anywhere...

Should be SHIP_HOLD_FIRE I believe.

Is there something i'm missing to get the maximum number of elite skills the players officers can have?

      MutableCharacterStatsAPI playerStats = Global.getSector().getPlayerFleet().getFleetData().getCommander().getStats();
      int maxElite = (int)Global.getSettings().getInt("officerMaxEliteSkills") + (int)playerStats.getDynamic().getValue(Stats.OFFICER_MAX_ELITE_SKILLS_MOD);

Doing this returns two, but the character has Cybernetic Augmentation + Officer Training, so it should be 4..

You want:
(int) stats.getDynamic().getMod(Stats.OFFICER_MAX_ELITE_SKILLS_MOD).computeEffective(0);
To get the bonus from skills, instead of getValue().
Logged

Amoebka

  • Admiral
  • *****
  • Posts: 1318
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8525 on: February 24, 2022, 10:22:14 AM »

Where do missiles get associated with their AI scripts? Can't see anything in weapon_data, weapon definitions or projectile definitions. Am I blind?  :o I'm trying to make custom missiles that have vanilla locust AI and are spawned in using CombatEngineAPI instead of a weapon. (it would seem I still need to define fake weapons?) I know there's a way to change missile AI script, but how do I get the name of the vanilla class locust uses?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8526 on: February 24, 2022, 10:24:31 AM »

See: ModPlugin.pickMissileAI() for how you might specify a custom AI.

But, the locust uses the standard missile AI that's used for all of the "missileType":"MISSILE", missiles.
Logged

Amoebka

  • Admiral
  • *****
  • Posts: 1318
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8527 on: February 24, 2022, 10:37:00 AM »

But, the locust uses the standard missile AI that's used for all of the "missileType":"MISSILE", missiles.

Does that mean that just defining a missile projectile with turn speed etc specified will make it behave like locust/harpoon/swarmer/etc? If yes, than the question becomes "how do I change a missile's target from outside its AI script". What I want is basically spawn in a missile with the default guided AI, give it a specific target to chase, and have it revert to default behaviour (choosing new target) if my target is unavailable. I know there's getUnwrappedMissileAI, but then I need to know the name of the vanilla class and whatever its "setTarget" method is called, if it exists?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8528 on: February 24, 2022, 10:41:46 AM »

There's a GuidedMissileAI interface. You could do something like:
if (missile.getAI() instanceof GuidedMissileAI) {
    ((GuidedMissileAI)missile.getAI()).setTarget(...)
}
Logged

Amoebka

  • Admiral
  • *****
  • Posts: 1318
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8529 on: February 24, 2022, 10:46:52 AM »

There's a GuidedMissileAI interface. You could do something like:
if (missile.getAI() instanceof GuidedMissileAI) {
    ((GuidedMissileAI)missile.getAI()).setTarget(...)
}

Sounds exactly like what I wanted, thank you.  ;D
Logged

briansd9

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8530 on: February 24, 2022, 10:59:35 PM »

Is there a way to change the hiring cost of crew, or otherwise make them unpurchasable at markets (only by capture or looting)?
« Last Edit: February 25, 2022, 06:32:03 AM by briansd9 »
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8531 on: February 25, 2022, 07:22:37 PM »

You want:
(int) stats.getDynamic().getMod(Stats.OFFICER_MAX_ELITE_SKILLS_MOD).computeEffective(0);
To get the bonus from skills, instead of getValue().
Aha, thanks!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8532 on: February 25, 2022, 08:35:01 PM »

Is there a way to change the hiring cost of crew, or otherwise make them unpurchasable at markets (only by capture or looting)?

There's a "price" column in commodities.csv.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8534 on: February 26, 2022, 09:52:00 AM »

Nothing that immediately comes to mind, short of a custom fleet inflater.
Logged
Pages: 1 ... 567 568 [569] 570 571 ... 706