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: Anubis-class Cruiser (12/20/24)

Pages: 1 ... 232 233 [234] 235 236 ... 751

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

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3495 on: August 09, 2017, 12:31:24 PM »

... is it possible to make projectile "ghost" through both shield AND hull, while dealing damage? i remember the Nidhoggr lance from shadowyards could ghost through hull long time ago, not sure if it still does. did't find anything fancy in .proj.

This is still possible, but you need some scripts rather than just .proj modification. You essentially do this:

Step 1: Set collision to NONE; this means it passes through everything without doing damage

Step 2: Run a EveryFrame script which causes damage at whatever point your projectile is currently at, if it's over a ship

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3496 on: August 11, 2017, 10:30:30 AM »

Sorry if this has been asked before, but i could not find any answers searching through the thread:

Is it possible to (script-sidedly, preferably via hullmod) lower the damage of a certain weapon size? Failing that, is it possible to lower the damage of a specific weapon?

banano of doom

  • Captain
  • ****
  • Posts: 287
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3497 on: August 11, 2017, 10:50:55 PM »

hello
having troubles with scripting.
i'm not sure this is the right place to ask.
trying to adapt tartiflette's transforming script for my nefarious purposes.
so here:
Spoiler
Code: java
//by Tartiflette, this script makes various decorative weapons apeare
//feel free to use it, credit is appreciated but not mandatory
package data.scripts;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipEngineControllerAPI;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.WeaponAPI;
import java.util.List;
import org.lazywizard.lazylib.FastTrig;
import org.lazywizard.lazylib.MathUtils;

public class TF_C01_transform implements EveryFrameWeaponEffectPlugin {

    private WeaponAPI arm1R;
    private WeaponAPI arm2R;
    private ShipAPI ship;   
    private ShipSystemAPI system;
    private ShipEngineControllerAPI engines;
   
    public static final String slotarm1rightID = "slotARM1R";
    public static final String slotarm2rightID = "slotARM2R";
   
    private boolean runOnce=false;
    private boolean soundIN=true;
    private boolean soundOUT=true;
   
    private float arm1w, arm1h, arm2w, arm2h;
   
    private float rate=1;
    private boolean travelDrive = false;
   
    private final float rotateOffset=90;
    private final float armOffsetX=100;
    private final float armOffsetY=100;

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
       
        if (Global.getCombatEngine().isPaused()) {
            return;
        }
       
        //initialise the variables
        if (!runOnce || ship==null || system==null){
            ship=weapon.getShip();
            system = ship.getSystem();
            engines = ship.getEngineController();
            List <WeaponAPI> weapons = ship.getAllWeapons();
            for (WeaponAPI w : weapons){
                switch(w.getSlot().getId()){
                    case slotarm1rightID:
                        arm1R=w;
                        arm1h=w.getSprite().getHeight();
                        arm1w=w.getSprite().getWidth();
                        break;
                    case slotarm2rightID:
                        arm2R=w;
                        arm2h=w.getSprite().getHeight();
                        arm2w=w.getSprite().getWidth();
                        break;
                }               
            }           
            runOnce=true;
            //return to avoid a null error on the ship
            return;
        }
       
        //ENGINES SHIELDS MOVEMENT ROTATIONS     
       

        //ALL THE STUFF
       
        if(ship.getTravelDrive().isActive() || ship.getFluxTracker().isVenting()){
            rate = Math.min(1,rate+amount);
            travelDrive=true;
        } else if (travelDrive){
            rate = Math.max(0,rate-amount);
            if(rate==0){
                travelDrive=false;
            }
        } else {
            rate = system.getEffectLevel();
        }
       
        if (rate==0){
            soundIN=false;
        } else if (rate==1){
            soundOUT=false;
        }
       
        if (system.isActive() || rate > 0){
           
            if(rate>0 && !soundIN){   
                soundIN=true;
                //Global.getSoundPlayer().playSound("diableavionics_transform_in", 1, 1, ship.getLocation(), ship.getVelocity());                       
            } else if (rate<1 && !soundOUT){               
                soundOUT=true;
                //Global.getSoundPlayer().playSound("diableavionics_transform_out", 1, 1, ship.getLocation(), ship.getVelocity());                     
            }
           
//lgun.setRemainingCooldownTo(1);
//rgun.setRemainingCooldownTo(1);
                       
            float rotateArms = SO(rate,0.25f,0.75f);
            float slideArms = SO(rate,0f,0.5f);
            float extendArms = SO(rate,0.5f,1f);

           
            float arm1Y = arm1h/2 + armOffsetY*slideArms;
            float arm1X = arm1w/2;
            float arm2X = arm2w/2 + armOffsetX*slideArms;


arm1R.getSprite().setCenter(ldX, dY);
arm2R.getSprite().setCenter(ldX, dY);


           
            //float clipDoors = RSO(rate,0.5f,1f);
           
     
        } else {
                   
        }
    }

    //////////////////////////////////////////
    //           SMOOTH DAT MOVE            //
    //////////////////////////////////////////
   
    public float smooth (float x){
        return 0.5f - ((float)(FastTrig.cos(x*Math.PI) /2 ));
    }
   
    //////////////////////////////////////////
    //           OFFSET DAT TIME            //
    //////////////////////////////////////////
   
    public float offset (float x, float start, float end){
        return (float) Math.min(1, Math.max( 0 , (x-start)*(1/(end-start))));
    }
   
    //////////////////////////////////////////
    //           SMOOTH + OFFSET            //
    //////////////////////////////////////////
   
    public float SO (float x, float start, float end){
        return 0.5f - ((float)( FastTrig.cos( Math.min( 1, Math.max( 0 , (x-start)*(1/(end-start)))) *Math.PI ) /2 ));
    }
   
    //////////////////////////////////////////
    //      RETURN + SMOOTH + OFFSET        //
    //////////////////////////////////////////
   
    public float RSO (float x, float start, float end){
        return 0.5f - ((float)( FastTrig.cos( Math.min( 1, Math.max( 0 , (x-start)*(1/(end-start)))) *Math.PI*2 ) /2 ));
    }
}
[close]
gives the following error:

it is to my very limited understanding of java that the following part dosn't work properly. probabaly due to some wariables being declared incorrectly.
Code: java
for (WeaponAPI w : weapons){
           [u][b] switch(w.getSlot().getId()){[/b][/u]
                    case slotarm1rightID:
                        arm1R=w;
                        arm1h=w.getSprite().getHeight();
                        arm1w=w.getSprite().getWidth();
                        break;
                    case slotarm2rightID:
                        arm2R=w;
                        arm2h=w.getSprite().getHeight();
                        arm2w=w.getSprite().getWidth();
                        break;
                }               

can anyone help, please?
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 25006
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3498 on: August 12, 2017, 10:25:28 AM »

Sorry if this has been asked before, but i could not find any answers searching through the thread:

Is it possible to (script-sidedly, preferably via hullmod) lower the damage of a certain weapon size? Failing that, is it possible to lower the damage of a specific weapon?

Hmm - nothing comes to mind directly, but someone more versed in modding trickery may have an answer.

@passwalker: you can only run a switch statement on integers. It doesn't work on Strings.
Logged

banano of doom

  • Captain
  • ****
  • Posts: 287
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3499 on: August 12, 2017, 04:49:50 PM »

@passwalker: you can only run a switch statement on integers. It doesn't work on Strings.
yeah, that's written in the error message, captain. but thanks anyway
i also tried forsing DA mod using the otiginal script from source instead of jar - it crashed with the same error.  well, no transformations for now.

@Nicke535: here's this thing: http://fractalsoftworks.com/forum/index.php?topic=12586.0 dunno... maybe...
« Last Edit: August 12, 2017, 06:03:24 PM by passwalker »
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Protonus

  • Captain
  • ****
  • Posts: 444
  • AAAAAAAAAAAA
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3500 on: August 12, 2017, 08:10:41 PM »

I'm looking for a particularly basic code, Shipsystem or Hullmod, that provides ships a Shield Type which completely covers the hull instantly, a la Star Trek/SoaSE/every other Sci-games.

Similar to the Templars but without the complex abilities like its flux discharge at critical and are only active like regular shields (Flux maintenance while active, flux increase by taking damage) while allowing armor and hull to take a portion of the damage not absorbed by the barrier.

If there isn't any, it is okay with me. I may be asking too much since this shield type is unique and requires actual coding that is not likely to exist in the Starsector base.
« Last Edit: August 12, 2017, 08:13:40 PM by Protonus »
Logged

The cookies are a weird one, okay.

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3501 on: August 12, 2017, 09:39:57 PM »

I'm looking for a particularly basic code, Shipsystem or Hullmod, that provides ships a Shield Type which completely covers the hull instantly, a la Star Trek/SoaSE/every other Sci-games.

Similar to the Templars but without the complex abilities like its flux discharge at critical and are only active like regular shields (Flux maintenance while active, flux increase by taking damage) while allowing armor and hull to take a portion of the damage not absorbed by the barrier.

If there isn't any, it is okay with me. I may be asking too much since this shield type is unique and requires actual coding that is not likely to exist in the Starsector base.

Damper Field  :P

Also, on a similar note, for regular-type shields there is a mutableStat "shieldUnfoldSpeed" or something that affects the speed at which a shield deploys/extends.
Logged

Protonus

  • Captain
  • ****
  • Posts: 444
  • AAAAAAAAAAAA
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3502 on: August 12, 2017, 10:00:27 PM »

Damper Field  :P

Close, but Damper Field is an ability that depends on "Uses" and only extends to reducing damage in general and not utilize Flux unlike the Templars did.

I could remove the Weapon Lock and rig it to use flux at a constant rate, but I don't think there is a base script explicitly to gain flux from the amount of damage the shield absorbs.
« Last Edit: August 12, 2017, 10:05:44 PM by Protonus »
Logged

The cookies are a weird one, okay.

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3503 on: August 12, 2017, 10:18:51 PM »

Damper Field  :P

Close, but Damper Field is an ability that depends on "Uses" and only extends to reducing damage in general and not utilize Flux unlike the Templars did.

I could remove the Weapon Lock and rig it to use flux at a constant rate, but I don't think there is a base script explicitly to gain flux from the amount of damage the shield absorbs.

Yeah, that would be a bit more tricky. ;) I was more using the Damper Field to represent the "fast shield that instantly covers the ship" part of your query.

Although, I wasn't aware the Lattice Shields on Templar ships actually generated flux as they took damage. Huh.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3504 on: August 13, 2017, 01:20:46 PM »

Well, it's embarassing, but I'm stumped, trying to draw a textured quad in SS. 

I have the code below built, but it doesn't appear to do anything at all, other than not crash.   I've tried looking at the examples laying around but haven't gotten anywhere.

Running in renderInWorldCoords()

Code
		int textureID = 0;
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

for(fx_Particle particle : fx_SharedLib.particleList){
if(particle.sprite.getTextureId() != textureID){
textureID = particle.sprite.getTextureId();
glBindTexture(GL_TEXTURE_2D, textureID);
}

glColor4ub((byte)particle.curColor.getRed(),
(byte)particle.curColor.getGreen(),
(byte)particle.curColor.getBlue(),
(byte)particle.curColor.getAlpha());
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
Vector2f vec = MathUtils.getPointOnCircumference(particle.position, particle.size.getX(), particle.angle + 315f);
glVertex2f(vec.getX(),vec.getY());

glTexCoord2f(1, 0);
vec = MathUtils.getPointOnCircumference(particle.position, particle.size.getX(), particle.angle + 45f);
glVertex2f(vec.getX(),vec.getY());

glTexCoord2f(1, 1);
vec = MathUtils.getPointOnCircumference(particle.position, particle.size.getX(), particle.angle + 135f);
glVertex2f(vec.getX(),vec.getY());

glTexCoord2f(0, 1);
vec = MathUtils.getPointOnCircumference(particle.position, particle.size.getX(), particle.angle + 225f);
glVertex2f(vec.getX(),vec.getY());
glEnd();
}
glPopMatrix();
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 25006
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3505 on: August 13, 2017, 01:36:34 PM »

I'd try disabling GL_TEXTURE_2D and trying to render a single quad with a hardcoded color and hardcoded coordinates (probably based on the player fleet's location?) Just something where you can get anything rendering at all, that's often the hardest part :)

My guess, fwiw, is that the coordinates are off and they're rendering somewhere, just now where you can see. Or the color is borked.

Also, you probably want to put the glBegin/glEnd outside the loop, but that's a performance thing and wouldn't cause what you're seeing. Or not seeing, as it were.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3506 on: August 13, 2017, 01:42:48 PM »

K, I'll give that a go.  Like I said, kind of embarassing, lol  ::)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

banano of doom

  • Captain
  • ****
  • Posts: 287
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3507 on: August 13, 2017, 07:16:04 PM »

couple more questions
is it possible to make custom weapon slot and some weapons compatible only with this type of slots?
is it possible to make station modules equipable in refit menu and obtainable through market?
thanks.
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3508 on: August 14, 2017, 07:06:03 AM »

1.  It's not possible to make a custom weapon slot, unfortunately.  You'll want to use Built-In weapons instead, if you want unique, Faction-specific weapons that nobody else can have.

2.  I don't know about the Station Modules, but I'm guessing no; they are "weapons" currently, but they aren't exactly set up to be friendly to equipping / modification in the Refit UI.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

banano of doom

  • Captain
  • ****
  • Posts: 287
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3509 on: August 14, 2017, 08:08:10 PM »

@xenoargh, that's disappointing, but thanks anyway.
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.
Pages: 1 ... 232 233 [234] 235 236 ... 751