Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 204 205 [206] 207 208 ... 711

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

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2847
  • Your Friendly Forum Friend
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3075 on: April 06, 2017, 01:36:34 PM »

Is there a way to make a player-only hullmod, unusable by Dynasector?
If your mod is not integrated with vanilla or Dynasector, then any mod you make won't be used by Dyna
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

Mongreal

  • Ensign
  • *
  • Posts: 46
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3076 on: April 09, 2017, 02:57:51 AM »

Another question that came when I was playing with projectiles and missile collision class : Which is the most efficient way, in a plugin, to know if the projectile/missile will score a hit on anything (ship, projectile, asteroid) at a given range ?
I was playing a bit with :
Code
Vector2f projection = new Vector2f(collideDistance, 0f);
                    Vector2f location = proj.getLocation();

                    //List<ShipAPI> checkList = engine.getShips();
                    //List<ShipAPI> finalList = new LinkedList<>();
                    Vector2f point = CollisionUtils.getCollisionPoint(location, projection, proj);
                    if (point != null && MathUtils.getDistance(location, point) <= collideDistance) {
                        //Do something, change a variable, etc... In this case, change the collisionRadius and the collisionClass back to something that may hit the entity
                    }
But that doesn't seems to work, and I guess it's because my projectile is actually a missile with collisionRadius = 0 and collisionClass = NONE. Does that make "getCollisionPoint" null ?
Is there any other way to detect if a projectile without collision will intercept another entity ?
« Last Edit: April 16, 2017, 08:33:27 AM by Mongreal »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4692
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3077 on: April 17, 2017, 05:10:36 AM »

A bit late but:
Another question that came when I was playing with projectiles and missile collision class : Which is the most efficient way, in a plugin, to know if the projectile/missile will score a hit on anything (ship, projectile, asteroid) at a given range ?
I was playing a bit with :
Code
Vector2f projection = new Vector2f(collideDistance, 0f);
                    Vector2f location = proj.getLocation();

                    //List<ShipAPI> checkList = engine.getShips();
                    //List<ShipAPI> finalList = new LinkedList<>();
                    Vector2f point = CollisionUtils.getCollisionPoint(location, projection, proj);
                    if (point != null && MathUtils.getDistance(location, point) <= collideDistance) {
                        //Do something, change a variable, etc... In this case, change the collisionRadius and the collisionClass back to something that may hit the entity
                    }
But that doesn't seems to work, and I guess it's because my projectile is actually a missile with collisionRadius = 0 and collisionClass = NONE. Does that make "getCollisionPoint" null ?
Is there any other way to detect if a projectile without collision will intercept another entity ?
getCollisionPoint doesn't check collision class, only the vectors. Collision radius of zero might break it though. (Right-click on the method in your IDE and go to the method source to see details)
Your third arg for the method call needs to be whichever entity the projectile might hit, not the projectile itself.
Also the variable assigned to projection means it'll only work for projectiles flying horizontally. To get the proper projection, multiply the projectile's velocity by the how far to extrapolate in seconds.

Although depending on what you're doing, you probably shouldn't even be using getCollisionPoint, just CombatUtils.getShipsWithinRange and the equivalent methods for missiles/asteroids followed by CollisionUtils.isPointWithinBounds.
Logged

Mongreal

  • Ensign
  • *
  • Posts: 46
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3078 on: April 17, 2017, 07:20:27 AM »

Oh, so that's why. Thanks, I'll try that this week and see if I can manage to make my weapon work.
Logged

cjuicy

  • Captain
  • ****
  • Posts: 353
  • Figuring out how the hell to wear heels (She/it)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3079 on: April 20, 2017, 07:00:48 PM »

Is there a way to make a weapon mountable on any type of weapon slot? (Like a universal weapon type, fitting on ballistic, missile, and energy?)
Logged
It's been a long time, but I still love ya!

- Pfp done by Sleepyfish!

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2847
  • Your Friendly Forum Friend
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3080 on: April 20, 2017, 09:49:14 PM »

I'm trying to port over a mod from 72 and I can't seem to get it to work... It doesn't crash but it doesn't work either
Spoiler
package data.hullmods;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;

public class test extends BaseHullMod {

    public static final float DEPLOYMENT_PENALTY = 30f;
    public static final float LOGISTICS_BONUS = 30f;

    @Override
    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
        stats.getSuppliesPerMonth().modifyMult(id, 1f - LOGISTICS_BONUS * 0.01f);
        stats.getSuppliesToRecover().modifyMult(id, 1f - LOGISTICS_BONUS * 0.01f);
        stats.getCRPerDeploymentPercent().modifyMult(id, 1f - DEPLOYMENT_PENALTY * 0.01f);
    }

    @Override
    public String getDescriptionParam(int index, HullSize hullSize) {
        if (index == 0) {
            return "" + (int) LOGISTICS_BONUS;
        }
        if (index == 1) {
            return "" + (int) DEPLOYMENT_PENALTY;
        }
        return null;
    }
}
[close]
It is supposed to reduce the deployment by a percentage
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

Histidine

  • Admiral
  • *****
  • Posts: 4692
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3081 on: April 22, 2017, 05:19:53 AM »

Is com.fs.starfarer.api.impl.campaign.rulecmd.newgame not actually a usable package, or is there another reason my class can't be found while in it?

Code
com.fs.starfarer.api.util.RuleException: java.lang.RuntimeException: Command [NGCGetExerelinDefaults] not found in packages:
com.fs.starfarer.api.impl.campaign.rulecmd
com.fs.starfarer.api.impl.campaign.rulecmd.salvage
com.fs.starfarer.api.impl.campaign.rulecmd.newgame

EDIT: Happening with a rule command in plain old com.fs.starfarer.api.impl.campaign.rulecmd as well.
« Last Edit: April 22, 2017, 05:23:11 AM by Histidine »
Logged

Embolism

  • Admiral
  • *****
  • Posts: 511
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3082 on: April 22, 2017, 05:40:05 AM »

How are hull entries hidden from the codex? I'm looking through the hidden skins (the Pirate Shade entry isn't hidden by the way, although Pirate Afflictor is) and I can't tell what's different in the skin file. Must be somewhere else?
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 452
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3083 on: April 22, 2017, 05:49:12 AM »

How are hull entries hidden from the codex? I'm looking through the hidden skins (the Pirate Shade entry isn't hidden by the way, although Pirate Afflictor is) and I can't tell what's different in the skin file. Must be somewhere else?
The Afflictor has the descriptionid of "wolf". Which is weird. I assume that it should be "afflictor". Changing it doesn't seem to make it visible in the codex, however.
Logged

SainnQ

  • Commander
  • ***
  • Posts: 219
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3084 on: April 22, 2017, 06:18:26 AM »

How difficult is it to utilize the ship editor & modify the bonuses Hullmods provide?

I would really like to try experimenting with some ship variants that utilize High Resolution Sensor & Survey Equipment Hullmods of various bonuses.

It seems odd that there aren't more ships added with .8a that already carry these. Beside the usual like the Apogee (Which is the only High Res Sensors ship I know of off-hand)
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 452
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3085 on: April 22, 2017, 06:20:57 AM »

How difficult is it to utilize the ship editor & modify the bonuses Hullmods provide?

I would really like to try experimenting with some ship variants that utilize High Resolution Sensor & Survey Equipment Hullmods of various bonuses.

It seems odd that there aren't more ships added with .8a that already carry these. Beside the usual like the Apogee (Which is the only High Res Sensors ship I know of off-hand)
It's relatively simple, although you should use a program that can compile everything into a .jar file. I use Eclipse, personally. It's mostly just changing a couple of numbers and taking examples from Alex's code, if you aren't comfortable writing anything entirely new.

Ship variants are very easy, especially if you're making it as a skin (like ingame D variants or the XIV variants) of an existing ship. Look at vanilla skins for a template.
Logged

Embolism

  • Admiral
  • *****
  • Posts: 511
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3086 on: April 22, 2017, 07:54:23 AM »

Strange. Replacing a core skin with a mod one that's basically identical makes previously Codex-invisible entries visible. Why...?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3087 on: April 22, 2017, 09:54:25 AM »

Is com.fs.starfarer.api.impl.campaign.rulecmd.newgame not actually a usable package, or is there another reason my class can't be found while in it?

Code
com.fs.starfarer.api.util.RuleException: java.lang.RuntimeException: Command [NGCGetExerelinDefaults] not found in packages:
com.fs.starfarer.api.impl.campaign.rulecmd
com.fs.starfarer.api.impl.campaign.rulecmd.salvage
com.fs.starfarer.api.impl.campaign.rulecmd.newgame

EDIT: Happening with a rule command in plain old com.fs.starfarer.api.impl.campaign.rulecmd as well.

So it's just straight up not finding *any* rule commands from a mod, or only specific ones?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3088 on: April 22, 2017, 09:55:38 AM »

Strange. Replacing a core skin with a mod one that's basically identical makes previously Codex-invisible entries visible. Why...?

Skins that are "compatible" with the base hull (i.e. have the same weapon mounts etc) don't show in the Codex to avoid clutter.
Logged

Embolism

  • Admiral
  • *****
  • Posts: 511
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3089 on: April 22, 2017, 10:05:51 AM »

Strange. Replacing a core skin with a mod one that's basically identical makes previously Codex-invisible entries visible. Why...?

Skins that are "compatible" with the base hull (i.e. have the same weapon mounts etc) don't show in the Codex to avoid clutter.

I can't quite understand the rules for this. E.g. Hegemony Wolf shows up in the Codex (despite being identical to the base Wolf other than a paintjob), but Pirate Afflictor (having D-mods and losing weapon mounts) or Buffalo (having Shielded Cargo Holds and a ballistic instead of an energy mount) doesn't.
Logged
Pages: 1 ... 204 205 [206] 207 208 ... 711