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 ... 94 95 [96] 97 98 ... 752

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

Zudgemud

  • Commander
  • ***
  • Posts: 225
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1425 on: February 22, 2014, 02:31:26 PM »

Zudgemud
I assume your issue judging from the fact it cannot find the apparent effects is that you have not set up a sound in the sound.json. This is located in data/config.
Here is an example with this.

   "skt_fire":{
      "sounds":[
         {"file":"sounds/fx/guns/skt_fire_01.ogg","pitch":1,"volume":0.82},
         {"file":"sounds/fx/guns/skt_fire_01.ogg","pitch":0.95,"volume":0.82},
         {"file":"sounds/fx/guns/skt_fire_01.ogg","pitch":0.90,"volume":0.82},
      ],
   },
}
This is assuming your sound is in fx/guns you can change this path if you want.
This is a standalone one as well if you want to continue it then just copy paste after the red bracket
In this case, does the three different versions vary in pitch and volume settings simply so that every round fired sound a bit different (varying between the three I would assume)?

Other than that detail, it was exactly what I wanted to know, thanks!


To use the tachyon lance effect with projectiles you will need to make it a projectile onhiteffect. In vanilla its implemented as a beamonhiteffect.
I'll try to poke around with it a bit more, but I basically tried to do this earlier.


Weaponturretoffset and weaponhardpointoffset are used to change the point from where the weapon spits out its projectiles/beams, that is also how to change the position of the muzzle flash animation or glow animation.
Awesome, just what I wanted to know, thanks!
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1426 on: February 22, 2014, 03:05:52 PM »

Quote
In this case, does the three different versions vary in pitch and volume settings simply so that every round fired sound a bit different (varying between the three I would assume)?
It will pick one of those three settings; it's not defining a random range, no.  If you want a lot of variation, you need to either use more sounds or have more lines there, like I did with the Millenium Gun's sound effect in Vacuum (which sounds pretty close to the original source in-game).
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Zudgemud

  • Commander
  • ***
  • Posts: 225
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1427 on: February 22, 2014, 03:36:58 PM »

Perfect, thanks!
Logged

Xalendi

  • Commander
  • ***
  • Posts: 198
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1428 on: February 24, 2014, 12:10:26 PM »

How do I get built-in weapons to glow when firing? They're part of the ship sprite, not their own weapon sprite. Do I have to seperate them?
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 609
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1429 on: February 24, 2014, 12:44:35 PM »

How do I get built-in weapons to glow when firing? They're part of the ship sprite, not their own weapon sprite. Do I have to seperate them?

They are actually not part of the ship sprite, they work exactly the same as any other weapon.

The only difference is the mount. You can make a built in hidden or you can make it appear as usual.

So just treat them like any other weapon.

Edit: I think I misunderstood your post a bit.

Yes, Iw ould highly recommend to make them seperate sprites. If you need a good example of an in-built weapon take a look at the Onslaught.

Just reverse engineer the way it was done with that ship and it will be fine.
« Last Edit: February 24, 2014, 12:52:13 PM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Xalendi

  • Commander
  • ***
  • Posts: 198
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1430 on: February 24, 2014, 12:53:00 PM »

Ok, so when I'm drawing my ship, leave off the gun barrels and add them later as a weapon? Thanks for the help
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 609
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1431 on: February 24, 2014, 12:59:14 PM »

I would rather leave an ampty space or a mount and do the whole gun seperate including turret and gun barrels.

That way you could make different built-in waepons easy to swap or easily updated if you would ever do a new sprite of the gun.

Also built-in weapons tend to be hardpoint mounted like on the Onslaught.

You can make the barrels move as well, there is an option for that in the weapon file, "visual recoil" and "alternating" or "linked".

Just take a look at the built-in weapons file and graphics from that Onslaught and you will get what I am trying to say.
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Arumac

  • Lieutenant
  • **
  • Posts: 98
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1432 on: February 24, 2014, 03:22:22 PM »

Is there any way to use AIUtils.getNearbyEnemyMissiles  (and projectiles as well) to locate entities within a 100 degree arc in front of the ship as well as within a limited range?

Basically, I want the AI to use a system when it detects enemy missiles and projectiles within 600 units, and a 100 degree arc of the front of the ship.
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 609
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1433 on: February 24, 2014, 03:26:38 PM »

Yes, I am pretty sure that stuff has been done before.

I think Exigency uses an AI like that for the Repulsor, Blackrock as well I think.

Maybe you want to take a look at some AIs used in Xenoargh's Vacuum, he's got some crazy stuff there as well.

Hope that might help.
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

MesoTroniK

  • Admiral
  • *****
  • Posts: 1734
  • I am going to destroy your ships
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1434 on: February 24, 2014, 06:40:45 PM »

I think Exigency uses an AI like that for the Repulsor.

Don't use the one from the old 0.58d version that is still available for download, everything in it is vastly out of date. While it may appear I am dead that is in fact not the case, just working on an absolutely massive update...

Here is the AI to which you are referring but with a lot of improvements made to it.


Edit: The script had a bug fixed and some logic improvements ;)

Code
package data.shipsystems.scripts;

import java.util.List;

import org.lwjgl.util.vector.Vector2f;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.DamagingProjectileAPI;
import com.fs.starfarer.api.combat.MissileAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAIScript;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.ShipwideAIFlags;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.CollectionUtils;
import org.lazywizard.lazylib.CollectionUtils.CollectionFilter;
import org.lazywizard.lazylib.CollisionUtils;
import org.lazywizard.lazylib.MathUtils;
import org.lazywizard.lazylib.VectorUtils;
import org.lazywizard.lazylib.combat.AIUtils;
import org.lazywizard.lazylib.combat.CombatUtils;

public class exigency_RepulsorAI implements ShipSystemAIScript
{
    private static final float SECONDS_TO_LOOK_AHEAD = 3f;
    private ShipAPI ship;
    private final IntervalUtil tracker = new IntervalUtil(0.35f, 0.6f);
    private final CollectionFilter filterMisses = new CollectionFilter()
    {
        @Override
        public boolean accept(Object t)
        {
            DamagingProjectileAPI proj = (DamagingProjectileAPI) t;

            // Exclude missiles and our own side's shots
            if (proj instanceof MissileAPI || proj.getOwner() == ship.getOwner())
            {
                return false;
            }

            // Only include shots that are on a collision path with us
            // Also ensure they aren't travelling AWAY from us ;)
            return (CollisionUtils.getCollides(proj.getLocation(),
                    Vector2f.add(proj.getLocation(),
                    (Vector2f) new Vector2f(proj.getVelocity())
                    .scale(SECONDS_TO_LOOK_AHEAD), null),
                    ship.getLocation(), ship.getCollisionRadius())
                    && Math.abs(MathUtils.getShortestRotation(proj.getFacing(),
                    VectorUtils.getAngle(proj.getLocation(),
                    ship.getLocation()))) <= 90f);
        }
    };

    @Override
    public void init(ShipAPI ship, ShipSystemAPI system, ShipwideAIFlags flags, CombatEngineAPI engine)
    {
        this.ship = ship;
    }

    @SuppressWarnings("unchecked")
    @Override
    public void advance(float amount, Vector2f missileDangerDir, Vector2f collisionDangerDir, ShipAPI target)
    {
        tracker.advance(amount);
        Vector2f shipLoc = ship.getLocation();

        if (tracker.intervalElapsed())
        {
            // Can we even use the system right now?
            if (!AIUtils.canUseSystemThisFrame(ship))
            {
                return;
            }

            boolean shouldUseSystem = false;
            float repulseRadius = Math.max(ship.getCollisionRadius(), 100f);
            repulseRadius *= 3f;

            List nearbyThreats = CombatUtils.getProjectilesWithinRange(shipLoc, repulseRadius);//Use this to try and defend against weapons fire.
            nearbyThreats = CollectionUtils.filter(nearbyThreats, filterMisses);
            nearbyThreats.addAll(AIUtils.getNearbyEnemyMissiles(ship, repulseRadius));
            if (!nearbyThreats.isEmpty())
            {
                shouldUseSystem = true;
            }

            // If system is inactive and should be active, enable it
            // If system is active and shouldn't be, disable it
            if (ship.getSystem().isActive() ^ shouldUseSystem)
            {
                ship.useSystem();
            }
        }
    }
}
« Last Edit: February 24, 2014, 10:10:30 PM by MesoTroniK »
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 609
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1435 on: February 25, 2014, 07:42:07 AM »

Hi again!

I've tried to make a campaig integration of Biomancy but I am getting a weird error. I used the files from Blackroch Driveyards and simply modified them because I am not able to write scripts from scratch.

It is done exactly the same as in Blackrock (Gonna change planets and names and so on before I upload, I just wanted to test it before I change the layout and style of the star system) including the variant

randomizer and sovereign spawn point, i simply swapped everything with my stuff.

Why can't the script be cast? I don't understand this ...

Here's the stack pointing to the error:

Code
738628 [Thread-5] ERROR com.fs.starfarer.combat.O0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO  - java.lang.ClassCastException: data.scripts.world.Himmel.BGEGen cannot be cast to com.fs.starfarer.api.campaign.SectorGeneratorPlugin
java.lang.ClassCastException: data.scripts.world.Himmel.BGEGen cannot be cast to com.fs.starfarer.api.campaign.SectorGeneratorPlugin
at com.fs.starfarer.loading.B.o00000(Unknown Source)
at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
at com.fs.starfarer.title.OoOO.dialogDismissed(Unknown Source)
at com.fs.starfarer.ui.K.dismiss(Unknown Source)
at com.fs.starfarer.ui.impl.I.dismiss(Unknown Source)
at com.fs.starfarer.campaign.save.OooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.O00oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.o00000(Unknown Source)
at com.fs.starfarer.ui.F.processInput(Unknown Source)
at com.fs.starfarer.ui.newsuper.super(Unknown Source)
at com.fs.starfarer.B.ØÓÒ000(Unknown Source)
at com.fs.oOOO.A.Ò00000(Unknown Source)
at com.fs.starfarer.combat.O0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

If somebody has an idea why that happens I would be very thankfull!

Edit: I triple checked every row of code in all files related to this by now and I still have no idea what I did wrong. I really need some help with this please.
If somebody could tell me what could cause such an error would be very helpful, I have no idea where to look really. Better said, I looked everywhere already ...
« Last Edit: February 25, 2014, 09:36:09 AM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Arumac

  • Lieutenant
  • **
  • Posts: 98
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1436 on: February 25, 2014, 12:03:20 PM »

Yes, I am pretty sure that stuff has been done before.

I think Exigency uses an AI like that for the Repulsor, Blackrock as well I think.

Maybe you want to take a look at some AIs used in Xenoargh's Vacuum, he's got some crazy stuff there as well.

Hope that might help.

Yea, that's were I started looking as well, I'd basically need to modify those to get it to add another variable. Both range from the shop, and if the ship is facing the projectiles or not.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1779
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1437 on: February 25, 2014, 02:53:05 PM »

@Tecrys: I'm not sure what's causing that exception. For some reason Starsector is trying to use your BGEGen as something it isn't, which it doesn't do in the case of Blackrock's BRGen. My guess is that you added something somewhere telling Starsector that BGEGen is a SectorGeneratorPlugin, which it isn't. You might find this bare-bones example system useful.

Tecrys

  • Admiral
  • *****
  • Posts: 609
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1438 on: February 25, 2014, 03:53:03 PM »

I didn't add anything, just renamed a few things according to my faction and the files used like the spawn points.

Okay, I thought it was the variant picker and I removed it and changed everything back but it wasn't that one. Good to know, so I can put that back, handy little thing.

Thanks for the help, I will try to use that template instead, still not sure what I've done wrong.

PS: Producing weird bugs seems to become a hobby of mine ...
« Last Edit: February 25, 2014, 04:12:26 PM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Tecrys

  • Admiral
  • *****
  • Posts: 609
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1439 on: February 27, 2014, 01:49:05 AM »

Little question:

Is there a way to make a hull mod change the size of weapon slots?

It's easy to get the weapons by size but changing the size is not in weaponAPI.

Would it be possible to make the mod swap the hull with another?

Because in that case I could make a different hull with all weapon slots one size bigger.

Or could you make it so that an EveryFrameScript makes large weapons applicable to medium slots if the hullmod is installed? (If yes then I will need someone to do that script, such stuff is beyond my coding skills)

In the end it doesn't matter how it is done, the question is if it's possible at all and how.
« Last Edit: February 27, 2014, 01:54:38 AM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0
Pages: 1 ... 94 95 [96] 97 98 ... 752