Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.9.1a is out! (05/10/19); Blog post: Skills and Story Points (07/08/19)

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 - Tecrys

Pages: [1] 2 3 ... 32
1
Ha! You're a genius!

Funny thing about the refit screen: the whole X/Y coordinate system is rotated by 90° clockwise, I had to change the code to this:
Spoiler
if (engine.isPaused())
        {
            return;
        }
        if(runOnce == false){  
            if (weapon.getShip().getOriginalOwner() == -1 && weapon.getLocation().getY() > weapon.getShip().getLocation().getY()   ){  
                SpriteAPI theSprite = weapon.getSprite();  
                theSprite.setWidth(-theSprite.getWidth());  
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY());  
            }  
            runOnce = true;  
        }
[close]

See, I had to change getX to getY or it would allways mirror both weapons, not just the one that was supposed to be mirrored

Here the whole script for anybody interrested in mirroring weapons, they're firing animation and they're location in the refit screen:
Spoiler
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;
import com.fs.starfarer.api.graphics.SpriteAPI;
import java.util.*;

public class BaseAnimateOnFireEffect2 implements EveryFrameWeaponEffectPlugin
{
    // Default to 15 frames per second
    private float timeSinceLastFrame, timeBetweenFrames = 1.0f / 140f;
    private Map pauseFrames = new HashMap();
    private int curFrame = 0, pausedFor = 0;
    private boolean isFiring = false;
   private boolean runOnce = false;
   private boolean runOnce2 = false;
   private boolean runOnce3 = false;

    protected void setFramesPerSecond(float fps)
    {
        timeBetweenFrames = 1.0f / fps;
    }

    protected void pauseOnFrame(int frame, int pauseFor)
    {
        pauseFrames.put(frame, pauseFor);
    }


    private void incFrame(AnimationAPI anim)
    {
   
        if (pauseFrames.containsKey(curFrame))
        {
            if (pausedFor < (Integer) pauseFrames.get(curFrame))
            {
                pausedFor++;
                return;
            }
            else
            {
                pausedFor = 0;
            }
        }

        curFrame = Math.min(curFrame + 1, anim.getNumFrames() - 1);
    }

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
    {
        if (engine.isPaused())
        {
            return;
        }
        if(runOnce == false){  
            if (weapon.getShip().getOriginalOwner() == -1 && weapon.getLocation().getY() > weapon.getShip().getLocation().getY()   ){  
                SpriteAPI theSprite = weapon.getSprite();  
                theSprite.setWidth(-theSprite.getWidth());  
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY());  
            }  
            runOnce = true;  
        }
        AnimationAPI anim = weapon.getAnimation();
        anim.setFrame(curFrame);

        if (isFiring)
        {
            timeSinceLastFrame += amount;

            if (timeSinceLastFrame >= timeBetweenFrames)
            {
                timeSinceLastFrame = 0f;
                
                anim.setFrame(curFrame);
                    if(runOnce2 == false){  
            if (weapon.getShip().getOwner() == 0 && weapon.getLocation().getX() < weapon.getShip().getLocation().getX()  
                || weapon.getShip().getOwner() == 1 && weapon.getLocation().getX() > weapon.getShip().getLocation().getX()){  
                SpriteAPI theSprite = weapon.getSprite();  
                theSprite.setWidth(-theSprite.getWidth());  
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY());  
            }  
            
        }  
             incFrame(anim);

                if (curFrame == anim.getNumFrames() - 1)
                {
                    isFiring = false;
               runOnce2 = true;  
                }
            }
        }
        else
        {
            if (weapon.isFiring() && weapon.getChargeLevel() == 1.0f)
            {
                isFiring = true;
                incFrame(anim);
                anim.setFrame(curFrame);
            }
            else
            {
                curFrame = 0;
                anim.setFrame(curFrame);
                    if(runOnce3 == false){  
            if (weapon.getShip().getOwner() == 0 && weapon.getLocation().getX() < weapon.getShip().getLocation().getX()  
                || weapon.getShip().getOwner() == 1 && weapon.getLocation().getX() > weapon.getShip().getLocation().getX())
            {  
                SpriteAPI theSprite = weapon.getSprite();  
                theSprite.setWidth(-theSprite.getWidth());  
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY());  
            }  
            runOnce3 = true;  
        }
            }
        }
    }
}
[close]

Next problem: script that is supposed to disble the hit ship's shields for a set amount of time doesn't work, no errors simply no effect at all:
Spoiler
Code
package data.scripts.weapons;

import com.fs.starfarer.api.Global;
import org.lwjgl.util.vector.Vector2f;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamagingProjectileAPI;
import com.fs.starfarer.api.combat.OnHitEffectPlugin;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShieldAPI;
import com.fs.starfarer.api.combat.ShieldAPI.ShieldType;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class DissableShieldOnHitEffect implements OnHitEffectPlugin {
    // This is how we store which ships have dissabled shields and how much
    //  longer they'll be dissabled.
    //
    // Key - ShipAPI (the affected ship)
    // Value - float (the remaining duration of shield dissable-ization)
    static Map affectedShips = new HashMap();

    static final float DISSABLE_TIME_PER_HIT = 10f; // In seconds

    @Override
public void onHit(DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
        if (!(target instanceof ShipAPI)) return;

        ShipAPI ship = (ShipAPI)target;

        if(!ship.isAlive() || ship.getShield() == null) return;

        if(affectedShips.containsKey(ship)) {
            affectedShips.put(ship, (Float)affectedShips.get(ship) + DISSABLE_TIME_PER_HIT);
        } else {
            affectedShips.put(ship, DISSABLE_TIME_PER_HIT);
        }
}

// This is called once each frame by the ForceShieldDissablePlugin
    public static void forceDissableShields(float amount) {
        CombatEngineAPI engine = Global.getCombatEngine();

        if(engine.isPaused()) return;

        for(Iterator iter = affectedShips.keySet().iterator(); iter.hasNext();) {
            ShipAPI ship = (ShipAPI)iter.next();
            float remainingTime = (Float)affectedShips.get(ship) - amount;

            if(remainingTime < 0) {
                // This removes the current ship from affectedShips
                iter.remove();
            } else {
                affectedShips.put(ship, remainingTime);
                ship.getShield.setActiveArc(0);
            }
        }
    }
}
[close]

2
Thanks a bunch Tartiflette!
Nope, somehow doesn't do it for me. It's supposed to mirror an installed weapon in refit screen but no matter how I try, it won't work.

I guess I will have to live with the fact that my little monsters will have 2 (actually more than that) right clawas in refit screen. As soon as battle starts everything is mirrored perfectly ...

The Script (Posted it once a long time ago)
Spoiler
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;
import com.fs.starfarer.api.graphics.SpriteAPI;
import java.util.*;

public class BaseAnimateOnFireEffect2 implements EveryFrameWeaponEffectPlugin
{
    // Default to 15 frames per second
    private float timeSinceLastFrame, timeBetweenFrames = 1.0f / 140f;
    private Map pauseFrames = new HashMap();
    private int curFrame = 0, pausedFor = 0;
    private boolean isFiring = false;
   private boolean runOnce = false;
   private boolean runOnce2 = false;
   private boolean runOnce3 = false;

    protected void setFramesPerSecond(float fps)
    {
        timeBetweenFrames = 1.0f / fps;
    }

    protected void pauseOnFrame(int frame, int pauseFor)
    {
        pauseFrames.put(frame, pauseFor);
    }


    private void incFrame(AnimationAPI anim)
    {
   
        if (pauseFrames.containsKey(curFrame))
        {
            if (pausedFor < (Integer) pauseFrames.get(curFrame))
            {
                pausedFor++;
                return;
            }
            else
            {
                pausedFor = 0;
            }
        }

        curFrame = Math.min(curFrame + 1, anim.getNumFrames() - 1);
    }

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
    {
        if (engine.isPaused())
        {
            return;
        }
        if(runOnce == false){ 
            if (weapon.getShip().getOwner() == -1 && weapon.getLocation().getX() > weapon.getShip().getLocation().getX()   ){ 
                SpriteAPI theSprite = weapon.getSprite(); 
                theSprite.setWidth(-theSprite.getWidth()); 
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY()); 
            } 
            runOnce = true; 
        }
        AnimationAPI anim = weapon.getAnimation();
        anim.setFrame(curFrame);

        if (isFiring)
        {
            timeSinceLastFrame += amount;

            if (timeSinceLastFrame >= timeBetweenFrames)
            {
                timeSinceLastFrame = 0f;
               
                anim.setFrame(curFrame);
                    if(runOnce2 == false){ 
            if (weapon.getShip().getOwner() == 0 && weapon.getLocation().getX() < weapon.getShip().getLocation().getX()   
                || weapon.getShip().getOwner() == 1 && weapon.getLocation().getX() > weapon.getShip().getLocation().getX()){ 
                SpriteAPI theSprite = weapon.getSprite(); 
                theSprite.setWidth(-theSprite.getWidth()); 
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY()); 
            } 
           
        } 
             incFrame(anim);

                if (curFrame == anim.getNumFrames() - 1)
                {
                    isFiring = false;
               runOnce2 = true; 
                }
            }
        }
        else
        {
            if (weapon.isFiring() && weapon.getChargeLevel() == 1.0f)
            {
                isFiring = true;
                incFrame(anim);
                anim.setFrame(curFrame);
            }
            else
            {
                curFrame = 0;
                anim.setFrame(curFrame);
                    if(runOnce3 == false){ 
            if (weapon.getShip().getOwner() == 0 && weapon.getLocation().getX() < weapon.getShip().getLocation().getX()   
                || weapon.getShip().getOwner() == 1 && weapon.getLocation().getX() > weapon.getShip().getLocation().getX())
            { 
                SpriteAPI theSprite = weapon.getSprite(); 
                theSprite.setWidth(-theSprite.getWidth()); 
                theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY()); 
            } 
            runOnce3 = true; 
        }
            }
        }
    }
}
[close]

3
Does anyone remember how I could check if a ship is in refit screen?
I think its done With a specific ship owner number but I can't remember

4
Alright, I got BGE at least starting up but I had to disable some essential plugins for their unique right click system and I would need some help fixing that please.

The Plugin:
Spoiler
package data.scripts.plugins;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.ShipAPI;
import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import org.apache.log4j.Level;

/**
 *
 * @author Revan
 */
public class ProtectionData {
   
            public final WeakReference source;
            //public final ShipAPI source;
            final float expiration;
            static final Set protectionMap = Collections.newSetFromMap(new HashMap());
     
    public ProtectionData(float protectionDuration, ShipAPI source)
        {
            //this.hitLoc = new AnchoredEntity(target, hitLoc);
            this.source = new WeakReference(source);
            //this.source = source;
            //sets the time WHEN it will expire
            expiration = Global.getCombatEngine().getTotalElapsedTime(false)
                    + protectionDuration;
        }
           
    public static void startProtection(float protectionDuration, ShipAPI source)
        {
            //Creates a new token in the protectionMap list
            protectionMap.add(new ProtectionData(protectionDuration, source));
            Global.getLogger(ProtectionTracker.class).log(Level.INFO,"Protection Requested");
            //Applies the mutablestats to the ship
            applyProtectionStats(source);
        }
                   
    static void applyProtectionStats(ShipAPI source)
        {
            String id = "faceMeltProtection"; //id of the buff
            Global.getLogger(ProtectionTracker.class).log(Level.INFO,"Running protection apply"); //debug code

            //Apply ship stats

        source.getMutableStats().getHighExplosiveDamageTakenMult().modifyMult(id,0.001f);

        }
    static void unApplyProtectionStats(ShipAPI source)
        {
            String id = "faceMeltProtection"; //id of the buff
            Global.getLogger(ProtectionTracker.class).log(Level.INFO,"Running protection un-apply"); //debug code

            //unpply ship stats           
            source.getMutableStats().getHighExplosiveDamageTakenMult().unmodify(id);

        }
 
}
[close]

Throws this error at me:
Spoiler
18248 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.plugins.ProtectionData]
java.lang.RuntimeException: Error compiling [data.scripts.plugins.ProtectionData]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Problem loading class [data.scripts.plugins.ProtectionData]
   at com.fs.starfarer.loading.scripts.ScriptStore.Object(Unknown Source)
   ... 2 more
Caused by: java.lang.InstantiationException: data.scripts.plugins.ProtectionData
   at java.lang.Class.newInstance(Unknown Source)
   ... 3 more
Caused by: java.lang.NoSuchMethodException: data.scripts.plugins.ProtectionData.<init>()
   at java.lang.Class.getConstructor0(Unknown Source)
   ... 4 more
[close]

5
Thanks Coyote but I still don't really know how to do it now since I don't really understand coding and had a lot of help or codebashed a lot for BGE.

I think I would be better off if I could tell someone what my ships are intended to do and I would do art and animation ...

Edit: Everything I still got from BGE is a total mess btw, I really don't know anymore what would even be modifiable to work and what not.
Best would be to start from scratch I guess ...

Edit: Okay, I fixed that script I think.
But now I got this:
Spoiler
22128 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.AbstractMethodError
java.lang.AbstractMethodError
   at com.fs.starfarer.title.ooOO.o0oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO$Oo.?0000(Unknown Source)
   at com.fs.starfarer.combat.A.new.new(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.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]

6
Hello everyone!

I'm trying to revive my old mod again and get it to run with Starsector 0.8, problem is there's quite a lot of old code not working anymore.
I've got this script in particular:
Spoiler
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.VectorUtils;
import org.lazywizard.lazylib.MathUtils;
import org.lwjgl.util.vector.Vector2f;

public class Greifer_effect implements BeamEffectPlugin
{
    private IntervalUtil tracker = new IntervalUtil(0.1f, 0.2f);
   
    @Override
    public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
    {
        tracker.advance(amount);
       
        CombatEntityAPI target = beam.getDamageTarget();
        //Do we have a valid Entity to effect?
        if (target != null)
        {
            //Yes!  Is it in range, and the beam's on?
            if (beam.getBrightness() >= 1f)
            {
                if(tracker.intervalElapsed())
                {
                    float force = 0f;
                    Vector2f dir;

                    if(target instanceof ShipAPI)
                    {
                        ShipAPI ship = (ShipAPI) target;
                        ShipAPI source = beam.getSource();
                        ShipSystemAPI cloak = ship.getPhaseCloak();
                        if (cloak != null && cloak.isActive())
                        {
                                return;
                        }

                        if(ship != beam.getSource())
                        {
                            force = 15 - (source.getMass() /255);            
                     
                            dir = (Vector2f) VectorUtils.getDirectionalVector(beam.getSource(), target).scale(force);
                            Vector2f.add(source.getVelocity(), dir, source.getVelocity());
                        }
                    }
                    else
                    {
                        if(target != beam.getSource())
                        {
                            force = Math.max(1 / target.getMass() * 15000f, 0.01f);
                            dir = (Vector2f) VectorUtils.getDirectionalVector(beam.getSource(), target).scale(force);
                            Vector2f.add(target.getVelocity(), dir, target.getVelocity());     
                        }
                    }
                }
            }
        }
    }   
}
[close]

and it throws this crash error at me:
Spoiler
17070 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.plugins.Greifer_effect]
java.lang.RuntimeException: Error compiling [data.scripts.plugins.Greifer_effect]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: File 'data/scripts/plugins/Greifer_effect.java', Line 49, Column 79: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.combat.ShipAPI, com.fs.starfarer.api.combat.CombatEntityAPI"; candidates are: "public static org.lwjgl.util.vector.Vector2f org.lazywizard.lazylib.VectorUtils.getDirectionalVector(org.lwjgl.util.vector.Vector2f, org.lwjgl.util.vector.Vector2f)"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:226)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File 'data/scripts/plugins/Greifer_effect.java', Line 49, Column 79: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.combat.ShipAPI, com.fs.starfarer.api.combat.CombatEntityAPI"; candidates are: "public static org.lwjgl.util.vector.Vector2f org.lazywizard.lazylib.VectorUtils.getDirectionalVector(org.lwjgl.util.vector.Vector2f, org.lwjgl.util.vector.Vector2f)"
[close]

It would be great if anyone could help me get BGE up to date again, thanks in advance!

7
Modding / Re: Spriters judgement thread [non-sprite art allowed]
« on: August 31, 2014, 07:54:53 AM »
It looks absolutely gorgious but I'm a little confused about wgere the front is supposed to be.
I would expect it to fly from right to left in that picture because the bridge seems to be over there.
If it's meant to fly the other way please think about that choice...

8
Modding / Re: EveryFrameWeaponEffectPlugin - Refit Menu Check
« on: August 30, 2014, 01:05:59 PM »
It's great that you were able to find that out, now my edited version of the weapon mirroring script could be fixed and that would make left and right variants of my melee weapons obsolete.

9
Mods / Re: Biomancy Genetic Engineering (Huge AI/Balance Improvements!)
« on: August 30, 2014, 09:21:35 AM »
Is this mod still on hold or is it slowly crawling along in the shadows?

Hopefully it didn't fall into a black hole and will never be seen again. :'(



I am still here watching the forums on a daly basis but I can't seem to find motivation and time to put more work into Debido's and my mod.
I would actually love to continue work on the half-baked update but I am much too buisy at work.
It might take until winter or even next year until I continue to work on it.
Until then I want to thank everyone who gave me feedback on the mod feedback thread, it helps a lot.

10
Mods / Re: DSTech Corp Fleet v0.5.2a - New Ships and Weapons -
« on: August 19, 2014, 02:11:59 PM »
There is a working version comparible with Exerelin online, take a look at Exerelin and supported mods.
You should be able to find a link to the download there.
The creator told me he doesn't mind what we do with the mod as long as the character and fluff of the mod are kept intact.

I hope tjis might help.

11
Fan Media & Fiction / Re: Starsector Streaming Channels
« on: August 06, 2014, 02:55:11 AM »
I hope it's no problem that I am streaming some LoL with friends. If it is, pls remove this post, thanks!

(German)

http://www.twitch.tv/tecrys

12
Modding / Re: Mod Feedback Thread
« on: July 15, 2014, 03:45:03 PM »
Very cool thread!

I know, I disappeared a while behind the curtains because of lots of private stuff all coming together ... well, crap happens!

But this thread really spurrs my will to get back to improving BGE! I took a look at the scores I got in various categories and I might get back to working on BGE.

My main man David also offered me help again (He's responsible for a lot of the code involved and the implementation of borrowed code) which made me really happy.

So if everything goes well I might be able to get some days off next week to get some of the new content being WIP for a long time released.

There's new art, a whole new faction, new animations and new features I've been working on every now and then.

Thanks for the great feedback everyone!

13
i get an error when i try play on vacuum, i have lazylib on and shaderlib but when its loading it quits and comes up with "Fatal: JSONObject["enableCaching"] not found. Check starsector.log for more info"

i would put the log but i cant find it.

Vacuum has DR's shaders built in, disable shaderlib and it should run correctly.

Edit: I forgot to mention Lazylib being inbuilt aswell, derp-de-derp.

14
Announcements / Re: Starsector 0.65a (In Development) Patch Notes
« on: June 12, 2014, 11:31:31 AM »
Yo Alex, when are you guys adding Decoratives to vanilla ships? us modders are way ahead of ya with blinking lights and glowing powercores. ;D

Well, it's not hard to make nice decoratives but time consuming.
Would you rather spend time coding new features or putting decoratives ingame without any game value apart from visuals?
I think the answer to that is clear, no offense.

15
yes i did. hmm thats wierd. i really have no clue.

You should ask Dark.Revenant in the shaderlib thread about making it work with Exerelin.

Pages: [1] 2 3 ... 32