Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Pages: 1 ... 193 194 [195] 196 197 ... 779

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

Paralityk

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2910 on: August 01, 2016, 07:27:18 AM »

Thank you. That was exactly it! Little tampering with .class files and everything works like a charm.
Logged

Paralityk

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2911 on: August 01, 2016, 05:52:55 PM »

Sorry for double post but it's for another question so I hope it's fine.
Where do I change weapon size? It's not specified in weapon_data.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26090
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2912 on: August 01, 2016, 06:42:06 PM »

In the .wpn file under data/weapons.
Logged

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2913 on: August 04, 2016, 07:46:52 AM »

Is there any way to make a ui sound (like Global.getSoundPlayer().playUISound()) loop? I'm currently using intervals (IntervalUtil(float,float)), but it's messy as heck.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26090
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2914 on: August 04, 2016, 08:42:14 AM »

There's no explicit support for UI loops, but you can get around it by calling the regular playLoop() method and passing in a stereo sound.

As a side note, all stereo sounds play as-is, while mono sounds will be converted into stereo based on their location relative to the listener. So, for example, if one had a stereo sound for say weapon fire or an explosion, that would be bad.
Logged

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2915 on: August 04, 2016, 09:13:07 AM »

Ah, that's cool, didn't know that. If I can figure things out, maybe there'll be another mod available out there in a day or two ;)
 Thank you for your help!
Logged

Grizzlyadamz

  • Commander
  • ***
  • Posts: 101
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2916 on: August 04, 2016, 06:11:57 PM »

Is there a way to change relationship-modifiers?

I feel I shouldn't get a relationship-hit for piracy when my transponder's off, (which would limit me to solo-action 'targets of opportunity'), and I'd rather not have to resort to dev commands every time that happens.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26090
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2917 on: August 05, 2016, 08:35:01 AM »

Is there a way to change relationship-modifiers?

I feel I shouldn't get a relationship-hit for piracy when my transponder's off, (which would limit me to solo-action 'targets of opportunity'), and I'd rather not have to resort to dev commands every time that happens.

There is, but it requires some Java knowledge. On a high level, you'd want to register a plugin to handle reputation adjustment actions, check to see if the action matches your criteria (i.e. fighting a fleet, transponder off) and then handle the action appropriately.


actually to make my post relevant to the op how moddable is the metagame structure? I don't have a clue how to java but since you're working on the campaign-level game loop now, would it be hard for a modder to mod an rts-style campaign into the game that includes over-world out-of-combat gameplay? I find Homeworld fascinating but always a near-miss because of the way it's a string of pre-ordained missions and lacks over-world in-between to contextualize the combat and I would love to see starsector bridge that gap

That's an awfully general question for this thread. Overall, though, I think the campaign is pretty moddable.
Logged

Grizzlyadamz

  • Commander
  • ***
  • Posts: 101
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2918 on: August 05, 2016, 09:46:09 AM »

There is, but it requires some Java knowledge. On a high level, you'd want to register a plugin to handle reputation adjustment actions, check to see if the action matches your criteria (i.e. fighting a fleet, transponder off) and then handle the action appropriately.
Shhoot. If I have to start from scratch that's probably a bit out of my depth.

But, if anyone happens to know of a similar mod, I could probably reverse-engineer it..?
« Last Edit: August 05, 2016, 10:58:30 AM by Grizzlyadamz »
Logged

Paralityk

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2919 on: August 06, 2016, 12:31:07 PM »

I have already asked this question in mod thread but sadly no one knows the answer or my question was simply ignored :(. My problem regards mod ApproLight. Which file do I have to edit to make Originem stay in the station for the whole month not only on 7th?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26090
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2920 on: August 07, 2016, 08:10:51 AM »

It's probably a case of "no-one knows". Might be worth asking in that mod's thread.
Logged

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2921 on: August 10, 2016, 07:04:03 AM »

How do you stop your faction's fleets from flying with their transponder off?

My fleets just fly around with transponders off and have no "leader" ship, and no commanders.
« Last Edit: August 17, 2016, 02:21:26 PM by gruberscomplete »
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

Orikson

  • Captain
  • ****
  • Posts: 280
  • Always Seen on Discord
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2922 on: August 19, 2016, 11:20:32 PM »

I've been trying to fix Citadel's star, Blaze; in the Citadel system. It's currently hollow like in previous versions of Starsector, but emits the corona as normal.

Which files do I need to modify or create to make it impassible?

Also, how do I make a planet orbit further from the centre of the star system? Citadel's Gateway is within the corona edges and its really burning up every fleet going to and fro (burn goods, burn!).

Here's the planet's API I think:

//GATEWAY
       
        PlanetAPI gateway = system.addPlanet("gateway", blaze, "Gateway", "arid", 0, 100, 1000, 381);
        gateway.setCustomDescriptionId("citadel_gateway");
        gateway.setFaction("citadeldefenders");

Also, it has an abandoned station orbiting it, do I have to change that as well? Here's its data:

//ABANDONDED STATION
       
        SectorEntityToken neutralStation = system.addOrbitalStation("citadel_abandoned_station", system.getEntityById("Gateway"), 155, 200, 53, "Abandoned Orbital Customs", "neutral");
        neutralStation.getMemory().set("$abandonedStation", true);
        MarketAPI market = Global.getFactory().createMarket("citadel_abandoned_station_market", neutralStation.getName(), 0);
        market.setPrimaryEntity(neutralStation);
        market.setFactionId(neutralStation.getFaction().getId());
        market.addCondition(Conditions.ABANDONED_STATION);
        market.addSubmarket(Submarkets.SUBMARKET_STORAGE);
        ((StoragePlugin) market.getSubmarket(Submarkets.SUBMARKET_STORAGE).getPlugin()).setPlayerPaidToUnlock(true);
        neutralStation.setMarket(market);
        neutralStation.setCustomDescriptionId("citadel_gateway_station");
        neutralStation.setInteractionImage("illustrations", "abandoned_station");

All of the above data is from Citadel.java.

Thanks for listening!
Logged
"A story teller and a trader. Tell me your tales and I'll tell you no lies."

Come join the Starsector Fan Chat! It's decently active.

Link: https://discord.gg/eb5UC

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 432
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2923 on: August 21, 2016, 05:31:29 AM »

What's the meaning of :
"specialWeaponGlowWidth":15,
"specialWeaponGlowHeight":20,   

And, there are how many steps to deal damage? If the damage dealt at a Vector2f, how to calculate all the damage it takes?
Logged
My mods


Drokkath

  • Captain
  • ****
  • Posts: 281
  • Xenophilic Mutant Commando
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2924 on: August 21, 2016, 05:43:49 AM »

I don't get it (mind you, my level of skill with java coding is next to sub-zero):

Spoiler
Code: java
package data.hullmods;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.FleetDataAPI;
import com.fs.starfarer.api.campaign.BuffManagerAPI.Buff;
import com.fs.starfarer.api.combat.HullModEffect;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.MutableStat;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.MutableStat.StatMod;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import com.fs.starfarer.api.fleet.FleetMemberAPI;

public class TowCableMk2 implements HullModEffect {

public static final String HULLMOD_ID = "tow_cable_mk2";

public static class TowCableMk2Buff implements Buff {
//public boolean wasApplied = false;
private String buffId;
private int frames = 0;

public TowCableMk2Buff(String buffId) {
this.buffId = buffId;
}

public boolean isExpired() {
//return wasApplied;
return frames >= 2;
}
public String getId() {
return buffId;
}
public void apply(FleetMemberAPI member) {
// this ensures the buff lasts for exactly one frame unless wasApplied is reset (as it is later)
//wasApplied = true;
member.getStats().getMaxBurnLevel().modifyFlat(buffId, 20);
}
public void advance(float days) {
frames++;
}
};


public TowCableMk2() {

}

public void advanceInCampaign(FleetMemberAPI member, float amount) {
if (member.getFleetData() == null) return;

if (!member.getVariant().getHullMods().contains(HULLMOD_ID)) {
cleanUpTowCableMk2BuffBy(member);
return;
}

if (!member.canBeDeployedForCombat()) {
cleanUpTowCableMk2BuffBy(member);
return;
}

FleetDataAPI data = member.getFleetData();
List<FleetMemberAPI> all = data.getMembersListCopy();

int numCables = 0;
int thisCableIndex = -1;
for (FleetMemberAPI curr : all) {
if (!curr.canBeDeployedForCombat()) continue;
if (curr.getVariant().getHullMods().contains(HULLMOD_ID)) {
if (curr == member) {
thisCableIndex = numCables;
}
numCables++;
}
}
if (numCables <= 0 || thisCableIndex == -1) {
cleanUpTowCableMk2BuffBy(member);
return;
}

TowCableMk2Buff buff = getTowCableMk2BuffBy(member, true);
Map<FleetMemberAPI, Integer> cables = new HashMap<FleetMemberAPI, Integer>();
float towSpeed = member.getStats().getMaxBurnLevel().getModifiedValue();
FleetMemberAPI thisCableTarget = null;

for (int cableIndex = 0; cableIndex < numCables; cableIndex++) {
FleetMemberAPI slowest = getSlowest(all, towSpeed, cables);
if (slowest == null) break;
//slowest.getStats().getMaxBurnLevel().getModifiedValue()
Integer bonus = cables.get(slowest);
if (bonus == null) bonus = new Integer(0);
bonus++;
cables.put(slowest, bonus);

if (cableIndex == thisCableIndex) {
thisCableTarget = slowest;
Buff existing = slowest.getBuffManager().getBuff(buff.getId());
if (existing == buff) {
// make sure it's using the same buff rather than reapplying it,
// which would trigger a full stat recompute for the entire FLEET every frame
//buff.wasApplied = false;
buff.frames = 0;
//System.out.println("renewed on " + slowest);
} else {
//buff.wasApplied = false;
buff.frames = 0;
slowest.getBuffManager().addBuff(buff);
//System.out.println("Num: " + slowest.getBuffManager().getBuffs().size());
//System.out.println("added to " + slowest);
}
break;
}
}

for (FleetMemberAPI curr : all) {
if (curr != thisCableTarget) {
curr.getBuffManager().removeBuff(buff.getId());
}
}
}

private FleetMemberAPI getSlowest(List<FleetMemberAPI> all, float speedCutoff, Map<FleetMemberAPI, Integer> cables) {
FleetMemberAPI slowest = null;
float minLevel = Float.MAX_VALUE;
for (FleetMemberAPI curr : all) {
if (!isSuitable(curr)) continue;

float baseBurn = getMaxBurnWithoutCables(curr);
Integer bonus = cables.get(curr);
if (bonus == null) bonus = new Integer(0);

if (bonus >= getMaxCablesFor(curr)) continue;

float burnLevel = baseBurn + bonus;

if (burnLevel >= speedCutoff) continue;

if (burnLevel < minLevel) {
minLevel = burnLevel;
slowest = curr;
}
}
return slowest;
}

private int getMaxCablesFor(FleetMemberAPI member) {
// switch (member.getHullSpec().getHullSize()) {
// case CAPITAL_SHIP: return 4;
// case CRUISER: return 3;
// case DESTROYER: return 2;
// case FRIGATE: return 1;
// }
return 1;
}

private float getMaxBurnWithoutCables(FleetMemberAPI member) {
MutableStat burn = member.getStats().getMaxBurnLevel();
float val = burn.getModifiedValue();
float sub = 0;
for (StatMod mod : burn.getFlatMods().values()) {
if (mod.getSource().startsWith(HULLMOD_ID)) sub++;
}
return Math.max(0, val - sub);
}

private boolean isSuitable(FleetMemberAPI member) {
if (member.isFighterWing()) return false;
return true;
}

private void cleanUpTowCableMk2BuffBy(FleetMemberAPI member) {
if (member.getFleetData() == null) return;
FleetDataAPI data = member.getFleetData();
TowCableMk2Buff buff = getTowCableMk2BuffBy(member, false);
if (buff != null) {
for (FleetMemberAPI curr : data.getMembersListCopy()) {
curr.getBuffManager().removeBuff(buff.getId());
}
}
}

/**
* One instance of the buff object per ship with a Tow Cable.
*/
public static final String TOW_CABLE_MK2_KEY = "TowCableMk2_PersistentBuffs";

@SuppressWarnings("unchecked")
private TowCableMk2Buff getTowCableMk2BuffBy(FleetMemberAPI member, boolean createIfMissing) {
Map<FleetMemberAPI, TowCableMk2Buff> buffs;
if (Global.getSector().getPersistentData().containsKey(TOW_CABLE_KEY)) {
buffs = (Map<FleetMemberAPI, TowCableMk2Buff>) Global.getSector().getPersistentData().get(TOW_CABLE_MK2_KEY);
} else {
buffs = new HashMap<FleetMemberAPI, TowCableMk2Buff>();
Global.getSector().getPersistentData().put(TOW_CABLE_KEY, buffs);
}

//new HashMap<FleetMemberAPI, TowCableMk2Buff>();
TowCableMk2Buff buff = buffs.get(member);
if (buff == null && createIfMissing) {
String id = HULLMOD_ID + "_" + member.getId();
buff = new TowCableMk2Buff(id);
buffs.put(member, buff);
}
return buff;
}


public void advanceInCombat(ShipAPI ship, float amount) {
}

public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
}
public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
}
public boolean isApplicableToShip(ShipAPI ship) {
return true;
}

public String getDescriptionParam(int index, HullSize hullSize) {
return null;
}

}
[close]

I just need the gorram super (and separate) version of the tow cable and I will only get errors and a nervous breakdown if I were to strain myself with it since I suck at java and recently already went through a massive nervous breakdown and I prefer (for my own mental well-being) that somebody please help me to iron it out so it doesn't crash or something. I need that kryptonian tow cable!
« Last Edit: August 21, 2016, 09:20:15 AM by Alex »
Logged
For I dipt in to the future, far as my gazer eye could see; Saw the vision of the world, and all the wonder that would be.
Pages: 1 ... 193 194 [195] 196 197 ... 779