Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 125 126 [127] 128 129 ... 711

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

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1890 on: November 14, 2014, 11:20:05 PM »

Hmm, still generates the same crash, but thanks, because that declaration error will cause another crash in the future.
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

NikolaiLev

  • Captain
  • ****
  • Posts: 325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1891 on: November 15, 2014, 10:51:44 AM »

Putting this here since search has failed me but I'm sure it's been asked before; is Starsector's AI code somewhere?  I'd like to make my own AI but without the base AI to work off of I have no idea where to start.

So, I know what vanilla AI is obfuscated.  Is there any chance of either 1) Unobfuscating it or 2) Allowing custom AI to callback to default AI behaviors?  That would allow modders to implement custom AI without building it from scratch.
Logged


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1892 on: November 15, 2014, 10:58:36 AM »

So, I know what vanilla AI is obfuscated.  Is there any chance of either 1) Unobfuscating it or 2) Allowing custom AI to callback to default AI behaviors?  That would allow modders to implement custom AI without building it from scratch.

1) No, because it's an internal part of the game and is not in any shape suitable to being exposed. If I were to code it *now*, I'd probably put the code in .api.impl, but that's not how it worked out, and exposing it would be extremely time-consuming.

2) No, because the AI is not structured in a way that makes this possible, because it wasn't designed for that.
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1893 on: November 15, 2014, 11:01:00 AM »

Putting this here since search has failed me but I'm sure it's been asked before; is Starsector's AI code somewhere?  I'd like to make my own AI but without the base AI to work off of I have no idea where to start.

So, I know what vanilla AI is obfuscated.  Is there any chance of either 1) Unobfuscating it or 2) Allowing custom AI to callback to default AI behaviors?  That would allow modders to implement custom AI without building it from scratch.

There are complete AIs from scratch that are functional and very well made, check out xenoargh mod. You can ask permission and use it, I'm sure.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7233
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1894 on: November 16, 2014, 08:09:21 PM »

Is there any way to turn off the energy damage boost with flux? I'm just playing around with things and wondering. :)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1895 on: November 16, 2014, 08:21:27 PM »

No, there isn't.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1896 on: November 16, 2014, 08:58:17 PM »

No, there isn't.
You can probably work around this with an every frame combat plugin that adjusts energy weapon damage inversely.  Might take a bit of work to make it function properly, and there might be some corner cases with high flux-per-shot weapons like the antimatter blaster...
Logged
Wyvern is 100% correct about the math.

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1897 on: November 16, 2014, 09:00:07 PM »

Not directly...buuuuuut.

blah extends BaseHullMod

    @Override
    public void advanceInCombat(ShipAPI ship, float amount) {

FluxTrackerAPI ft = ship.getFluxTracker();
float fluxPercent = ft.getCurrFlux() / ft.getMaxFlux();

ship.getMutableStats().getEnergyWeaponDamageMult().modifyPercent("my_hullmod", -1f * (fluxPercent * 50f));

}

Something like anyway, I've just highlighted the multiply by a negative as it means you're taking away flux damage, not adding.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1898 on: November 16, 2014, 09:17:41 PM »

Oh, hm. Yeah, that seems like it would work :)
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7233
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1899 on: November 16, 2014, 09:23:03 PM »

Thanks everyone!
Logged

Erick Doe

  • Global Moderator
  • Admiral
  • *****
  • Posts: 2489
  • "Pretty cunning, don't you think?"
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1900 on: November 17, 2014, 05:54:32 AM »

I know how to get things working if I create my own system and add my own entities.

But for now I'd just like to add quick compatibility with [0.65.1a] for Tore Up Plenty.

However, I am currently confused as to why the following isn't working:

Code
package data.scripts.world;

import java.awt.Color;
import java.util.List;

import com.fs.starfarer.api.InteractionDialogImageVisual;
import com.fs.starfarer.api.impl.campaign.CoreCampaignPluginImpl;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.SectorGeneratorPlugin;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.fleet.FleetMemberType;

import data.scripts.world.corvus.Corvus;

@SuppressWarnings( "unchecked" )
public class TUPGen implements SectorGeneratorPlugin {

public void generate( SectorAPI sector ) {

sector.registerPlugin(new CoreCampaignPluginImpl());

    StarSystemAPI system = sector.getStarSystem("Corvus");

SectorEntityToken sol = system.createToken(0, 0);
    SectorEntityToken token = system.createToken(2500, 15000);
SectorEntityToken TUPstation = system.addOrbitalStation(sol, 300, 5500, 100, "Scrapyard", "scavengers");

It lists the following error:
Quote
caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/TUPGen.java, Line 32, Column 59: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.campaign.SectorEntityToken, int, int, int, java.lang.String, java.lang.String"; candidates are: "public abstract com.fs.starfarer.api.campaign.SectorEntityToken com.fs.starfarer.api.campaign.LocationAPI.addOrbitalStation(java.lang.String, com.fs.starfarer.api.campaign.SectorEntityToken, java.lang.String, java.lang.String, float, float, float, float, java.lang.String, java.lang.String)", "public abstract com.fs.starfarer.api.campaign.SectorEntityToken com.fs.starfarer.api.campaign.LocationAPI.addOrbitalStation(java.lang.String, com.fs.starfarer.api.campaign.SectorEntityToken, float, float, float, java.lang.String, java.lang.String)"

Why can't I add an orbital station using the SectorEntityToken anymore?
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1901 on: November 17, 2014, 06:55:58 AM »

theyre not used any more, see the sector gen for Corvus for custom entities as stations to which you add markets.
Logged

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1902 on: November 17, 2014, 08:29:52 AM »

I thought this code for the gen file have no syntax error, right?
Code
//*snip*
player.setRelationship(renisim.getId(), 0);
diktat.setRelationship(renisim.getId(), RepLevel.HOSTILE);
independent.setRelationship(renisim.getId(), RepLevel.WELCOMING);
pirates.setRelationship(renisim.getId(), RepLevel.HOSTILE);
//*snip*
After testing it, it caused this crash :
Code
java.lang.RuntimeException: Error compiling [data.scripts.world.renisim_gen]
at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Parsing compilation unit "com.fs.starfarer.loading.A$1@1f417ca"
at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:180)
at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:158)
at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:199)
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:164)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/renisim_gen.java, Line 50, Column 15: ';' expected instead of 'player'
at org.codehaus.janino.Parser.compileException(Parser.java:2635)
at org.codehaus.janino.Parser.read(Parser.java:2370)
at org.codehaus.janino.Parser.parseBlockStatement(Parser.java:1017)
at org.codehaus.janino.Parser.parseBlockStatements(Parser.java:938)
at org.codehaus.janino.Parser.parseMethodDeclarationRest(Parser.java:804)
at org.codehaus.janino.Parser.parseClassBodyDeclaration(Parser.java:442)
at org.codehaus.janino.Parser.parseClassBody(Parser.java:393)
at org.codehaus.janino.Parser.parseClassDeclarationRest(Parser.java:372)
at org.codehaus.janino.Parser.parsePackageMemberTypeDeclaration(Parser.java:251)
at org.codehaus.janino.Parser.parseCompilationUnit(Parser.java:153)
at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:150)
... 7 more
According to the crash log, the player in player.setRelationship(renisim.getId(), 0); is considered by the engine as a syntax error.
Is the code above in a correct syntax?
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1903 on: November 17, 2014, 08:43:24 AM »

Here's mine, it also set relations to modded factions if they are present, and add named bounties:
Code: java
public static void initFactionRelationships(SectorAPI sector) {

        FactionAPI hegemony = sector.getFaction(Factions.HEGEMONY);
        FactionAPI tritachyon = sector.getFaction(Factions.TRITACHYON);
        FactionAPI pirates = sector.getFaction(Factions.PIRATES);
        FactionAPI independent = sector.getFaction(Factions.INDEPENDENT);
        FactionAPI kol = sector.getFaction(Factions.KOL);
        FactionAPI church = sector.getFaction(Factions.LUDDIC_CHURCH);
        FactionAPI path = sector.getFaction(Factions.LUDDIC_PATH);
        FactionAPI player = sector.getFaction(Factions.PLAYER);
        FactionAPI diktat = sector.getFaction(Factions.DIKTAT);

        FactionAPI scy = sector.getFaction("SCY");

        player.setRelationship(scy.getId(), RepLevel.SUSPICIOUS);
        scy.setRelationship(player.getId(), RepLevel.SUSPICIOUS);
        scy.setRelationship(path.getId(), RepLevel.HOSTILE);
        scy.setRelationship(hegemony.getId(), RepLevel.INHOSPITABLE);
        scy.setRelationship(pirates.getId(), RepLevel.HOSTILE);
        scy.setRelationship(diktat.getId(), RepLevel.INHOSPITABLE);
        scy.setRelationship(church.getId(), RepLevel.HOSTILE);
        scy.setRelationship(kol.getId(), RepLevel.SUSPICIOUS);
        scy.setRelationship(tritachyon.getId(), RepLevel.INHOSPITABLE);
        scy.setRelationship(independent.getId(), RepLevel.FRIENDLY);

        //modded factions
        FactionAPI sra = sector.getFaction("shadow_industry");
        FactionAPI pirateAnar = sector.getFaction("pirateAnar");
        FactionAPI mayorate = sector.getFaction("mayorate");
        FactionAPI ice = sector.getFaction("sun_ice");
        FactionAPI ici = sector.getFaction("sun_ici");
        FactionAPI citadel = sector.getFaction("citadeldefenders");
FactionAPI II = sector.getFaction("interstellarimperium");

        if (sra != null) {
            scy.setRelationship(sra.getId(), RepLevel.WELCOMING);
        }
        if (pirateAnar != null) {
            scy.setRelationship(pirateAnar.getId(), RepLevel.HOSTILE);
        }
        if (mayorate != null) {
            scy.setRelationship(mayorate.getId(), RepLevel.SUSPICIOUS);
        }
        if (ice != null) {
            scy.setRelationship(ice.getId(), RepLevel.NEUTRAL);
        }
        if (ici != null) {
            scy.setRelationship(ici.getId(), RepLevel.HOSTILE);
        }
        if (citadel != null) {
            scy.setRelationship(citadel.getId(), RepLevel.FAVORABLE);
        }
       
        if (II != null) {
            scy.setRelationship(uglystals.getId(), RepLevel.INHOSPITABLE);
        }
//named bounties
        SharedData.getData().getPersonBountyEventData().addParticipatingFaction("SCY");
    }
Logged
 

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1904 on: November 18, 2014, 12:24:18 AM »

Thanks, but how about neutral relations to a faction? You don't have to define it right?
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]
Pages: 1 ... 125 126 [127] 128 129 ... 711