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)

Pages: 1 ... 581 582 [583] 584 585 ... 706

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

Haze

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8730 on: May 06, 2022, 03:40:24 PM »

Code
{
    "id": "Phase",
    "name": "Phase",
    "author": "Haze",
    "utility": "false",
    "version": { "major":"1", "minor": "0", "patch": "0" },
    "description": "Mod description.",
    "gameVersion": "0.95.1a-RC6",
    "jars":["jars/Phase.jar"],
    "dependencies": [
        {
            "id": "lw_lazylib",
            "name": "LazyLib",
            # "version": "2.6" # If a specific version or higher is required, include this line
        }
    ]
}

Thanks for reaching out.
Logged

Üstad

  • Commander
  • ***
  • Posts: 131
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8731 on: May 06, 2022, 05:19:52 PM »

displayArcRadius":

What does this do in weapon files?

Also I want a certain weapon to have armor damage like the speaciality of breach missile. How do I do that?
« Last Edit: May 07, 2022, 09:15:57 AM by Üstad »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8732 on: May 07, 2022, 04:53:51 PM »

displayArcRadius":

What does this do in weapon files?

Nothing. It used to affect the weapon arc overlay at some point in the distant past.

Also I want a certain weapon to have armor damage like the speaciality of breach missile. How do I do that?

I'd suggest taking a look at breach_srm.proj!


I've tried asking this question in the unofficial discord, but I've not gotten much help.

I've taken two java files from the starfarer.api zip file and I've edited them both. PhaseCloakStats.java to remove the flux slowdown, and MineStrikeStats.java to give it back its old range and minimum spawn range. I've attempted to use this to try to make it into a usable mod, with no success.

What do I do? How can I make this work? Keeping the modplugin section in mod_info crashes my game on launch, but deleting it causes the mod to have no effect on the game.

If anyone can help me out, I'll be very very grateful. I've been spending all afternoon toiling over this.

And in case someone's willing to make the mod for me, here's the java files I've edited. All I had to do was change up a few values, but still.
https://pastebin.com/bS4EvxQn
https://pastebin.com/XpsJAk4h

In brief, you'd want to set up an IDE and compile your code, then have your mod provide a ship_systems.csv that points at your modified classes instead of the vanilla ones.

The project template you're looking at - I mean, I'm sure it's good! - but it also looks like it might be too much unless you're already pretty familiar with Java. Not that setting up an IDE (dev environment) is going to be the easiest thing, but there are some step-by-step guides for that... somewhere around here - possibly on the wiki? Hopefully someone would be able to point you towards that, either here or on the Discord.
Logged

theDragn

  • Captain
  • ****
  • Posts: 305
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8733 on: May 07, 2022, 08:09:50 PM »

Is there some way to check to see if weapon arcs are toggled on through code? I have some opengl-rendered indicators that I want to turn off if arcs are off, and Global.getCombatEngine().isUIShowingHUD() only appears to be for the whole hud, not just arcs.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8734 on: May 07, 2022, 08:15:12 PM »

I don't believe so, no. Let me add CombatUIAPI.areWeaponArcsOn().
Logged

theDragn

  • Captain
  • ****
  • Posts: 305
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8735 on: May 07, 2022, 08:23:06 PM »

I don't believe so, no. Let me add CombatUIAPI.areWeaponArcsOn().

Thanks!

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8736 on: May 08, 2022, 03:06:07 AM »

Is there anyway to make AI know "there will be an explosion" and toggle on their shield or phase?
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8737 on: May 08, 2022, 12:19:19 PM »

Hmm - you could try placing an invisible mine with a time-until-explosion set to whatever value you want. That seems like it might work, though it could be tricky if it gets collided with - if it's CollisionClass.NONE, then it might not cause a reaction, but if it's not, then something might hit it.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8738 on: May 08, 2022, 10:17:02 PM »

Hmm - you could try placing an invisible mine with a time-until-explosion set to whatever value you want. That seems like it might work, though it could be tricky if it gets collided with - if it's CollisionClass.NONE, then it might not cause a reaction, but if it's not, then something might hit it.
I have thought about this and wondering if CollisionClass.NONE would be ignored...
Logged
My mods


CrashToDesktop

  • Admiral
  • *****
  • Posts: 3876
  • Quartermaster
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8739 on: May 09, 2022, 12:42:26 AM »

I've got a bit of a brain teaser whose answer I'm not entirely sure of. Beam armor penetration is dependent on their DPS, and that technically changes if the ship undergoes time acceleration, though I'm not sure if the game actually takes that into account. Do beams gain more armor penetration when fired *from* a ship under time acceleration? Is their armor penetration reduced when firing *at* a ship under time acceleration? What if two ships under time acceleration fire beams at eachother?
« Last Edit: May 09, 2022, 02:31:54 AM by The Soldier »
Logged
Quote from: Trylobot
I am officially an epoch.
Quote from: Thaago
Note: please sacrifice your goats responsibly, look up the proper pronunciation of Alex's name. We wouldn't want some other project receiving mystic power.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8740 on: May 10, 2022, 01:06:39 PM »

There's no specific interaction there, aside from the beam doing more damage since the damage it deals is based on the timescale of the firing ship.
Logged

AccuracyThruVolume

  • Commander
  • ***
  • Posts: 133
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8741 on: May 12, 2022, 11:11:31 AM »

I am trying to make a hullmod that reduces a specific fighter OP cost by a big percentage.  Normally the OP cost is absurdly large at 100 OP.
Also any fighter that doesn't have a specific prefix (used by all fighters in this faction)  will have its OP cost increased by 10.

Currently for some reason not only is the specific fighter OP cost not decreased, all fighters are increased by 10 (so its sorta working.... :o  )

What dumb did I do?


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;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.WeaponAPI.WeaponSize;
import com.fs.starfarer.api.combat.WeaponAPI.WeaponType;
import com.fs.starfarer.api.combat.listeners.FighterOPCostModifier;
import com.fs.starfarer.api.combat.listeners.WeaponOPCostModifier;
import com.fs.starfarer.api.impl.campaign.ids.Stats;
import com.fs.starfarer.api.loading.FighterWingSpecAPI;
import com.fs.starfarer.api.loading.WeaponSpecAPI;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class battlefleets_ork_massive_hangar extends BaseHullMod
{
   
   public static float COST_MODIFIER = 0.2f;

   @Override
    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)
   {
      @Override
      stats.addListener(new FighterOPCostModifier()
      {
         public int getFighterOPCost(MutableShipStatsAPI stats, FighterWingSpecAPI fighter, int currCost)
         {
            if (fighter.getId().contains("battlefleets_ork_megabommer"))
            {
               return (int) (currCost * COST_MODIFIER);
            }
            
            if (!fighter.getId().contains("battlefleets_ork_"))
            {   
               return (currCost + (int) 10);
            }
            return currCost;
         }
      });
    }
   
   @Override
   public boolean affectsOPCosts() {
      return true;
   }
   
   public String getDescriptionParam(int index, HullSize hullSize)
   {
      //if (index == 0) return "" + (int) COST_MODIFIER + "%";
      if (index == 0) return "" + (int) Math.round( (1f - COST_MODIFIER) * 100f) + "%";
      if (index == 1) return "" + (int) 10;
      return null;
   }

}

[close]



Edit: Turns out my dumb was in the naming of the fighter wings

Is there a limitation with janino and if statements?

'cause:

if (!fighter.getId().contains("battlefleets_ork_"))
{   
    return (currCost + (int) 10);
}

works  but:

if ( (!fighter.getId().contains("battlefleets_ork_1")) || (!fighter.getId().contains("battlefleets_ork_2")) )
{   
    return (currCost + (int) 10);
}

Causes a crash?
« Last Edit: May 12, 2022, 12:19:11 PM by AccuracyThruVolume »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8742 on: May 12, 2022, 11:17:55 AM »

Hmm, the code looks right to me at first glance? I'd double-check that all the ids you've got in there are actually correct.

Edit: also, getId() is going to return the wing id, not the hull id, in case that's the problem.
Logged

SpaceDrake

  • Captain
  • ****
  • Posts: 484
  • Piloting space mecha for fun and profit(?)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8743 on: May 12, 2022, 11:48:47 AM »

So out of curiosity, what are all the files that define how faction relations are at the start?

I'm trying to adjust a mod's starting relations to be a bit more "interesting", but it's proving to be a bit of a struggle.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8744 on: May 12, 2022, 12:13:36 PM »

In vanilla, that's SectorGen.java, but since this can be done arbitrarily by code from just about anywhere, it's not possible to provide a comprehensive list.

Your best bet might be to have a custom script that runs and sets the relations to what you want once the game has started.

Edit: if there's an accepted standard among mods for where to do this, then hopefully someone else could point you to that? I don't know if there is one or not.
Logged
Pages: 1 ... 581 582 [583] 584 585 ... 706