Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 63 64 [65] 66 67 ... 710

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

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #960 on: October 09, 2013, 03:52:46 AM »

Thanks Thaago!
Logged

WKOB

  • Admiral
  • *****
  • Posts: 732
  • Odobenidine Benefactor
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #961 on: October 09, 2013, 10:37:37 AM »

Now before I get too involved... with Hyperspace being implemented, can mods be more free-form with installation?

Could Mod A add it's own star-system and Mod B add it's own star-system and be compatible while not interacting in anyway?
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #962 on: October 09, 2013, 11:37:32 AM »

Could Mod A add it's own star-system and Mod B add it's own star-system and be compatible while not interacting in anyway?

Yep.
Where is your Mod? - System Map of the known Modiverse
Logged

WKOB

  • Admiral
  • *****
  • Posts: 732
  • Odobenidine Benefactor
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #963 on: October 09, 2013, 01:06:43 PM »

Perfect, ideally I'd like my mods to just be dropped in and be perfectly separate and compatible with everything.
Logged

Plasmatic

  • Admiral
  • *****
  • Posts: 500
  • Curious no?
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #964 on: October 09, 2013, 02:48:58 PM »

Code
	public static final float REPAIR_PENALTY = 25f;

I'm trying to edit the Augmented Engine Hullmod, but I can't make heads or tails of this function..

The description ingame says engines will take twice as long to repair, why is this number then 25f? would 25 not mean the engine takes 75% longer to repair?

I'm assuming setting this to 50f would indeed be twice as long repair time?

75f would be 25% longer to repair?
Logged
"Better to remain silent and be thought a fool than to speak out and remove all doubt"
- Maurice Switzer

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #965 on: October 10, 2013, 05:05:52 AM »

how do i get rid of the shrapnel animation when a MIRV missiles splits

Spoiler
Code
	"behaviorSpec":{"behavior":"MIRV",
"splitRange":900,
"minTimeToSplit":0.12,
"numShots":1,
"damage":800,
"emp":25,
"damageType":HIGH_EXPLOSIVE,
"hitpoints":300,
"arc":220,
"spreadSpeed":1000,
"projectileSpec":"MBT3_m",
#"emptySpec":"MBFc1_Fc1e",
"smokeSpec":{"particleSizeMin":0.0,
"particleSizeRange":0.0,
"cloudParticleCount":0,
"cloudDuration":0.0,
"cloudRadius":0.0,
"blowbackParticleCount":0,
"blowbackDuration":0,
"blowbackLength":0,
"blowbackSpread":0,
"particleColor":[255,100,50,0]}
}    
}
[close]
this dose not work, animation still happens
comenting it out just causes a crash...

plz help or my MBT3 will cause lag when a onslaught fires them
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #966 on: October 10, 2013, 11:43:06 AM »

Code
	public static final float REPAIR_PENALTY = 25f;

I'm trying to edit the Augmented Engine Hullmod, but I can't make heads or tails of this function..

The description ingame says engines will take twice as long to repair, why is this number then 25f? would 25 not mean the engine takes 75% longer to repair?

I'm assuming setting this to 50f would indeed be twice as long repair time?

75f would be 25% longer to repair?

The description is wrong; already fixed for next version. The engines take 25% longer to repair.

how do i get rid of the shrapnel animation when a MIRV missiles splits

Can't, that's hardcoded in the MIRV AI. You could write a custom missile AI to get around the issue.
Logged

Plasmatic

  • Admiral
  • *****
  • Posts: 500
  • Curious no?
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #967 on: October 10, 2013, 02:25:31 PM »

I keep getting a Null error that I cannot wrap my head around..

Code
11796 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.loading.specs.HullVariantSpec.super(Unknown Source)
at com.fs.starfarer.loading.specs.HullVariantSpec.<init>(Unknown Source)
at com.fs.starfarer.loading.ShipHullSpreadsheetLoader.super(Unknown Source)
at com.fs.starfarer.loading.SpecStore.Ò00000(Unknown Source)
at com.fs.starfarer.loading.null.super(Unknown Source)
at com.fs.super.oOOO.Ò00000(Unknown Source)
at com.fs.starfarer.combat.String.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)

That seems to me something to do with variants? yet the mod that causes it has no variants in it, not anything that calls to any variants?!

the only thing in the mod that causes it is:
ship_data.csv
4 .ship files (2 renamed models, new stats 2 just redone stats)
2 graphic files (for the renamed ships)
and the hull_mod.csv

EDIT: Solved Apparently I had forgotten a .ship at the end of one of the .ship files.. :P I feel like such an idiot :P
« Last Edit: October 10, 2013, 02:39:55 PM by Plasmatic »
Logged
"Better to remain silent and be thought a fool than to speak out and remove all doubt"
- Maurice Switzer

Alfalfa

  • Lieutenant
  • **
  • Posts: 99
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #968 on: October 10, 2013, 03:13:57 PM »

Ok this is driving me bats.  I need to get the hull size of a ship.

The ship is contained in a CombatEntity variable named 'entity.'  I check if entity isinstanceof ShipAPI, then I call entity.getHullSize().  Starsector crashes, insisting that no such method exists.  I have imported CombatEntity, ShipAPI, ShipAPI.HullSize, etc.  I have typecast the variable as ShipAPI.  I have tried entity.HullSize.

I know this method exists.  I opened up ShipAPI and the photons proving its existence are entering my cornea right now.

What the bejeezus is going on?
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #969 on: October 10, 2013, 03:53:14 PM »

Hm.  Try ((ShipAPI)entity).getHullSize() - that should either work, or throw a class cast exception, or a null pointer exception.  I think.

Posting the line it crashes on & the text of the exception might also be useful in giving us enough information to help.
Logged
Wyvern is 100% correct about the math.

Kiloman

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #970 on: October 10, 2013, 05:21:56 PM »

Hm.  Try ((ShipAPI)entity).getHullSize() - that should either work, or throw a class cast exception, or a null pointer exception.  I think.

the getHullSize method is actually from the ShipHullSpecAPI, so you want:
Code
((ShipAPI)entity).getHullSpec().getHullSize()

When in question, check the JavaDocs:
http://fractalsoftworks.com/starfarer.api/
Logged

Alfalfa

  • Lieutenant
  • **
  • Posts: 99
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #971 on: October 10, 2013, 06:47:09 PM »

Here's the relevant piece of code:

Code
velocityMod = x / MAXIMUM_MASS * FIELD_STRENGTH;
            if (entity instanceof ShipAPI){
            HullSize shipClass = (HullSize) ((ShipAPI) entity).getHullSize();
            if (shipClass == (HullSize) ShipAPI.HullSize.valueOf("FIGHTER")) {
            velocityMod *= 1;
            } else if (shipClass == (HullSize) ShipAPI.HullSize.valueOf("FRIGATE")) {
            velocityMod *= 1;   
            } else if (shipClass == (HullSize) ShipAPI.HullSize.valueOf("DESTROYER")) {
            velocityMod *= DESTROYER_MOD;
            } else if (shipClass == (HullSize) ShipAPI.HullSize.valueOf("CRUISER")) {
            velocityMod *= CRUISER_MOD;
            } else if (shipClass == (HullSize) ShipAPI.HullSize.valueOf("CAPITAL_SHIP")) {
            velocityMod *= CAPITAL_SHIP_MOD;
            } else {
            velocityMod *= 1;
            }
            /*switch (shipClass) {
            case (HullSize) DESTROYER: velocityMod *= DESTROYER_MOD;
            case (HullSize) CRUISER: velocityMod *= CRUISER_MOD;
            case (HullSize) CAPITAL_SHIP: velocityMod *= CAPITAL_SHIP_MOD;
            }*/
            }

Thank you for the replies to my earlier question.  It seems it was an issue with how I was handling the Enumerator type.  I've now gotten past the syntax errors and have encountered a logic one.  The 'field' generated by this code is supposed to be modified for all ships larger than a frigate.  Instead it is modified for all ships.  Nothing should happen to fighters or frigates with that code.  The only possibility is that this method of differentiating the different Enumerator values is not working.

I did not know what an Enumerator was before today, but now I hate them oh so very, very, much.  I came up with the solution in about 10 minutes, and have now spent hours attempting to use this Enumerator to perform an incredibly simple task, one I could have accomplished within 40 seconds had the classes been represented with integers.

Anyone know about Enumerators?
Logged

Kiloman

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #972 on: October 10, 2013, 08:04:42 PM »

Inability to switch on an Enum is a limitation of Janino. It's mentioned in a few different places. The usual suggestion is to either use compiled code in a JAR file, or just use an IF statement. There are examples elsewhere, but in a nutshell it looks like this:

Code
import com.fs.starfarer.api.combat.ShipAPI.*

if (entity instanceof ShipAPI){
HullSize size = ((ShipAPI)entity).getHullSpec().getHullSize();
if (size == HullSize.DESTROYER){
// do something for a destroyer
} else if (size == HullSize.FRIGATE){
// do something for a frigate
}
}


Note the getHullSpec before getHullSize, this is another thing you were missing... you can't just cast the hullSpec to a hullSize and expect it to work. You also don't need to use ValueOf, you can just specify the enum directly.
« Last Edit: October 10, 2013, 08:12:56 PM by Kiloman »
Logged

Psiyon

  • Admiral
  • *****
  • Posts: 772
  • Trippy
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #973 on: October 10, 2013, 08:31:55 PM »

A general question:

What sort of things have a heavy impact on framerate in the campaign? I'm getting 50+ FPS on average with 0-10% CPU idle, which is quite bad considering I'm running an FX 8350. It seems that viewing large fleets just annihilates my framerate. Don't ever remember that sort of thing happening before. I've only got 5 systems total--most of which have nothing happening in them at all, with the exception of the main one.

I've also got an every frame campaign script running every 2.5 seconds, but it's just a small wall of "if" statements that shouldn't put any sort of strain on the game. Removing this doesn't yield any notable increase in framerate either, so it's pretty much irrelevant.

Any thoughts on what I could do to increase framerates, short of stripping the systems of the majority of their fleets?
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7214
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #974 on: October 10, 2013, 08:42:04 PM »

...

I did not know what an Enumerator was before today, but now I hate them oh so very, very, much.  I came up with the solution in about 10 minutes, and have now spent hours attempting to use this Enumerator to perform an incredibly simple task, one I could have accomplished within 40 seconds had the classes been represented with integers.

...

This is how I felt about most java features before I started using an IDE. Java is insanely picky about usages - it completely crippled my programming for the first 10 ish hours I used it because things that I know work in several other languages would fail for no 'good' reason. Being able to do rapid experimentation in an IDE (I use netbeans) and get instant feedback as to when I make a syntax error was key to me learning the rules.
Logged
Pages: 1 ... 63 64 [65] 66 67 ... 710