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: Codex Overhaul (05/11/24)

Pages: 1 ... 636 637 [638] 639 640 ... 714

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

banano of doom

  • Commander
  • ***
  • Posts: 232
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9555 on: February 04, 2023, 02:32:51 AM »

question
what are possible existing types of shipsystems?
for the "Type" field in the .system file
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Ruddygreat

  • Admiral
  • *****
  • Posts: 530
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9556 on: February 04, 2023, 04:20:12 AM »

In a mod, I created a player.faction file with empty "known<stuff>" fields and expected to start a new game with no blueprints. I start with all vanilla "base_bp" blueprints. Why?

... Should I report this as a bug? The vanilla player.faction file contains the "base_bp" tag in all "tags" fields, so I kind of expected it to actually do something?

most (all?) of the game's files get merged instead of overwritten where possible, you'll need to specify that you want to overwrite it in your mod_info.json file
look at archean order for an example of that iirc
« Last Edit: February 04, 2023, 04:27:18 AM by Ruddygreat »
Logged

Zsar

  • Captain
  • ****
  • Posts: 294
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9557 on: February 04, 2023, 04:24:15 AM »

I mean... I do want it to merge though? Lest I have to copy - and maintain on patch - everything else I do not care to change?

... Might it be more maintainable to use a ModPlugin for this? Looking at the .csv files where I have to copy whole rows to change one single cell, I am starting to feel like editing the data files is a bad idea to begin with?
Logged

WhisperDSP

  • Commander
  • ***
  • Posts: 148
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9558 on: February 04, 2023, 12:02:08 PM »

How do I determine if the owner of a planet is player-owned? Not sure where to start looking.

rogerbacon

  • Commander
  • ***
  • Posts: 151
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9559 on: February 04, 2023, 01:23:23 PM »

What/where do I mod to make it so arms dealers always let you use your own blueprints? I've heard sometimes you can use your own but I've never actually had that option so it must be rare. I'd like to make it greater since I don't like building colonies but I want to produce ships.
Logged

shoi

  • Admiral
  • *****
  • Posts: 660
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9560 on: February 04, 2023, 05:41:22 PM »

How do I determine if the owner of a planet is player-owned? Not sure where to start looking.

MarketAPI has a method to check the owning faction. I think if(MarketAPI.getFactionId().equals("player")) should work
Logged

WhisperDSP

  • Commander
  • ***
  • Posts: 148
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9561 on: February 04, 2023, 06:15:19 PM »

How do I determine if the owner of a planet is player-owned? Not sure where to start looking.

MarketAPI has a method to check the owning faction. I think if(MarketAPI.getFactionId().equals("player")) should work

Awesome, thank you. :)

--edit--

Found it, it's: market.isPlayerOwned()

/thumbsup
« Last Edit: February 05, 2023, 12:27:10 AM by WhisperDSP »
Logged

banano of doom

  • Commander
  • ***
  • Posts: 232
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9562 on: February 04, 2023, 07:33:03 PM »

did anyone ever actually use weapon.getGlowSpriteAPI().setAlphaMult(...)
i can't seem to make it function
and i can't find any actual use in vanilla or mods
i suspect that it should allow to glow the glow sprite when the weapon isn't firing
but i see no actual effect
upd: i figure that i see no effect because there is no glow to affect. but i see no null error either.

is there a way to actually force weapon (decorative or otherwise) to glow on demand, not when firing ?
« Last Edit: February 04, 2023, 10:17:11 PM by passwalker »
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

WhisperDSP

  • Commander
  • ***
  • Posts: 148
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9563 on: February 05, 2023, 01:39:05 AM »

I have a situation in my code where passing a code-generated item crashes the game.

The code:
Code: java
    // if we have a special item to add
    if (wta_specialitemfound != "") {
      d = new DropData();
      d.chances = 1;
      d.addCustom(wta_specialitemfound, 1f);
      dropRandom.add(d);
    }

The "wta_specialitemfound" that is generated:
Code
wta_farming_1:item_fullerene_spool:wta_ai_cores

The two custom items in there are drop groups:
Code
item_biofactory_embryo,wta_farming_1,10
item_drone_replicator,wta_farming_1,10
item_soil_nanites,wta_farming_1,10
Code
alpha_core,wta_ai_cores,1
beta_core,wta_ai_cores,2
gamma_core,wta_ai_cores,5

Is the crashing happening because this particular function ("d.addCustom(wta_specialitemfound, 1f);") doesn't like having drop groups included it? IE it must only have basic items in the generated list?

--edit--

Here's the erroring part of the log:

Code
728616 [Thread-3] DEBUG data.scripts.wta_industry.wta_TechMining  - wtaLOG: Farmland - wta_farming_1
728616 [Thread-3] DEBUG data.scripts.wta_industry.wta_TechMining  - wtaLOG: FINAL RESULT - wta_farming_1:item_fullerene_spool:wta_ai_cores
728627 [Thread-7] INFO  sound.public  - Cleaning up music with id [miscallenous_corvus_campaign_music.ogg]
728657 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
java.lang.RuntimeException: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at com.fs.starfarer.api.impl.campaign.procgen.DropGroupRow.<init>(DropGroupRow.java:151)
at com.fs.starfarer.api.impl.campaign.procgen.SalvageEntityGenDataSpec$DropData.addCustom(SalvageEntityGenDataSpec.java:112)
at data.scripts.wta_industry.wta_TechMining.generateCargoForGatheringPoint(wta_TechMining.java:743)
at com.fs.starfarer.api.impl.campaign.CoreScript.doCustomProduction(CoreScript.java:998)
at com.fs.starfarer.api.impl.campaign.CoreScript.reportEconomyMonthEnd(CoreScript.java:1100)
at com.fs.starfarer.campaign.CampaignEngine.reportEconomyMonthEnd(Unknown Source)
at com.fs.starfarer.campaign.econ.reach.ReachEconomyStepper.doEndOfMonthStuff(Unknown Source)
at com.fs.starfarer.campaign.econ.reach.ReachEconomyStepper.nextFrame(Unknown Source)
at com.fs.starfarer.campaign.econ.Economy.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:423)
at org.json.JSONObject.<init>(JSONObject.java:184)
at org.json.JSONObject.<init>(JSONObject.java:311)
at com.fs.starfarer.api.impl.campaign.procgen.DropGroupRow.parseData(DropGroupRow.java:127)
at com.fs.starfarer.api.impl.campaign.procgen.DropGroupRow.<init>(DropGroupRow.java:149)
... 16 more
« Last Edit: February 05, 2023, 01:44:42 AM by WhisperDSP »
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3030
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9564 on: February 05, 2023, 01:47:14 PM »

did anyone ever actually use weapon.getGlowSpriteAPI().setAlphaMult(...)
i can't seem to make it function
and i can't find any actual use in vanilla or mods
i suspect that it should allow to glow the glow sprite when the weapon isn't firing
but i see no actual effect
upd: i figure that i see no effect because there is no glow to affect. but i see no null error either.

is there a way to actually force weapon (decorative or otherwise) to glow on demand, not when firing ?

I think I ran into this before and the problem is the glow sprite has to be rendering? I bypassed it for some ship system decos by coloring the glow sprite manually and using it as the deco weapon's normal sprite - I could edit the alpha of that as I wanted since it is always rendered.
Logged

WhisperDSP

  • Commander
  • ***
  • Posts: 148
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9565 on: February 05, 2023, 01:54:36 PM »

I have fixed the above code by splitting the input string as follows:

Code
    wtaDebug("wtaLOG: Final item (if any) - " + wta_specialitemfound);
    wtaDebug("wtaLOG: Giving to player now.");
   
    // if we have a special item to add
    if (wta_specialitemfound != "") {
      d = new DropData();
      d.chances = 1;
      String[] wta_items = wta_specialitemfound.split(":");
      for (String wta_item : wta_items) {
        d.addCustom(wta_item, 1f);
      }
      /* d.addCustom(wta_specialitemfound, 1f); */
      dropRandom.add(d);
    }
   
    wtaDebug("wtaLOG: Colony size - " + colonySize);
    wtaDebug("wtaLOG: Ruins size - " + ruinsSize);
    wtaDebug("wtaLOG: Progress bar value - " + wta_ruins_specialprogressbar);
    wtaDebug("wtaLOG: Special items so far - " + wta_ruins_specialitemsfound);
    wtaDebug("wtaLOG: Enhanced multiplier - " + multEnhanced);

I'm scratching my head though - it still crashes occasionally.

Unless it *really doesn't like custom drop-groups* - in which case I'm stuffed. It'd require some really nasty drop-group-creation to take the place of the entire "addCustom" section. I'm not even sure that'd be possible.

I *really* don't want to be coding the custom drop-groups, that's way less flexible.

Possible lateral way around this - to get the individual contents of the custom drop groups and "addCustom" them as individual base items? If that's even possible?

Ideas?

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9566 on: February 05, 2023, 02:49:20 PM »

This is a weird misc-modding question, but I would like to know how the replacement rate work in a simple manner.

We know they decrease when it is replacing fighters but by how much? Does the replacement time matter? What's the difference between replacing two broadswords out of three at the same time vs replacing one broadsword out of three twice? Talons are recorded to get replaced faster and maintain a higher replacement rate than replacing broadswords.

How do the replacement rates recover? Do they recover but the depletion is greater than the recovery? Does Combat Readiness matter here? We know they matter at 0% CR when it suddenly goes down to 0% Replacement Rate.

There's not really a guide that we can rely on and at best players speculate.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24252
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9567 on: February 05, 2023, 03:35:50 PM »

is there a listener that i can attach to a ship that advances while combat is paused? hullmod's advance doesn't, and neither does an AdvanceableListener.

edit: alternatively, is there any kind of script/listener that i can add to the combat engine that is easy to clean up when combat ends? i am trying to draw onto the UI but only when the ship is alive and controlled by the player.

CombatEngineAPI.addPlugin()/removePlugin() should be what you want, I think?


is there an advance or GUI drawing listener/plugin that runs after all other advance methods?

EveryFrameCombatPlugin.renderInUICoords() and .renderInWorldCoords()


is there a way to somehow remove/change the "-class" part of the hull name for the specifiic ship?
so the getHullNameWithDashClass returns only the name, or some custom string instead of "-class" ?
for example, if i want to change the hound so everywhere in the ui where it shows "Hound-class"  it will instead show "Hound" or "Hound-senpai" or something equally silly

If it has the STATION hint, which is... going to have some side effects, let's say. If the hull doesn't have a name, though, just the unmodified designation will be used.


I want to make a "goo gun". It fires projectiles that stick to a ship for ten seconds and slow it down. I'm pretty sure I can do the non-graphics stuff but I have some questions about sprites.

How do I attach a sprite to a ship and can I make it auto-remove after a certain time?

Check the Disinitegrator on-hit effect; it does something fairly similar!


Log4J vulnerability FTW LOL!

(Just FYI, the version of log4j the game comes with does not have this vulnerability! Not that it would matter much if it did - the game is not a server that accept requests and can be made to log arbitrary things externally.)


In a mod, I created a player.faction file with empty "known<stuff>" fields and expected to start a new game with no blueprints. I start with all vanilla "base_bp" blueprints. Why?

JSON arrays are usually (with the exception of a few hardcoded ones) merged by appending their contents, so the way you're providing it in your .player file doesn't actually do anything. The way to accomplish what you want is 1) have a special string "core_clearArray" as the only member in those arrays (I know, I know), or 2) specify player.faction in the "replace" section of your mod_info.json.

IIRC there may be some problems if there are no blueprints in the player faction to start with. Not sure what would happen to fleet spawning etc and just in general there *may* be places in the code that assume the player has *something*.

question
what are possible existing types of shipsystems?
for the "Type" field in the .system file

public static enum ShipSystemType {
   WEAPON,
   ENGINE_MOD,
   SHIELD_MOD,
   STAT_MOD,
   FAST_RELOAD,
   AMMO_RELOAD,
   TELEPORTER,
   PHASE_CLOAK,
   DISPLACER,
   DRONE_LAUNCHER,
   EMP,
}


What/where do I mod to make it so arms dealers always let you use your own blueprints? I've heard sometimes you can use your own but I've never actually had that option so it must be rare. I'd like to make it greater since I don't like building colonies but I want to produce ships.

Arms dealers don't. It depends on the contact types; see CustomProductionContract for details.



I'm scratching my head though - it still crashes occasionally.
...
Ideas?

Would need to see the error message!


This is a weird misc-modding question, but I would like to know how the replacement rate work in a simple manner.

We know they decrease when it is replacing fighters but by how much? Does the replacement time matter? What's the difference between replacing two broadswords out of three at the same time vs replacing one broadsword out of three twice? Talons are recorded to get replaced faster and maintain a higher replacement rate than replacing broadswords.

How do the replacement rates recover? Do they recover but the depletion is greater than the recovery? Does Combat Readiness matter here? We know they matter at 0% CR when it suddenly goes down to 0% Replacement Rate.

There's not really a guide that we can rely on and at best players speculate.

A per-bay rate is computed, and the final rate - that is then used for all the bays for actual fighter replacement times - is the average for all bays. Unused bays count as always having 100% rate.

The per-bay computation is:
If the wing is at max members: increase the rate by 1% per second, modified by REPLACEMENT_RATE_INCREASE_MULT
If the wing is not at max members: decrease the rate by 1% per second, modified by REPLACEMENT_RATE_DECREASE_MULT, and x0.5 if the ship has the fighters pulled back
Then: rate = max(rate, minFighterReplacementRate)
Logged

WhisperDSP

  • Commander
  • ***
  • Posts: 148
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9568 on: February 05, 2023, 04:56:24 PM »

I'm scratching my head though - it still crashes occasionally.
...
Ideas?

Would need to see the error message!
Apologies, my brains are toast. Here it is:
Code
674311 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.api.impl.campaign.procgen.DropGroupRow.getBaseUnitValue(DropGroupRow.java:190)
at com.fs.starfarer.api.impl.campaign.rulecmd.salvage.SalvageEntity.generateSalvage(SalvageEntity.java:991)
at data.scripts.wta_industry.wta_TechMining.generateCargoForGatheringPoint(wta_TechMining.java:765)
at com.fs.starfarer.api.impl.campaign.CoreScript.doCustomProduction(CoreScript.java:998)
at com.fs.starfarer.api.impl.campaign.CoreScript.reportEconomyMonthEnd(CoreScript.java:1100)
at com.fs.starfarer.campaign.CampaignEngine.reportEconomyMonthEnd(Unknown Source)
at com.fs.starfarer.campaign.econ.reach.ReachEconomyStepper.doEndOfMonthStuff(Unknown Source)
at com.fs.starfarer.campaign.econ.reach.ReachEconomyStepper.nextFrame(Unknown Source)
at com.fs.starfarer.campaign.econ.Economy.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I'm going to try another way instead of using the "addCustom" code, in case it's that. Checking the drop groups now, to be certain that I've not stuffed those as well.

I was joking about Log4J - I know the game isn't connected as a server to the internet. :)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24252
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9569 on: February 05, 2023, 05:10:40 PM »

Looking at DropGroupRow line 190 - which btw is in the api code, so you can look at it too! - seems to indicate that the commodity spec for whatever dropped is null. So probably a mixed up ID somewhere?
Logged
Pages: 1 ... 636 637 [638] 639 640 ... 714