Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 241 242 [243] 244 245 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3630 on: October 19, 2017, 09:01:52 AM »

I think these methods in FleetMemberStatusAPI might cover what you want:

void setDetached(int index, Boolean detached);
void setHullFraction(int index, float hullFraction);
boolean isDetached(int index);

"index" is the index of the module, in each case. index = 0 is the main body of the station.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3631 on: October 20, 2017, 08:56:35 AM »

I found that if a module ship part is overloaded, it will spread out emp arcs randomly, can i turn it off?
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3632 on: October 20, 2017, 09:48:46 AM »

I'm not sure what you mean, would you mind elaborating or posting a screenshot?
Logged

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3633 on: October 23, 2017, 06:56:10 PM »

Hi all!
For some weird reason, asking for
Code: java
Global.getLogger(Someclass.class).log(Level.INFO,member.getHullSpec().getShieldType());
in "public class Someclass implements Buff" results in
Spoiler
Code: java
34900 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at data.scripts.campaign.Someclass.apply(Someclass.java:129)
at com.fs.starfarer.loading.specs.c.o00000(Unknown Source)
at com.fs.starfarer.title.ooOO.OO0O.super(Unknown Source)
at com.fs.starfarer.title.ooOO.OO0O.super(Unknown Source)
at com.fs.starfarer.coreui.Oooo.super(Unknown Source)
at com.fs.starfarer.ui.j.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.ui.OO00.renderImpl(Unknown Source)
at com.fs.starfarer.ui.newui.F.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.ui.OO00.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Oo0O.renderImpl(Unknown Source)
at com.fs.starfarer.ui.newui.K.renderImpl(Unknown Source)
at com.fs.starfarer.ui.newui.newsuper.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.ui.OO00.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.render(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)
[close]
line 129 is exactly "getShieldType()" one.

Any thoughts?
« Last Edit: October 23, 2017, 07:00:35 PM by Iridescens »
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3634 on: October 24, 2017, 11:53:53 AM »

Hi all!
For some weird reason, asking for
Code: java
Global.getLogger(Someclass.class).log(Level.INFO,member.getHullSpec().getShieldType());
in "public class Someclass implements Buff" results in
Spoiler
Code: java
34900 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at data.scripts.campaign.Someclass.apply(Someclass.java:129)
at com.fs.starfarer.loading.specs.c.o00000(Unknown Source)
at com.fs.starfarer.title.ooOO.OO0O.super(Unknown Source)
at com.fs.starfarer.title.ooOO.OO0O.super(Unknown Source)
at com.fs.starfarer.coreui.Oooo.super(Unknown Source)
at com.fs.starfarer.ui.j.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.ui.OO00.renderImpl(Unknown Source)
at com.fs.starfarer.ui.newui.F.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.ui.OO00.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Oo0O.renderImpl(Unknown Source)
at com.fs.starfarer.ui.newui.K.renderImpl(Unknown Source)
at com.fs.starfarer.ui.newui.newsuper.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.ui.OO00.renderImpl(Unknown Source)
at com.fs.starfarer.ui.Q.render(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.render(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)
[close]
line 129 is exactly "getShieldType()" one.

Any thoughts?

Global.getLogger(Someclass.class).log(Level.INFO,member.getHullSpec().getShieldType())
If you have a nullpointerexception, so you need to see what you have put on your line:

Here, you have probably forgot than member can be null maybe , on your code, so you need to put if(member != Null)
And, i have not idea if hullspec can be null, but else, you need to change that per if(member !=Null && member.getHullSpec() != Null)

For the shieldType, exist always, a shield can be none(else, the game crash when you try to made a ship without shieldtype, i think, but this is not the case, here), so normally, no problem.
I have not idea if Global.getLogger accept Null on the second parameter, but the second if can probably resolve your problem.
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3635 on: October 25, 2017, 02:36:48 AM »

The ShieldType on that "member" is FRONT. And the thing is, the Logger does log the ShieldType as FRONT! And then, "blam!" NullPointerException.
It does nothing with Logger call though, because it raises Exception even when I'm checking ShieldType in plain "If" statement.

If that will shed some light, I tried to check the shieldType inside the dialog, but as recall member.getHullSpec() does not require you to be in combat. And somewhy still the error comes from com.fs.starfarer.combat.CombatMain.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3636 on: October 25, 2017, 02:59:13 AM »

The ShieldType on that "member" is FRONT. And the thing is, the Logger does log the ShieldType as FRONT! And then, "blam!" NullPointerException.
It does nothing with Logger call though, because it raises Exception even when I'm checking ShieldType in plain "If" statement.

If that will shed some light, I tried to check the shieldType inside the dialog, but as recall member.getHullSpec() does not require you to be in combat. And somewhy still the error comes from com.fs.starfarer.combat.CombatMain.
 

You have tried like that, sure?
Code
 if(member !=Null && member.getHullSpec() != Null)
  Global.getLogger(Someclass.class).log(Level.INFO,member.getHullSpec().getShieldType());  

Else, i sincerely don't know.


Edit: you can also give the line above and belove this line for be sure?
« Last Edit: October 25, 2017, 03:21:22 AM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Alex

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

The ShieldType on that "member" is FRONT. And the thing is, the Logger does log the ShieldType as FRONT! And then, "blam!" NullPointerException.

If that's the case, then it's definitely not crashing on that line, whatever the stack trace says.

Also, don't worry about the CombatMain part - the entry point into the game is named that, for legacy reasons. Every stack trace will have that, regardless of whether the game is in combat or in the campaign.
Logged

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3638 on: October 25, 2017, 04:29:13 PM »

I've checked the
Code: java
if(member!= null && member.getHullSpec() != null && 
(member.getHullSpec().getShieldType()==ShieldType.FRONT ||
member.getHullSpec().getShieldType()==ShieldType.OMNI) )
thing and it actually works. No edits except these checks. It seems that the original mod somehow managed to sneak past "member.getHullSpec()" checks altogether in shiny armour whereas my edits were getting 'dirty' data. I still don't quite understand why did it work before, but who am i to judge the winner, after all.
Thank you @Snrasha for exceptional insight!
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3639 on: October 25, 2017, 11:56:24 PM »

Alex, i have a question about for made a Nebula System.

I have look on the starsystemgenerator and i have see my problem, now i have a nebula system with jumppoint for out and in without crashing.
Because AutogenerateJumpPoint dislike the lack of Star.

But:
The script who made AutogenerateJumpPoint on  random Nebula starsystem delete the Star before then after, re-insert.  But do not work if you have market on the Nebula System, it seems, else crash.
So i have autogenerateJumpPoint with the Star, then i have deleted him.

So, like say before, all work perfectly, no crash when i try to pass a jump point or i put my cursor above, and i can return on the Nebula system without problem.
The unique problem than i have now is just than: Well, the system is not display on the Map.

Nebula starsystem who contains market:
Quote
StarSystemAPI system = sector.createStarSystem("Uclora");
        system.getLocation().set(-10000, -17000);
        system.setType(StarSystemType.NEBULA);   <-- Put the system on Nebula.
        system.setBackgroundTextureFilename("graphics/backgrounds/Noir_back.jpg");

        PlanetAPI star = system.initStar("noir_staruclova", "star_yellow", 100, 10);   <-- False Star

    //  [ . . . ]    <- Planet,relay and jumppoint created here.

    
Code: Nebula system code
    system.removeEntity(star);
        StarCoronaTerrainPlugin coronaPlugin = Misc.getCoronaFor(star);
        if (coronaPlugin != null) {
            system.removeEntity(coronaPlugin.getEntity());
        }

        system.setStar(null);
        system.initNonStarCenter();
        for (SectorEntityToken entity : system.getAllEntities()) {
            if (entity.getOrbitFocus() == star
                    || entity.getOrbitFocus() == system.getCenter()) {
                entity.setOrbit(null);
            }
        }

        star.setSkipForJumpPointAutoGen(true);


        system.setStar(star);
        star.addTag(Tags.AMBIENT_LS);
        system.autogenerateHyperspaceJumpPoints(true, false);
        system.setStar(null);
        system.initNonStarCenter();
        system.getCenter().addTag(Tags.AMBIENT_LS);


Thank you!

Image of the two nebula hidden starsystem where i am:
Spoiler

[close]
« Last Edit: October 26, 2017, 09:02:05 AM by Snrasha »
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3640 on: October 26, 2017, 09:23:10 AM »

You've almost got it - the code to autogen the jump-points would generate a gravity well for a star if one was there, so we remove the star and replace it with initNonStarCenter() instead.

But *after* autogenerating the jump-points, we need to set a star for the system in order for it to show up on the map. In the case of a nebula, it ought to be one of:

nebula_center_old
nebula_center_average
nebula_center_young

In planets.json. You could also do up a custom one if you want something specific, based on one of those.

They are invisible in the system view, due to having no texture, and you want to set their radius to 0 as well, so they can't be clicked on. But they will show up in the hyperspace map view.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3641 on: October 26, 2017, 10:00:50 AM »

Thank you.

Work properly, now.
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3642 on: October 27, 2017, 11:43:42 AM »

Not sure if anyone has overwritten the tutorial so this may be an Alex question, but:

When you call this:

Global.getSector().reportEventStage(this, "eldrus_start", Global.getSector().getPlayerFleet(),
               MessagePriority.DELIVER_IMMEDIATELY, createSetMessageLocationScript(eldrus));

To create a mission log message for the player, I'm looking for all the scripts that go into what gets displayed.

I know:
      -     Reports.csv determines the contents of the dialogue
      -     The createSetMessageLocationScript(PersonAPI/CampaignFleetAPI/PlanetAPI) method determines where the sensor ping location will be on the map when you click the message.
      -     Use Misc.makeImportant(eldrusGuard, REASON); to make the yellow "!" appear on the entity for the mission.
      -     You can use (I think) Reports.csv to determine the image and logo as well as the comms channel source, but the tutorial itself doesn't use that way to do it.

So:
     -      Is this method ever called from TutorialMissionEvent.java? public String getCurrentImage()
     -      Or this one?    public String getEventIcon() {
      return Global.getSettings().getSpriteName("campaignMissions", "tutorial");
   }


      -     Do these two play any role in the above method?? If not, how does the tutorial always source from Ancyra and the Hegemony for the message?


« Last Edit: October 27, 2017, 11:46:46 AM by Morrokain »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3643 on: October 27, 2017, 12:03:45 PM »

    -      Is this method ever called from TutorialMissionEvent.java? public String getCurrentImage()

Yeah, it determines the big image in the message detail, i.e. when you click on it in the intel screen. I *think* it'll fall back to the faction logo for the message location entity if that returns null.

    -      Or this one?    public String getEventIcon() {
      return Global.getSettings().getSpriteName("campaignMissions", "tutorial");
   }


That's the icon in the filter in the intel screen.

     -     Do these two play any role in the above method?? If not, how does the tutorial always source from Ancyra and the Hegemony for the message?

Either those two methods, or the faction of the message-location entity, depending on what you mean.
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 #3644 on: October 27, 2017, 12:48:34 PM »

    -      Is this method ever called from TutorialMissionEvent.java? public String getCurrentImage()

Yeah, it determines the big image in the message detail, i.e. when you click on it in the intel screen. I *think* it'll fall back to the faction logo for the message location entity if that returns null.

Ah I see. Well, maybe I just have an error (like its the wrong stage I'm actually needing to check for or something) but this:

   @Override
   public String getCurrentImage() {
        if (stage == TutorialMissionStage.GO_TO_ELDRUS) {
            return eldrus.getFaction().getLogo();
        }
        if (stage == TutorialMissionStage.RETURN_FROM_ELDRUS) {
            return eldrus.getFaction().getLogo();
        } else {
            return ancyra.getFaction().getLogo();
        }


Doesn't seem to do it.  :-\

Let me test some more, but thanks for the confirmation!
« Last Edit: October 27, 2017, 12:50:35 PM by Morrokain »
Logged
Pages: 1 ... 241 242 [243] 244 245 ... 710