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)

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - SwissArmyKnife

Pages: [1]
1
Hmm - nothing jumps out immediately as being wrong. I'd suggest copy-pasting a vanilla weapon's .wpn file / csv row / etc one at a time, so you can narrow down where the problem is, and then progressively change things until you know exactly what breaks it.

Figured it out, I was calling da_eldos_start for the sound file in .wpn when it should have been the diableavionics_eldos_start I'd set in sounds.json. Naming conventions get me every time!

2
Trying to create a big old beam cannon but I'm getting an NullPointerException whenever I try to fire it.

.wpn file:
Spoiler
Code
{
    "specClass":"beam",
    "id":"diableavionics_eldos",
    "type":"ENERGY",
    "size":"LARGE",
    "displayArcRadius":1200,
    "turretSprite":"graphics/da/weapons/diableavionics_eldos_turret_base.png",
    "turretGlowSprite":"graphics/da/weapons/diableavionics_eldos_turret_glow.png",
    "hardpointSprite":"graphics/da/weapons/diableavionics_eldos_hardpoint_base.png",
    "hardpointGlowSprite":"graphics/da/weapons/diableavionics_eldos_hardpoint_glow.png",
    "turretOffsets":[30, 0],
    "turretAngleOffsets":[0],
    "hardpointOffsets":[65, 0],
    "hardpointAngleOffsets":[0],   
    "fringeColor":[41,15,155,255],
    "coreColor":[238,255,239,255],
    "darkCore":false,
    "width":40.0,
    "textureType":LASER,
    "textureScrollSpeed":292.0,
    "pixelsPerTexel":5.0,
    "pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER,MISSILE_FF,MISSILE_NO_FF,FIGHTER],
    "glowColor":[225,60,0,255],
        "animationType":"GLOW",
    "fireSoundOne":"da_eldos_start",
    "fireSoundTwo":"da_eldos_loop",
}
[close]

weapon_data.csv entry:
Spoiler
Code
Eldos Energy Furnace,diableavionics_eldos,3,0.01,32500,1400,950,,,75,4,40,,,,ENERGY,,950,1,2,,,,,,,6000,,,,,,"beam12, energy11, diable_adv_bp, rare_bp",,Diable Avionics,,Siege Artillery,,,,,,,,,,
[close]

And the NPE I get every time:
Spoiler
Code
46372 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
    at com.fs.starfarer.combat.entities.ship.A.void0000Unknown Source)
    at com.fs.starfarer.combat.entities.ship.A.void.createBeam(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.class.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.O0OO.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.O0OO.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.class.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.A.void.advance(Unknown Source)
    at com.fs.starfarer.combat.systems.oOoO.advanceLinked(Unknown Source)
    at com.fs.starfarer.combat.systems.oOoO.advance(Unknown Source)
    at com.fs.starfarer.combat.entities.Ship.fire(Unknown Source)
    at com.fs.starfarer.combat.entities.Ship.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)
[close]

Checked all the usual suspects, names match, offsets look good, nothing was saved in the Ship & Weapon Editor. Sprites and sound files (ogg) all look fine. Kind of out of ideas, anything jump out to anyone or run into something similar?

3
Mods / Re: [0.9.1a] Diable Avionics 2.04 (2019/05/14)
« on: August 28, 2019, 01:21:27 AM »
Not doing a lot against what opposition?

I just outfitted a Daze this morning and was very pleased with it. It's great at controlling space with it's wide turret arcs and missile spam, and anyone coming close gets one hell of a pounding with the ship system. Just give it the usual two HVD and two Maulers and your favourite pd in the small slots. For missiles I just gave it 4xSalamanders it can spam forever - adds even more disruption and occasionally will catch someone in your frontal arc in which case you can pound it to paste. Alternatively you can invest in expanded missile racks and whatever your favourite missiles are - will also increase the capacity of the builtin micromissiles.

Alternatively you can make it into a hilarious SO cruiser. Heavy machine guns, assault chainguns, torpedos. Works basically like an SO hammerhead - you drive up, activate the ship system and apply directly to forehead.

Was losing them constantly in engagements so I decided to dive into the sim and try out different configurations. I figured I had just set it up wrong initially but whatever DA flavored loadout I tried I couldn't get the thing to last at all in even 1v1s with equal strength ships. It'd roll up, throw shields occassionally and get overloaded then boom dead.

4
Mods / Re: [0.9.1a] Diable Avionics 2.04 (2019/05/14)
« on: August 26, 2019, 04:29:06 PM »
I think I'm missing something with the Daze. It's toted as a heavy frontline tank that can outlast opponents but no matter what setup I put on it they're not doing a whole lot and getting flux overloaded constantly. I love the idea of it but it's just getting absolutely steam rolled.

What setup do most people use for the Daze?

5
I don't think so. A loose script should work unless it contains something Janino doesn't support, which I think is the case here. You might try making sure that all values assigned to floats are followed by an f (e.g. 42f instead of 42). I'm pretty sure Janino has a hard time dealing with int/float value mismatches.
Code
    private final float validFrames = 13;
//    private final float animeMAXchargelvl = 0.8f;
    private float chargeLevel = 0;

You were completely right, loose script worked fine and janino compiled fine. Starsector launches etc. I just don't know what I'm doing with java scripting and copying existing scripts has only gotten me so far.

Once again I think I'm overcomplicating this. I want the anim to start, play until it gets to say frame 5 where the barrel is open and "hot" and pause while the beam is firing, then continue playing to the end when the gun charges down.

Here's where it's at now.
Spoiler
[close]

Anyone able to help a complete noob out?

6

@SwissArmyKnife: not actually sure offhand what's going on. Might be another error message somewhere earlier in the log? This sort of thing might happen if your script is doing something Janino (the compiler the game uses for loose scripts) doesn't support, or if the class doesn't have a default constructor, but none of that seems to be the problem in your code.


Thanks for taking a look at it. This may be a dumb question but I couldn't find a good answer anywhere and it's making me think the solution is simpler than it seems.

If I want to add a .java file to an existing mod's .jar file. For instance adding my new guns animation .java file to DiableAvionics  .jar file. How do I do that? Do I need to use something like netbeans to package and compile the whole thing again from src?

Do I even need to do that in the first place?

Update: Figured it out! Not ideally but it works which is good enough for a small personal mod. Ended up putting the java file in Diable's data/scripts/weapons instead of trying to add into into it's jar file.

Now my only issue is getting it to animate properly. Right now it's just cycling through the frames over and over. I need it to pause on frame 5 during firing but I'm not sure how to do that. I have no real idea what I'm doing so I looked at a bunch of different guns and couldn't find one that did the above.

I assumed that  if (!weapon.isFiring()) would dicate what it was doing while firing but adding animeSetFrame(5); in there just locks it to frame 5 in it's resting state. Firing animation still cycles through all 13 on a loop.

Here's the anim code again.
Spoiler
Code
// By Deathfly
package data.scripts.weapons;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;

public class EldosAnimation implements EveryFrameWeaponEffectPlugin {

    private final float validFrames = 13;
//    private final float animeMAXchargelvl = 0.8f;
    private float chargeLevel = 0;

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
        AnimationAPI anime = weapon.getAnimation();
       
        if (anime == null){
            return;
        }
        if (!weapon.isFiring()) {
            chargeLevel = 0;
            anime.setFrameRate(-12);
            if (anime.getFrame() == 0) {
                anime.setFrameRate(0);
            }
        } else {
            if (weapon.getChargeLevel() >= chargeLevel) {
                chargeLevel = weapon.getChargeLevel();
                if (anime.getFrame() < validFrames) {
                    anime.setFrameRate(12);
                } else {
                    anime.setFrameRate(0);
                    anime.setFrame(13);
                }
            } else {
                chargeLevel = weapon.getChargeLevel();
                if (anime.getFrame() > 0) {
                    anime.setFrameRate(-12);
                } else {
                    anime.setFrameRate(0);
                    anime.setFrame(0);
                }
            }
            if (weapon.getShip().getFluxTracker().isOverloadedOrVenting()){
                weapon.setRemainingCooldownTo(weapon.getCooldown());
            }
        }
    }
}
[close]

7
I'm trying to take the large cannon from Black Rock Driveyards, Solenoid, and turn it into a big old Diable flavored beam cannon. This would be easy enough but I want to retain it's animations, with it opening up on start up, freezing on say frame 4 during firing, then progressing to the end on cooldown. I'm in the weeds since beam weapons .wpn file works a little differently than projectile .wpn files do.

The sprites are easy enough but I'm unsure how the animation is handled. The original Solenoid .wpn file had lines for numFrames and framerate, and it's animtype set to MUZZLE_FLASH. Can beam weapons have muzzle flash, let alone sprite based animations? I couldn't find a vanilla example, the most indepth those got were recoil or glow effects.

I'm also not really sure what the everyFrameEffect and .java file do. I again based mine off the original Solenoid and guessed what the file was doing.

Sprites (Still need to do the turret version I know):
Spoiler
[close]

.wpn
Spoiler
Code
{
"id":"diableavionics_eldos",  # this id must match what's in the spreadsheet
"specClass":"beam",
"type":"ENERGY",
"size":"LARGE",
"displayArcRadius":1200,
"turretSprite":"graphics/da/weapons/eldos/eldos_turret00.png",
"hardpointSprite":"graphics/da/weapons/eldos/eldos_hpbarrel00.png",
"numFrames":24,
"frameRate":15,
"visualRecoil":0.0,  # the gun sprites are only used if this is non-0
"renderHints":[RENDER_BARREL_BELOW],
"turretOffsets":[30, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[50, 0],
"hardpointAngleOffsets":[0],
"barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
"animationType":"MUZZLE_FLASH",  # NONE, GLOW, MUZZLE_FLASH, SMOKE
"muzzleFlashSpec":{"length":45.0,   # only used if animationType = MUZZLE_FLASH
   "spread":6.0,
   "particleSizeMin":1.0,
   "particleSizeRange":60.0,
   "particleDuration":1.25,
   "particleCount":63,
   "particleColor":[135,155,170,125]},
"fireSoundOne":"diableavionics_eldos_start",
"fireSoundTwo":"diableavionics_eldos_loop",
    "everyFrameEffect":"data.scripts.weapons.EldosAnimation",
}
[close]

EldosAnimation.java
Spoiler
Code
package data.scripts.weapons;

public class EldosAnimation extends BaseAnimateOnFireEffect {

    public EldosAnimation() {
        super(); // doesn't actually do anything
        setFramesPerSecond(15);
        pauseOnFrame(4);
    }
}
[close]

Thanks!

Update: Figured out most of the above by copying some stuff from Neutrino Corps Phase Cannon. Only issue now is the java file crashes Starsector on load with:
Spoiler
Code
java.lang.RuntimeException: Error compiling [data.scripts.weapons.EldosAnimation]
at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: data.scripts.weapons.EldosAnimation
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
at java.lang.ClassLoader.loadClass(Unknown Source)
[close]

And here's the java file.
Spoiler
Code
// By Deathfly
package data.scripts.weapons;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;

public class EldosAnimation implements EveryFrameWeaponEffectPlugin {

    private final float validFrames = 13;
//    private final float animeMAXchargelvl = 0.8f;
    private float chargeLevel = 0;

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
        AnimationAPI anime = weapon.getAnimation();
       
        if (anime == null){
            return;
        }
        if (!weapon.isFiring()) {
            chargeLevel = 0;
            anime.setFrameRate(-12);
            if (anime.getFrame() == 0) {
                anime.setFrameRate(0);
            }
        } else {
            if (weapon.getChargeLevel() >= chargeLevel) {
                chargeLevel = weapon.getChargeLevel();
                if (anime.getFrame() < validFrames) {
                    anime.setFrameRate(12);
                } else {
                    anime.setFrameRate(0);
                    anime.setFrame(13);
                }
            } else {
                chargeLevel = weapon.getChargeLevel();
                if (anime.getFrame() > 0) {
                    anime.setFrameRate(-12);
                } else {
                    anime.setFrameRate(0);
                    anime.setFrame(0);
                }
            }
            if (weapon.getShip().getFluxTracker().isOverloadedOrVenting()){
                weapon.setRemainingCooldownTo(weapon.getCooldown());
            }
        }
    }
}
[close]

I figured it was because the default compiler runs JDK 6 and I need JDK 7 but all the IDE guides I found were massively out of date. Tried IntelliJ IDEA and couldn't for the life of me get it to actually compile the damn jar file. Giving up until tomorrow.

Pages: [1]