Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 366 367 [368] 369 370 ... 710

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

RAYhill

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5505 on: October 27, 2019, 05:34:30 AM »

edited
« Last Edit: January 31, 2024, 02:06:25 PM by RAYhill »
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5506 on: October 27, 2019, 06:07:05 AM »

How can you set a child module to be rendered on top of weapons? For example, a block of armor that rests atop a weapon and only reveals it when it is removed, like SCY's Nemean Lion. When I clamped some station modules on my ship, they always get rendered under the weapons...
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5507 on: October 27, 2019, 10:25:15 AM »

@Sundog: thank you for helping out here!

Could someone tell me if I'm missing something?
I can't think of anything likely off the top of my head, but then I'm not exactly a rules.csv guru. It might be a good idea to post the relevant rules.csv rows so people can take a look.

Here's the section of rules.csv I'm using, and here's the salvage file that's used in the event.

If you run the game in dev mode, the log will show a lot of stuff regarding which rule is picked and why, so I'd recommend looking at that.

Also where is what conditions an industry needs determined?

See: Industry.isAvailableToBuild(). Farming and Mining (and some other ones) have implementations that could be useful for reference.

How can you set a child module to be rendered on top of weapons? For example, a block of armor that rests atop a weapon and only reveals it when it is removed, like SCY's Nemean Lion. When I clamped some station modules on my ship, they always get rendered under the weapons...

I'm not sure how this is done in SCY, hmm. Possibly decorative weapons are involved? But, again, not sure.
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5508 on: October 27, 2019, 12:39:25 PM »

Also where is what conditions an industry needs determined?

See: Industry.isAvailableToBuild(). Farming and Mining (and some other ones) have implementations that could be useful for reference.
I was hoping that wouldn't be the answer.
I have multiple mining industries, and they all share this code:
Code
	@Override
public boolean isAvailableToBuild() {
if (!super.isAvailableToBuild()) return false;

boolean YunruIsPossible = false;
boolean YunruCanBuild = false;
boolean[] YunruCount = {true, false, false, false, false, false};
int YunruCurrentCount = 0;

if (getSpec().hasTag(YunruNewTags.TAG_1) == true) YunruCurrentCount = 1; // What's the highest count mine to exist?
if (getSpec().hasTag(YunruNewTags.TAG_2) == true) YunruCurrentCount = 2;
if (getSpec().hasTag(YunruNewTags.TAG_3) == true) YunruCurrentCount = 3;
if (getSpec().hasTag(YunruNewTags.TAG_4) == true) YunruCurrentCount = 4;
if (getSpec().hasTag(YunruNewTags.TAG_5) == true) YunruCurrentCount = 5;
if (getSpec().hasTag(YunruNewTags.TAG_6) == true) YunruCurrentCount = 6;

if (getSpec().hasTag(YunruNewTags.TAG_1) == true) {
for (MarketConditionAPI mc : market.getConditions()) {
String commodity = ResourceDepositsCondition.COMMODITY.get(mc.getId());
if (commodity != null) {
String industry = ResourceDepositsCondition.INDUSTRY.get(commodity);
if (Industries.MINING.equals(industry)) YunruIsPossible = true;
}
}
} else YunruIsPossible = true; // No need to check further mines, since the first is needed to build them and it already checked

if (YunruIsPossible = true) {
for (Industry ind : market.getIndustries()) {
if (ind.getSpec().hasTag(Industries.MINING) && ind.getSpec().hasTag(YunruNewTags.TAG_1)) {
YunruCount[1] = true; // Mine 1 exists
}
if (ind.getSpec().hasTag(Industries.MINING) && ind.getSpec().hasTag(YunruNewTags.TAG_2)) {
YunruCount[2] = true; // Mine 2 exists
}
if (ind.getSpec().hasTag(Industries.MINING) && ind.getSpec().hasTag(YunruNewTags.TAG_3)) {
YunruCount[3] = true; // Mine 3 exists
}
if (ind.getSpec().hasTag(Industries.MINING) && ind.getSpec().hasTag(YunruNewTags.TAG_4)) {
YunruCount[4] = true; // Mine 4 exists
}
if (ind.getSpec().hasTag(Industries.MINING) && ind.getSpec().hasTag(YunruNewTags.TAG_5)) {
YunruCount[5] = true; // Mine 5 exists
}
for (int i = 0; i < YunruCurrentCount; i++)  { // Checks all previous mines to this one
if (YunruCount[i] != true) {
break; // If any previous mines don't exist, can't be built
}
else if (i == YunruCurrentCount - 1) {
YunruCanBuild = true;
}
}
}
}
return YunruCanBuild;
}
But only the first is ever available to build, and a second added through something like console commands doesn't produce anything.
What am I missing?

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5509 on: October 27, 2019, 02:46:57 PM »

How can you set a child module to be rendered on top of weapons? For example, a block of armor that rests atop a weapon and only reveals it when it is removed, like SCY's Nemean Lion. When I clamped some station modules on my ship, they always get rendered under the weapons...
Have you tried reordering the weapon slots in the .ship file? Maybe if the station slot was put above all the other weapons, it'll be rendered on top.
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5510 on: October 27, 2019, 04:24:08 PM »

Have you tried reordering the weapon slots in the .ship file? Maybe if the station slot was put above all the other weapons, it'll be rendered on top.
Yeah, I tried this but no dice... I also tried looking at the lion's animation code, but I can't seem to find what I need. I'll probably just revisit it later.

EDIT: Going by what Alex said, I took a look at the lion's sprite files and what do you know, it turns out it also uses a decorative weapon with the exact same sprite and position as the armor modules. It then uses that to cover the weapons (moving both the station and the decor at once). Ingenious.
« Last Edit: October 28, 2019, 05:52:28 AM by creature »
Logged

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5511 on: October 28, 2019, 02:36:22 PM »

I'm making a faction planet, and I have most things set up: faction, system, planet, markets, patrols. There's one thing I can't seem to find, which is, how do I set the planet to be the faction's home planet? Specifically, if I start a new game in Nexerelin, how do I start spawned at that planet, and not out in hyperspace?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5512 on: October 29, 2019, 06:17:44 AM »

I'm making a faction planet, and I have most things set up: faction, system, planet, markets, patrols. There's one thing I can't seem to find, which is, how do I set the planet to be the faction's home planet? Specifically, if I start a new game in Nexerelin, how do I start spawned at that planet, and not out in hyperspace?
data/config/exerelin/corvus_spawnpoints.csv (DME and possibly some other mods have an example)
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5513 on: October 29, 2019, 08:02:42 AM »

What is the best way to remove the AI of a module? I want to make shield modules manually controlled by the main ship system, but since the modules have their own AI they keep toggling their shields by themselves.

I tried making a dummyAI with no methods implemented, but i get nullpointers this way.
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5514 on: October 29, 2019, 09:03:31 AM »

Hmm - have you tried ship.setShipAI(null) on the module? Otherwise: seeing what you did and what the exception is could help figure it out.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5515 on: October 29, 2019, 09:57:11 AM »

Hmm - have you tried ship.setShipAI(null) on the module? Otherwise: seeing what you did and what the exception is could help figure it out.
I just set the module shipAi null as you suggested, by the main ship system, and got the same error

Code
98852 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.combat.entities.Ship$ShipAIWrapper.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.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)

It doesn't tell me where exactly the problem is

-edit-

problem was the AiFlags being null

Code
public edshipyard_Dummy_AI() {
        AIFlages = new ShipwideAIFlags();
}

this fixed it
« Last Edit: October 29, 2019, 10:10:21 AM by Ed »
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5516 on: October 29, 2019, 10:03:51 AM »

Ahh, right, never mind, that won't work. But a dummy plugin implementing ShipAIPlugin should work, I believe, as long as its getConfig() and getAIFlags() methods return not-null.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5517 on: October 29, 2019, 10:12:26 AM »

Ahh, right, never mind, that won't work. But a dummy plugin implementing ShipAIPlugin should work, I believe, as long as its getConfig() and getAIFlags() methods return not-null.
Yep made the dummy and it works now,
Logged
Check out my ships

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5518 on: October 30, 2019, 05:48:02 AM »

Is there a way to alter vanilla plugins?
Specifically I want blueprint packages to give individual blueprints instead, but a new plugin means it doesn't work unless the package calls the new plugin instead (which is problematic with mods).

Failing that, is there a way to (effectively) do a search and replace on which plugin a blueprint calls?

MajorTheRed

  • Captain
  • ****
  • Posts: 289
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5519 on: October 30, 2019, 06:50:01 AM »

A really dumb question, especially since I've been modding for a moment now...

In hull.csv, what is the "8/6/5/4%" column for?
Logged
Pages: 1 ... 366 367 [368] 369 370 ... 710