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 ... 51 52 [53] 54 55 ... 706

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

Verrius

  • Captain
  • ****
  • Posts: 369
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #780 on: September 16, 2013, 03:02:06 PM »

Alright, yeah that was pretty simple :p.

So far I've gotten most of it working how I want it to, I'm just trying to find a good way to display what the stations are doing to the player visually.

Is there is a way to have text or other assets displayed on the screen, perhaps underneath the picture that's already there? These UI Panels are making my head spin, and it looks ugly to have it displayed in the text window above.

Darloth

  • Admiral
  • *****
  • Posts: 592
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #781 on: September 16, 2013, 03:55:21 PM »

Should I call addScript only once onNewGame, or every onGameLoad? (or in onEnabled? I suppose I'm asking where to call sector.addScript() as well as how often :) )

I'm currently guessing onGameLoad - I don't think anything too terrible will happen if it runs more than once, but eventually it's going to start slowing everything down if it's running multiple times, so I'd like to know for sure please.
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #782 on: September 16, 2013, 04:31:39 PM »

Alright, yeah that was pretty simple :p.

So far I've gotten most of it working how I want it to, I'm just trying to find a good way to display what the stations are doing to the player visually.

Is there is a way to have text or other assets displayed on the screen, perhaps underneath the picture that's already there? These UI Panels are making my head spin, and it looks ugly to have it displayed in the text window above.

And thanks to you I got it working too! Given, creating an 1.6jdk jar was a pain to understand (with netbeans).
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #783 on: September 16, 2013, 05:48:24 PM »

Actually, note: you should ideally be using CharacterCreationData.setStartingLocationName() in your character creation process. SectorAPI.setCurrentLocation() works too, though.

(If you need to set the starting location to hyperspace, use CharacterCreationData.HYPERSPACE_NAME_TOKEN as the starting location name.)
--- snip ---

I think in 0.54 it did the generation after the CharacterCreation stuff, I'm assuming that is still the case? (haven't really looked)

Given the above assumption is correct, and I'm generating a random sector/systems, I won't know the name of a valid system prior to generation? Could take a guess but... :)

setStartingLocationName() is new in 0.6a.

Hmm... yeah, this is a problem. What you could do is set that start location to hyperspace, and then use SectorAPI.setCurrentLocation(), and then remove the fleet from hyper + add it to the system you'd like it to be in. Or just leave it starting hyper. Except that won't work til 0.6.1a, so for now the only real solution is to hardcode at least 1 system name and THEN move it to wherever you actually want it to start.

One note: you'll have to do it in onGameLoad() or onEnabled() and then save a flag in the persisted data, or somewhere else. onNewGame is called before the player fleet actually exists.


Is there is a way to have text or other assets displayed on the screen, perhaps underneath the picture that's already there? These UI Panels are making my head spin, and it looks ugly to have it displayed in the text window above.

There is not. The text always goes in the top left section.


Should I call addScript only once onNewGame, or every onGameLoad? (or in onEnabled? I suppose I'm asking where to call sector.addScript() as well as how often :) )

I'm currently guessing onGameLoad - I don't think anything too terrible will happen if it runs more than once, but eventually it's going to start slowing everything down if it's running multiple times, so I'd like to know for sure please.

Depends on if the script's isTransient() returns true or false. Transient scripts should be added onGameLoad - this is the preferred way to do things because then, if the mod is disabled, the scripts don't stick around and the savegame can be played w/o the mod. If the script is not transient, it should be added onNewGame. (Ideally, onModEnabled(), but right now, due to a bug, that gets called on every load.)
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #784 on: September 17, 2013, 06:48:00 AM »

So, thanks to LazyWizard I now have a sector, which still needs a lot of work.
The one thing that struck me first though was this:

Spoiler

[close]

I don't think the Hiigarans will live long, what with this supernova going on.
My star is actually smaller than the Askonian one, I have no idea what's causing this.
The texture used is 1024x512 in size.

Has anyone come across this perhaps?

@silentstormpt VVV - if all else fails I'll do that. x)

Edit: Atmosphere thickness was too high. It was 10 while vanilla value for Corus' sun was 0.25.
« Last Edit: September 17, 2013, 10:47:23 AM by Gotcha! »
Logged
  

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #785 on: September 17, 2013, 07:24:24 AM »

Alright, just set the  background texture to a white one and change the star color to red.

BANZAI!
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 911
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #786 on: September 17, 2013, 08:38:37 AM »

Ooooookaaaaayyy.  I've been wrestling with a completely bizarre error.  It's only popping up in the Mission List refit screen; good thing too, else the campaign would be unplayable since it leads to a sudden and unhelpful CTD.

I've managed to determine that it is somehow related to the ejector seat hullmod I added to Shadowyards fighters, but I have no idea how.  Comparing it to existing hullmods reveals nothing that should cause the error and the code is obviously not causing this error in campaign.  Since it doesn't appear to be effecting other custom hullmods I've been grasping at straws; I tried removing the hull size limitations, to no effect, as well as removing it from the fighters, as well as turning on onEnable in the ModPlugin file I've added and reverting to generators.csv in increasingly wacky ploys to figure out where this problem is coming from.

The hull mod (which still looks fine)
Code
package data.hullmods;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;

public class ms_enjector extends BaseHullMod {

public static final float CASUALTY_REDUCTION = 66f;

    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
stats.getCrewLossMult().modifyMult(id, 1f - CASUALTY_REDUCTION * 0.01f);
}

    public String getDescriptionParam(int index, HullSize hullSize) {
if (index == 0) return "" + (int) CASUALTY_REDUCTION;
return null;
}

public boolean isApplicableToShip(ShipAPI ship) {
return (ship.getHullSize() == HullSize.FIGHTER);
}
}


And the completely unhelpful error log.
Code
java.util.UnknownFormatConversionException: Conversion = '.'
java.util.UnknownFormatConversionException: Conversion = '.'
at java.util.Formatter.checkText(Unknown Source)
at java.util.Formatter.parse(Unknown Source)
at java.util.Formatter.format(Unknown Source)
at java.util.Formatter.format(Unknown Source)
at java.lang.String.format(Unknown Source)
at com.fs.starfarer.loading.specs.voidsuper.new(Unknown Source)
at com.fs.starfarer.coreui.refit.ModPickerDialog$o.<init>(Unknown Source)
at com.fs.starfarer.coreui.refit.ModPickerDialog.Ööo000(Unknown Source)
at com.fs.starfarer.coreui.refit.ModPickerDialog.<init>(Unknown Source)
at com.fs.starfarer.coreui.refit.C.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.O00oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.o00000(Unknown Source)
at com.fs.starfarer.ui.F.processInput(Unknown Source)
at com.fs.starfarer.ui.T.super(Unknown Source)
at com.fs.starfarer.OoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.float.if$super(Unknown Source)
at com.fs.A.A.new(Unknown Source)
at com.fs.starfarer.combat.D.super(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

At this point I suspect I may just be getting a bug with openjdk.  Anyone know what's up?

E: Oh, and I should probably note that I know the hullmod is causing it because removing it caused the crashing to stop.
« Last Edit: September 17, 2013, 08:49:37 AM by MShadowy »
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3784
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #787 on: September 17, 2013, 09:02:00 AM »

Hm... I'd guess that the description string isn't formatted right.  Not quite sure where that string is hiding, though, probably some csv file somewhere?

Edit: Note that I'm not talking about the string being returned by getDescriptionParam - that's getting substituted into a description string that lives somewhere else, and it's that other string that probably has formatting issues.
« Last Edit: September 17, 2013, 09:25:15 AM by Wyvern »
Logged
Wyvern is 100% correct about the math.

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #788 on: September 17, 2013, 09:19:41 AM »

be careful:

return "" + (int) CASUALTY_REDUCTION;

should be something like

return Integer.toString((int) CASUALTY_REDUCTION);
or
return String.valueOf((int) CASUALTY_REDUCTION);
or
return String.valueOf(CASUALTY_REDUCTION);
or
return Float.toString(CASUALTY_REDUCTION);

personally the best option is the 3rd or 4th since it directly converts float to String.
« Last Edit: September 17, 2013, 09:31:34 AM by silentstormpt »
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3784
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #789 on: September 17, 2013, 09:23:36 AM »

@Silentstormpt: Why?  I can't see any particular advantage to using those, and the third option in particular is critically flawed in that it won't round - and, given floating point inaccuracy, you might end up with a string that looks like "3.00000001" instead of the desired "3".
Logged
Wyvern is 100% correct about the math.

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #790 on: September 17, 2013, 09:27:46 AM »

@Silentstormpt: Why?  I can't see any particular advantage to using those, and the third option in particular is critically flawed in that it won't round - and, given floating point inaccuracy, you might end up with a string that looks like "3.00000001" instead of the desired "3".

In hes case not really since its a default 66f, if that was the case the 1st and 2nd option i posted would be correct (meaning your right).
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 911
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #791 on: September 17, 2013, 09:42:31 AM »

Hm... I'd guess that the description string isn't formatted right.  Not quite sure where that string is hiding, though, probably some csv file somewhere?

Edit: Note that I'm not talking about the string being returned by getDescriptionParam - that's getting substituted into a description string that lives somewhere else, and it's that other string that probably has formatting issues.

Derp, that was it.  While running my comparisons with other hullmods, I did check the csv file, which does hold the descriptions, but completely failed to realize the using a "%" symbol made a call to an external file, so it was looking for "%." which didn't exist.  Derp derp derpity doop.
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #792 on: September 17, 2013, 10:25:07 AM »

How much distance in px, does 1 fuel allow?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #793 on: September 17, 2013, 10:41:10 AM »

Hm... I'd guess that the description string isn't formatted right.  Not quite sure where that string is hiding, though, probably some csv file somewhere?

Edit: Note that I'm not talking about the string being returned by getDescriptionParam - that's getting substituted into a description string that lives somewhere else, and it's that other string that probably has formatting issues.

Derp, that was it.  While running my comparisons with other hullmods, I did check the csv file, which does hold the descriptions, but completely failed to realize the using a "%" symbol made a call to an external file, so it was looking for "%." which didn't exist.  Derp derp derpity doop.

Btw: if you want a % in the description, use %%.


How much distance in px, does 1 fuel allow?

Depends on the fuel per light year stat of the ship. How many pixels per light year is defined in settings.json; currently it's 2000.
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #794 on: September 17, 2013, 12:57:30 PM »

Are four jump points the minimum? I always get an extra fringe jump point which I don't want, but I can't see a way to remove it.
(My system always has two fringe jump points.)

Does this have anything to do with it?
system.autogenerateHyperspaceJumpPoints(true, true);
Logged
  
Pages: 1 ... 51 52 [53] 54 55 ... 706