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 ... 381 382 [383] 384 385 ... 706

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

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7173
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5730 on: November 22, 2019, 11:14:43 AM »

Thanks so much! That will help clean up the UI on a lot of modded industry stuff.
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5731 on: November 22, 2019, 09:46:38 PM »

How can I get the weapon spec (or any data structure where I can pull the weapon's display name) from just it's ID?

Also, how are the events in rules.csv ordered? I'm currently trying to make an alternate PickGreeting if the character has given a quest (i.e. waiting for the player to bring the required stuff), but when I added the line to accept the delivery, it doesn't seem to be called at all.
« Last Edit: November 22, 2019, 10:18:24 PM by creature »
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5732 on: November 22, 2019, 10:28:08 PM »

How can I get the weapon spec (or any data structure where I can pull the weapon's display name) from just it's ID?
Code: java
Global.getSettings().getWeaponSpec("my_weapon_id").getWeaponName()
Not sure about your rules.csv question. Maybe the condition score of your rule isn't higher than the default?

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5733 on: November 22, 2019, 10:59:44 PM »

Code: java
Global.getSettings().getWeaponSpec("my_weapon_id").getWeaponName()
Not sure about your rules.csv question. Maybe the condition score of your rule isn't higher than the default?
Thanks for the weapon code!

Sorry, I'm not quite sure how to explain what's going wrong either since I'm just fumbling around with the file at the moment... I tried adding some to the two conditions that should change (bottom two), but when I added the tag, it seems they both get ignored instead and the default (top 3) conversation is picked... Below is the relevant slice of my rule.csv.

mvt_rinaGreetingIfPlayerIsStrangerPickGreeting$yrxp_isRinaShowPersonVisual0:cutCommLink:"No, it's nothing."
mvt_rinaGreetingIfPlayerIsCommissioned
PickGreeting$yrxp_isRina
$faction.id == yrxp
$faction.friendlyToPlayer
ShowPersonVisual
CallEvent $mvt_eventRef prepare
$talkedTo = true
0:mvt_yrxp_job:Ask if she has a job for you.
1:mvt_mivit_questline1:Ask if something is bothering her
2:cutCommLink:"No, it's nothing."
mvt_rinaGreetingTalkedToPickGreeting$yrxp_isRina
$faction.id == yrxp
$faction.friendlyToPlayer
$talkedTo
ShowPersonVisual
CallEvent $mvt_eventRef prepare
0:mvt_yrxp_job:Ask if she has a job for you.
1:mvt_mivit_questline1:Ask if something is bothering her
2:cutCommLink:"No, it's nothing."
mvt_rinaGreetingTalkedToWithQuestPickGreeting$tag:RinaFetchQuestDeliver score:100
$yrxp_isRina
$faction.id == yrxp
$faction.friendlyToPlayer
$talkedTo
!CallEvent $rna_eventRef canTakeQuest
ShowPersonVisual
CallEvent $mvt_eventRef prepare
0:cutCommLink:"No, not yet."
rna_deliverJobPickGreeting$tag:RinaFetchQuestDeliver score:1000
$yrxp_isRina
$faction.id == yrxp
$faction.friendlyToPlayer
$talkedTo
CallEvent rina_fetchQuest_eventRef deliverQuest
ShowPersonVisual
EndConversation

So when the fetch quest begins I want the game to prioritize checking the rna_deliverJob over mvt_rinaGreetingTalkedToWithQuest, which is the alternate greeting for when a quest is underway but not complete. But it seems it only ever want to display mvt_rinaGreetingTalkedToWithQuest.

Oh, and as mentioned above, when I added the $tag:RinaFetchQuestDeliver score:1000 line in the conditions, it seems they both got ignored and the game instead displayed mvt_rinaGreetingTalkedTo
« Last Edit: November 22, 2019, 11:03:15 PM by creature »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5734 on: November 23, 2019, 01:54:29 AM »

Tags are used for sector entity properties, e.g. $tag:station = true for orbital stations. I'm not sure persons even have them.
When/how are you setting the tag? Maybe your check needs to look at the entity rather than the person, e.g. $entity.tag:RinaFetchQuestDeliver
(but this is bad since a market can have more than one entity, you probably want to use market memory instead)

There doesn't seem to be a listener for "player founded a colony". If so, could we get one?

Oh, yep - let me add a PlayerColonizationListener. There; done.
In the same vein, is there a listener for a market decivilizing?
Logged

King Alfonzo

  • Admiral
  • *****
  • Posts: 679
  • -- D O C T O R --
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5735 on: November 23, 2019, 02:32:08 AM »

Code
119282 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.campaign.fleet.CargoData.initMothballedShips(Unknown Source)
at com.fs.starfarer.campaign.CustomCampaignEntity.<init>(Unknown Source)
at com.fs.starfarer.campaign.BaseLocation.addCustomEntity(Unknown Source)
at com.fs.starfarer.campaign.BaseLocation.addCustomEntity(Unknown Source)
at data.scripts.world.systems.FPE_danube.generate(FPE_danube.java:68)
at data.scripts.world.FPE_gen.generate(FPE_gen.java:17)
at data.scripts.FPE_modPlugin.initFPE(FPE_modPlugin.java:16)
at data.scripts.FPE_modPlugin.onNewGame(FPE_modPlugin.java:26)
at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
at com.fs.starfarer.title.TitleScreenState.dialogDismissed(Unknown Source)
at com.fs.starfarer.ui.N.dismiss(Unknown Source)
at com.fs.starfarer.ui.impl.K.dismiss(Unknown Source)
at com.fs.starfarer.campaign.save.if.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.newnew.buttonPressed(Unknown Source)
at com.fs.starfarer.ui.I.Ò00000(Unknown Source)
at com.fs.starfarer.ui.I.processInput(Unknown Source)
at com.fs.starfarer.ui.O0Oo.o00000(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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Keep running into this error, and I'm not sure why. Here's line 68 of the system generation file, but I'm not seeing what's causing the crash.

Code
		SectorEntityToken danube_relay = system.addCustomEntity("fpe_danube_relay", // unique id
"Danube Relay", // name - if null, defaultName from custom_entities.json will be used
"comm_relay_makeshift", // type of object, defined in custom_entities.json
"FPE"); // faction
danube_relay.setCircularOrbitPointingDown(star, 300, 6000, 700);

Could anyone help me please?

Plasmatic

  • Admiral
  • *****
  • Posts: 500
  • Curious no?
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5736 on: November 23, 2019, 03:08:06 AM »

If I wanted to play a campaign with a much smaller sector and just a few systems with many planets/moons/bases

How would I go about creating such a sector? Is it even possible while using mods? (Nexerelin and all factions I could find from forum)

I'm looking for a small sector where systems are close together (closer than 20 days flight) with maybe 15-20 systems.

each system having enough objects (Planets/Moons/Bases) to fit the factions.

Is that even possible without heavy coding? (my knowledge is basically limited to modifying .json, not writing my own)
Logged
"Better to remain silent and be thought a fool than to speak out and remove all doubt"
- Maurice Switzer

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5737 on: November 23, 2019, 11:14:34 AM »

Code
119282 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.campaign.fleet.CargoData.initMothballedShips(Unknown Source)
at com.fs.starfarer.campaign.CustomCampaignEntity.<init>(Unknown Source)
at com.fs.starfarer.campaign.BaseLocation.addCustomEntity(Unknown Source)
at com.fs.starfarer.campaign.BaseLocation.addCustomEntity(Unknown Source)
at data.scripts.world.systems.FPE_danube.generate(FPE_danube.java:68)
at data.scripts.world.FPE_gen.generate(FPE_gen.java:17)
at data.scripts.FPE_modPlugin.initFPE(FPE_modPlugin.java:16)
at data.scripts.FPE_modPlugin.onNewGame(FPE_modPlugin.java:26)
at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
at com.fs.starfarer.title.TitleScreenState.dialogDismissed(Unknown Source)
at com.fs.starfarer.ui.N.dismiss(Unknown Source)
at com.fs.starfarer.ui.impl.K.dismiss(Unknown Source)
at com.fs.starfarer.campaign.save.if.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.newnew.buttonPressed(Unknown Source)
at com.fs.starfarer.ui.I.Ò00000(Unknown Source)
at com.fs.starfarer.ui.I.processInput(Unknown Source)
at com.fs.starfarer.ui.O0Oo.o00000(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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Keep running into this error, and I'm not sure why. Here's line 68 of the system generation file, but I'm not seeing what's causing the crash.

Code
		SectorEntityToken danube_relay = system.addCustomEntity("fpe_danube_relay", // unique id
"Danube Relay", // name - if null, defaultName from custom_entities.json will be used
"comm_relay_makeshift", // type of object, defined in custom_entities.json
"FPE"); // faction
danube_relay.setCircularOrbitPointingDown(star, 300, 6000, 700);

Could anyone help me please?

Seems to me that "system" is coming up as null here for some reason.

Can you show me the line you use that instantiates that variable?

*Edit*

Hmm, took a look at my own code since the case where system coming up as null would be really weird if you are creating the system in the file.

Looks like it could be because you are using:

Code
danube_relay.setCircularOrbitPointingDown(star, 300, 6000, 700);

with a PlanetAPI instead of a SectorEntityToken like its method definition indicates it uses. "setCircularOrbit" on the other hand will accept a PlanetAPI.

Maybe try casting it like:

Code
danube_relay.setCircularOrbitPointingDown((SectorEntityToken) star, 300, 6000, 700);

Or I use:

Code
danube_relay.setCircularOrbitPointingDown(system.getEntityById("star_id"), 300, 6000, 700);
« Last Edit: November 23, 2019, 12:09:44 PM by Morrokain »
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5738 on: November 23, 2019, 12:16:56 PM »

@King Alfonzo see my edit above for a potential solution to your issue.

--------------
Also, how are the events in rules.csv ordered? I'm currently trying to make an alternate PickGreeting if the character has given a quest (i.e. waiting for the player to bring the required stuff), but when I added the line to accept the delivery, it doesn't seem to be called at all.

How are you are you providing the check for the quest? Simply adding a rule with the PickGreeting trigger will have it be a possible option when speaking with an npc unless you have added others with higher default scores, but whether or not you see it as an option is determined by the conditions you set and whether they are being recognized.

If would help to see the conditions you use and to ensure the rule has a unique name and is not an override of an existing one.

If I am misunderstanding the issue and its a rule command in the script section of the rule that is not working, link me the rule and any errors that show up when selecting the dialogue in game.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5739 on: November 23, 2019, 12:19:18 PM »

Sorry, I'm not quite sure how to explain what's going wrong either since I'm just fumbling around with the file at the moment... I tried adding some to the two conditions that should change (bottom two), but when I added the tag, it seems they both get ignored instead and the default (top 3) conversation is picked... Below is the relevant slice of my rule.csv.

So when the fetch quest begins I want the game to prioritize checking the rna_deliverJob over mvt_rinaGreetingTalkedToWithQuest, which is the alternate greeting for when a quest is underway but not complete. But it seems it only ever want to display mvt_rinaGreetingTalkedToWithQuest.

Oh, and as mentioned above, when I added the $tag:RinaFetchQuestDeliver score:1000 line in the conditions, it seems they both got ignored and the game instead displayed mvt_rinaGreetingTalkedTo

Take a look in starsector.log; when the game is run in devMode, it should have info about which rules are picked and why, which conditions matched/didn't match, and so on.

Offhand, I suspect that "RinaFetchQuestDeliver" is not actually a tag that your entity has - and, actually, you're talking to a PersonAPI at that point, so maybe the entity has that tag (added via, say, entity.addTag() or its definition in custom_entitis.json) but the person doesn't. But, right, the logfile will have the info you need, more than likely.


Tags are used for sector entity properties, e.g. $tag:station = true for orbital stations. I'm not sure persons even have them.
When/how are you setting the tag? Maybe your check needs to look at the entity rather than the person, e.g. $entity.tag:RinaFetchQuestDeliver
(but this is bad since a market can have more than one entity, you probably want to use market memory instead)

People do have tags, but, right, all good points otherwise.


In the same vein, is there a listener for a market decivilizing?

Added to my list!


            "FPE"); // faction

Could anyone help me please?

That exception there means the faction with that ID does not exist.


If I wanted to play a campaign with a much smaller sector and just a few systems with many planets/moons/bases

How would I go about creating such a sector? Is it even possible while using mods? (Nexerelin and all factions I could find from forum)

I'm looking for a small sector where systems are close together (closer than 20 days flight) with maybe 15-20 systems.

each system having enough objects (Planets/Moons/Bases) to fit the factions.

Is that even possible without heavy coding? (my knowledge is basically limited to modifying .json, not writing my own)

Some of this would require code - especially modifying core systems and what factions have what.

You could change the sector size in settings.json:
"sectorWidth":164000,
"sectorHeight":104000,

If it's small enough, it won't fit as many stars. There are some csvs (planet_gen_data.csv, star_gen_data.csv) that affect how many planets/moons etc there are and all that. But this is really a bigger discussion than this thread is great for. It's really best for more specific issues.
Logged

Plasmatic

  • Admiral
  • *****
  • Posts: 500
  • Curious no?
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5740 on: November 23, 2019, 01:10:00 PM »

-Snip-
If I wanted to play a campaign with a much smaller sector and just a few systems with many planets/moons/bases

How would I go about creating such a sector? Is it even possible while using mods? (Nexerelin and all factions I could find from forum)

I'm looking for a small sector where systems are close together (closer than 20 days flight) with maybe 15-20 systems.

each system having enough objects (Planets/Moons/Bases) to fit the factions.

Is that even possible without heavy coding? (my knowledge is basically limited to modifying .json, not writing my own)

Some of this would require code - especially modifying core systems and what factions have what.

You could change the sector size in settings.json:
"sectorWidth":164000,
"sectorHeight":104000,

If it's small enough, it won't fit as many stars. There are some csvs (planet_gen_data.csv, star_gen_data.csv) that affect how many planets/moons etc there are and all that. But this is really a bigger discussion than this thread is great for. It's really best for more specific issues.

I figured as much, thanks :) I'll have to wait till a sector generation slider comes along in the updates *wink*
Logged
"Better to remain silent and be thought a fool than to speak out and remove all doubt"
- Maurice Switzer

King Alfonzo

  • Admiral
  • *****
  • Posts: 679
  • -- D O C T O R --
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5741 on: November 23, 2019, 04:48:50 PM »

            "FPE"); // faction

Could anyone help me please?

That exception there means the faction with that ID does not exist.

Thanks for that! Completely forgot the faction id was in lower case.

EDIT: Dammit, now I've run into another problem.

Code
121093 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: org.json.JSONException: JSONArray[1] is not a number.
java.lang.RuntimeException: org.json.JSONException: JSONArray[1] is not a number.
at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
at com.fs.starfarer.title.TitleScreenState.dialogDismissed(Unknown Source)
at com.fs.starfarer.ui.N.dismiss(Unknown Source)
...
Caused by: org.json.JSONException: JSONArray[1] is not a number.
...

This problem appears to be probably caused by a mispelling in my economy file. I've been through the thing three times, essentially redoing some copypaste from industries.csv and market_conditions.csv, and I can't find where the problem is. While trying to debug, it appeared that the thing crashes regardless of what I remove from the file itself, so I'm not entirely sure exactly what part of the file causes the crash. The file is in the right format, the economy.json file points to this file correctly, and the entities exist in the compile code. Consequently I think I've made a basic hash of something. Could anyone lend me assistance please?

Link to the offending file here.

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5742 on: November 24, 2019, 07:06:07 AM »

More stupid questions - before I spawn a fleet that will raid/attack, I need a target system/market

How to get:
a) a valid random system with an asteroid field/ring
b) a valid random market

I know I can use a list of markets that will work for Corvus mode, but for random galaxy I need something else.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5743 on: November 24, 2019, 10:38:48 AM »

This problem appears to be probably caused by a mispelling in my economy file.
What leads you to believe that's the case? I didn't see anything wrong with it either, although it's certainly possible that we're both overlooking something. That error makes it look like there's something wrong with a list of numbers in a json file though, which your economy file doesn't (and afaik shouldn't) contain.

How to get:
a) a valid random system with an asteroid field/ring
b) a valid random market
Using these collections you should be able to fill a WeightedRandomPicker or other collection with systems or markets that meet your criteria:
Code: java
Global.getSector().getEconomy().getMarketsCopy();
Global.getSector().getStarSystems();

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5744 on: November 24, 2019, 02:51:49 PM »

How can I make the drones spawned by a shipsystem stop where they are spawned? I tried setting their acceleration to 0 while leaving a good deceleration, but the only thing that happens is they keep floating away in the direction of the mothership's velocity when they spawned...
Logged
Pages: 1 ... 381 382 [383] 384 385 ... 706