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 ... 178 179 [180] 181 182 ... 706

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

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2685 on: February 11, 2016, 11:15:54 AM »

Well I tried following this one (http://fractalsoftworks.com/forum/index.php?topic=4344.msg67576) but I didn't manage to compile anything and the code I had presented a bunch of errors (even though it was pretty much a carbon copy of something I know it worked), probably because I might have messed up when adding libraries of stuff like LazyLib and the sort, I'm not really certain how to do these things. And updated tutorial would be nice if there is one around.

Unrelated but can anyone tell if the number of ships the AI deploys is dependent on the total FP of your fleet or is it dependent on the total FP that you deploy?
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2686 on: February 11, 2016, 12:56:47 PM »

None idea for your second question.( Because i am french so i do not understand this sense)

For first, i can help you, same if i use Netbeans, not Eclispe. (But Eclispe is the best, i suppose...) Or not.


So for all eclipse,netbeans(where i know button for that) and etc:
You need so create a new project who follow your mod. (Do not forgot take only java with a thing **/*.java, not reason)
Then, you need go your library and import :
Default:
- starfarer.api.jar
- starfarer.api.zip  (and if possible, you redirect starfarer.api.jar in this source)
- lwjgl.jar
- lwjgl_util.jar
Extra:
-Shaderlib
-Lazylib
For others:
- Others, but this is not for now.

After that, you can build and clean your project(who compile all), after  you need just put your .jar in your mod and redirect mod_info in that.

For your error, send me per private message, i can maybe help you.




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.

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2687 on: February 11, 2016, 01:52:53 PM »

Can anyone point me to a good tutorial on how to compile the .java files to .class files that Starsector will read?

Are you sure you actually need to (pre)compile them? StarSector will auto-compile any .java files (I think if they are under <yourModDirectory>/data/...) for you using Janino.

It is only necessary to pre-compile your .java files if you are using Java features that are not supported by Janino.

If you do need to compile your .java files, I suggest using kazi's guide here:
http://fractalsoftworks.com/forum/index.php?topic=10057.0

and setting your mod up like:
<yourModDirectory>/src (your .java source files go here)
e.g. <yourModDirectory>/src/data/scripts/yourModPlugin.java
<yourModDirectory>/jars (your compiled .jar [a collection of .class files] goes here)
e.g. <yourModDirectory>/jars/yourMod.jar
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2688 on: February 15, 2016, 07:17:23 AM »

I've got some weird bug where a PersonAPI object used as a key in a HashMap stored in SS's persistent data, said map being created in onNewGame(), is apparently changing its hash after save/load. Are "orphaned" PersonAPIs being recreated with same name, portrait, etc. instead of being reloaded?

Spoiler
The Rags to Riches mod creates two PersonAPIs on a new game, stores them in a BaseCampaignEventListener/EveryFrameScript, and saves them to persistent data with the PersonAPI as key and a predefined string as value. (source)
It later adds the objects stored in the BaseCampaignEventListener/EveryFrameScript as officers to the player fleet, once some early game stuff (an informal starter "quest") is done. (source)

I went through the process to get the officers and used a debug command (not in release version):

541772 [Thread-5] INFO  org.lazywizard.console.Console  - Running command "printchatterchars"
541773 [Thread-5] INFO  org.lazywizard.console.Console  - Saved officers:    // this is from persistent data created at start
541774 [Thread-5] INFO  org.lazywizard.console.Console  - Erin Zuma (com.fs.starfarer.rpg.Person@1553854): sunrider_asaga
541774 [Thread-5] INFO  org.lazywizard.console.Console  - Zoltan Andreyev (com.fs.starfarer.rpg.Person@1e1d0c5): default
541774 [Thread-5] INFO  org.lazywizard.console.Console  - Current officers:    // this is what is currently in the playerfleet; added with fleet.getFleetData().addOfficer()
541775 [Thread-5] INFO  org.lazywizard.console.Console  - Zoltan Andreyev (com.fs.starfarer.rpg.Person@1e1d0c5)
541775 [Thread-5] INFO  org.lazywizard.console.Console  - Erin Zuma (com.fs.starfarer.rpg.Person@1553854)


Hashes match.

Quit to main menu, reloaded the after-pregame-time-pass save, repeated the process:

577187 [Thread-5] INFO  org.lazywizard.console.Console  - Running command "printchatterchars"
577188 [Thread-5] INFO  org.lazywizard.console.Console  - Saved officers:
577189 [Thread-5] INFO  org.lazywizard.console.Console  - Zoltan Andreyev (com.fs.starfarer.rpg.Person@187edd1): default
577189 [Thread-5] INFO  org.lazywizard.console.Console  - Erin Zuma (com.fs.starfarer.rpg.Person@10c2827): sunrider_asaga
577189 [Thread-5] INFO  org.lazywizard.console.Console  - Current officers:
577190 [Thread-5] INFO  org.lazywizard.console.Console  - Zoltan Andreyev (com.fs.starfarer.rpg.Person@1e1d0c5)
577190 [Thread-5] INFO  org.lazywizard.console.Console  - Erin Zuma (com.fs.starfarer.rpg.Person@1553854)


Now the hash of the map key PersonAPI no longer matches that of the one stored in the BaseCampaignEventListener.

Is there an explanation for this?
[close]
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2689 on: February 15, 2016, 10:38:43 AM »

You, uh, probably shouldn't use them as a key.  If you're trying to store something, the value is what you're actually trying to store.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2690 on: February 15, 2016, 10:57:59 AM »

(Side note: hashCode() isn't guaranteed to be unique in the first place, and isn't guaranteed to remain the same across invocations of the jvm, per the javadoc.)

A class used as a key in a map etc should generally have suitable hashCode() and equals() methods defined, as the default implementation inherited from Object is likely to produce undesired results. I mean, you can generally put a bunch of <whatever> into a set and rely on that working, but not if you start changing the objects in the set in the meantime.

I'd suggest using person.getId() as the key - that id is generated using UUID and is unique, and is a String and so can safely be used as a key.
Logged

Very Good

  • Ensign
  • *
  • Posts: 16
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2691 on: February 15, 2016, 02:09:30 PM »

How i get more deployment points/make battle bigger?I tried setting it in the setting.json but got Nothing in game:

"minBattleSize":1500, # in supplies-to-recover. min value for settings slider
   "defaultBattleSize":2500, # in supplies-to-recover. starting tvalue for settings slider
   "maxBattleSize":5000, # in supplies-to-recover. max value for settings slider

also if i want to make my officer/npc officer have a higher level cap i need to only change this value?:"officerMaxLevel":200, -EDIT-made the game unstable for me.

also changing this will allow me to hire 200 officer while having a max of 100 in my fleet?

   "officerMaxHireable":200,
   "officerPlayerMax":100,


edit:oh and how i make Bounty last longer?

EDIT 2:ACTUALY EDITING setting.json do not affect my game,why?Oh,i have starsector and nexerlin btw.

EDIT 3:okay,i had to edit starsector one.

edit 4: starsector have proceduraly generated NPC ship layout,how i could allow the NPC to have more ordonance points(and bigger layout,weapons,more mod)?

edit 5:I boosted the deployment points,but i am getting this crash when i try to fight a templar fleet(the crash happen during the battle):


165259 [Thread-11] INFO  sound.oo0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOO  - Creating streaming player for music with id [faction_generic_market_01_hostile_var01.ogg]
165259 [Thread-11] INFO  sound.H  - Playing music with id [faction_generic_market_01_hostile_var01.ogg]
165273 [Thread-9] INFO  sound.F  - Creating music buffer #2
169531 [Thread-5] INFO  com.fs.starfarer.combat.CombatEngine  - FP1: 857, FP2: 211, maxFP1: 3000, maxFP2: 2000
169778 [Thread-5] INFO  org.histidine.chatter.combat.ChatterCombatPlugin  - Chatter plugin initialized
169779 [Thread-5] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading CSV data from [DIRECTORY: F:\A Starsector\starsector-core\..\mods\AI War]
169780 [Thread-5] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading CSV data from [DIRECTORY: F:\A Starsector\starsector-core\..\mods\AI War]
169780 [Thread-5] INFO  data.scripts.plugins.AIW_ForcefieldPlugin  - Forcefield plugin initialized
169780 [Thread-5] INFO  data.scripts.plugins.AIW_GravityDrainPlugin  - Gravity drain plugin initialized
171263 [Thread-11] INFO  sound.oo0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOO  - Creating streaming player for music with id [TheFlagship.ogg]
171264 [Thread-11] INFO  sound.H  - Playing music with id [TheFlagship.ogg]
241035 [Thread-5] INFO  org.histidine.chatter.combat.ChatterCombatPlugin  - Time elapsed: 0.4363334
307770 [Thread-5] INFO  org.histidine.chatter.combat.ChatterCombatPlugin  - Time elapsed: 64.89503
323855 [Thread-11] INFO  sound.oo0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOO  - Creating streaming player for music with id [Relics.ogg]
323867 [Thread-11] INFO  sound.H  - Playing music with id [Relics.ogg]
324019 [Thread-5] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at data.scripts.plugins.TEM_WeaponScriptPlugin.advance(TEM_WeaponScriptPlugin.java:201)
   at com.fs.starfarer.title.ooOO.o0oO$Oo.super(Unknown Source)
   at com.fs.starfarer.combat.oOOO.new.super(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$2.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


« Last Edit: February 16, 2016, 12:36:58 PM by Very Good »
Logged

joe130794

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2692 on: February 16, 2016, 07:47:13 AM »

Could anyone help me set up a simple total conversion for the newest version of starsector, I have a simple add on for mission with my ships but when I try to make it work on the newest version. I am unable to. My mods version is currently 0.65a
Logged

Ahne

  • Captain
  • ****
  • Posts: 321
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2693 on: February 16, 2016, 03:19:38 PM »

How can i let only specific ships spawn in the black markets?  :-\
Logged

joe130794

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2694 on: February 17, 2016, 11:13:12 AM »

Does anyone currently have a basic template for a mod. I used Rushyo's battlestar as a base to get my ships into the game but I can't get it to work with 0.7.1 so if anyone has a basic setup I could use, I would appreciate it. I'm sure there's a few other people wanting to mod that would like it too. Do we need JAR and VERSION files for the 0.7.1 update?
Logged

joe130794

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2695 on: February 17, 2016, 01:28:33 PM »

Also does anyone know if it's possible to edit the accelerated shields hullmod so they are raised instantly??
Thinking of trying it for my Stargate ships if it's possible to do.
Logged

Runoved

  • Lieutenant
  • **
  • Posts: 62
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2696 on: February 18, 2016, 08:17:37 AM »

Hello everyone.

Can you advise me, how can I make a hullmods which would have produced fuel over time? And that while the number of produced fuel would depend on the distance to the nearest star, the closer to the star, the more fuel is produced.

If you already have mod which such already is realized, please show it to me as an example.

Thanks in advance for your help.
Logged

Wind Tempest

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2697 on: February 19, 2016, 11:24:36 AM »

Hello everyone.

So I have started to work on my own mod and am trying to learn the code side of it.  So far I have stumbled through parts of it and gotten it to work to some degree.  I will probably post here several times as I get stuck.

So anyways to the question.
One of the things I have been trying is a mirv type missile that releases flares as a point defense system.  I have gotten the flares to release, however now the mirv missile weapon won't fire on incoming missiles or track them.  I used the data from the Hurricane MIRV and the flare system as a base and added PD into the weapon_data.csv.

Here is the line in the csv:
Ember Missile Rack,ember_rack,1,300,1000,,200,,10,5,6,30,0.2,,ENERGY,0,,0,2,1,,0,0,0,0,,900,100,6,35,"PD,DO_NOT_AIM",9

Here is the weapon I was using:
Spoiler
{
   "id":"ember_rack",
   "specClass":"projectile",
   "type":"MISSILE",
   "size":"SMALL",
   "turretUnderSprite":"graphics/weapons/cmc_s_emberrack_turret_base.png",
   "turretSprite":"graphics/weapons/cmc_s_emberrack_turret.png",
   "hardpointSprite":"graphics/weapons/cmc_s_emberrack_hardpoint.png",   
   "hardpointOffsets":[12, 0, 12, 2, 12, -2, 12, 0],
   "turretOffsets":[2, 0, 0, 2, -2, 0, 0, -2],
   "hardpointAngleOffsets":[0, 0, 0, 0],
   "turretAngleOffsets":[0, 0, 0, 0],
   "barrelMode":"ALTERNATING",
   "animationType":"SMOKE",
   #"renderHints":[RENDER_LOADED_MISSILES],
   "interruptibleBurst":false,
   "displayArcRadius":300,
   "smokeSpec":{"particleSizeMin":10.0,
             "particleSizeRange":16.0,
             "cloudParticleCount":3,
             "cloudDuration":0.9,
             "cloudRadius":8.0,
             "blowbackParticleCount":4,
             "blowbackDuration":1.1,
             "blowbackLength":20.0,
             "blowbackSpread":10.0,
             "particleColor":[170,160,150,130]},
   "projectileSpecId":"ember_shot",
   "fireSoundTwo":"harpoon_fire",
}
[close]

Here is the initial projectile:
Spoiler
{
   "id":"ember_shot",
   "specClass":"missile",   
   "missileType":"MIRV",
   "sprite":"graphics/missiles/cmc_ember.png",
   "size":[5,11],   
   "center":[3,6],
   "collisionRadius":10,
   "collisionClass":"MISSILE_NO_FF",
   "explosionColor":[255,100,10,255],  # purely visual, will get a white additively blended core on top of this color
   "explosionRadius":0, # purely visual
   "engineSpec":{"turnAcc":180,
              "turnRate":90,
              "acc":1500,
              "dec":1000},
   "engineSlots":[{"id":"ES1",
               "loc":[-13, 0],
                #"style":"MISSILE_HIGH_TECH",
                "style":"CUSTOM",
               "styleSpec":{
                  "mode":"QUAD_STRIP", # PARTICLES or QUAD_STRIP, determines which params are used
                  "engineColor":[255,150,100,255],
                  "contrailDuration":2,
                  "contrailWidthMult":1,
                  "contrailWidthAddedFractionAtEnd":2.5,  # can be negative. makes trail spread out/narrow at the end
                  "contrailMinSeg":5, # min segment length, in pixels
                  "contrailMaxSpeedMult":0.5f,
                  "contrailAngularVelocityMult":0.5f,
                  "contrailColor":[255,150,100,100],
                  "type":"GLOW" # GLOW or SMOKE; additive or regular blend mode
               },
                "width":5.0,
                "length":15.0,
                "angle":180.0}],
   "behaviorSpec":{"behavior":"MIRV",
               "splitRange":100,
               "minTimeToSplit":1,
               "numShots":4,
               "damage":10,
               "emp":100,
               "damageType":ENERGY,
               "hitpoints":1,
               "arc":270,
               "spreadSpeed":325,
               "projectileSpec":"flare_standard",
               #"emptySpec":"type_1_mirv_empty",
               "smokeSpec":{"particleSizeMin":20.0,
                         "particleSizeRange":20.0,
                         "cloudParticleCount":11,
                         "cloudDuration":1.0,
                         "cloudRadius":20.0,
                         "blowbackParticleCount":0,
                         "blowbackDuration":0,
                         "blowbackLength":0,
                         "blowbackSpread":0,
                         "particleColor":[175,100,50,200]}
               }
               
}
[close]

And I just used the flare_standard.proj as the submunition I copied from the vanilla data folder(along with the graphics needed to run it)

Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2698 on: February 19, 2016, 05:37:33 PM »

How can i let only specific ships spawn in the black markets?  :-\
Might be best to make your own version of the black market submarket and spawn the special ships you want in the code.

Hello everyone.

Can you advise me, how can I make a hullmods which would have produced fuel over time? And that while the number of produced fuel would depend on the distance to the nearest star, the closer to the star, the more fuel is produced.

If you already have mod which such already is realized, please show it to me as an example.

Thanks in advance for your help.

Quickly whipped up example hullmod code, untested:

Code: java
	public static final float BASE_DISTANCE = 100;
public static final float FUEL_PER_DAY = 2;
IntervalUtil interval = new IntervalUtil(0.25f,0.25f); // probably premature optimisation but meh

@Override
public void advanceInCampaign(FleetMemberAPI member, float amount) {
float days = Global.getSector().getClock().convertToDays(amount);
interval.advance(days);
if (interval.intervalElapsed()) {
CampaignFleetAPI fleet = member.getFleetData().getFleet();
LocationAPI loc = fleet.getContainingLocation();
if (loc == Global.getSector().getHyperspace()) return;

// NOTE: uses generics, will fail if using Janino runtime compiler
List<PlanetAPI> planets = loc.getPlanets(); // TODO check if this also gets the system primary, if not use getAllEntities instead
for (PlanetAPI planet : planets) {
if (!planet.isStar()) continue;

// TODO: consider examining the star specs (size, corona size, etc.) and multiplying fuel generation accordingly
// also being in the corona or a solar storm might increase fuel production
float distance = Misc.getDistance(planet.getLocation(), fleet.getLocation());
if (distance < 10) distance = 10; // div0 protection, keeps fuel production non-ridiculous when getting _really_ close
float fuelMult = BASE_DISTANCE/distance;

// TODO: modifying output by the hull size of the ship this hullmod is installed on is left as exercise to the reader
fleet.getCargo().addCommodity(Commodities.FUEL, FUEL_PER_DAY * fuelMult * interval.getIntervalDuration());
}
}
}
« Last Edit: February 19, 2016, 05:39:06 PM by Histidine »
Logged

Runoved

  • Lieutenant
  • **
  • Posts: 62
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2699 on: February 27, 2016, 07:52:31 AM »

Once again, hello everyone.


Firstly thank you for your help with my previous question.

And again I have to ask for advice.

When I try to move my mod on the new version of the game (0.7.2a), I found a strange problem.
When I try to run the game with my mod, the game falls with the following error:

Spoiler
Code
16766 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.fs.starfarer.loading.scripts.ScriptStore.new(Unknown Source)
at com.fs.starfarer.settings.StarfarerSettings.o00000(Unknown Source)
at com.fs.starfarer.launcher.ModManager.getEnabledModPlugins(Unknown Source)
at com.fs.starfarer.loading.ResourceLoaderState.init(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]

But, what is the strangest thing, if I replace java folder (jre) on the one, that was used in previous versions of the game (0.7.1a), then suddenly everything starts to operate normally. I guess it has something to do with the changing Java version in the new version of the game.

For this please advise what could be the reason for this? And what part of my mod should I look for reasons to fix compatibility with the new version of the game? Perhaps someone has already faced a similar problem.

Thanks in advance for your attention.
Logged
Pages: 1 ... 178 179 [180] 181 182 ... 706