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 ... 126 127 [128] 129 130 ... 752

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

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 #1905 on: November 18, 2014, 12:43:06 AM »

Neutral is the default relationship, you still can set it explicitly if you want.
Logged
 

Lcu

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

I am sorry for asking too much questions, but somehow i am still unable to set up my faction's system. I have set up the faction file, gen file, and the system file itself (in .java).
Faction file :
Code
{
id:"renis_imperium",
"color":[224,213,37,255],
"baseUIColor":[59,76,90,255],
"darkUIColor":[39,56,70,175],
"gridUIColor":[65,82,96,75],

#"darkUIColor":[100,100,100,175],
#"gridUIColor":[120,120,120,75],

#"color":[170,0,110,255],
"displayName":"Renis Imperium",
"logo":"graphics/renis/factions/renis_imperium.png",
"displayNameWithArticle":"the Renis Imperium",
"shipNamePrefix":"RIS",
"shipNameSources":{
"BRITISH_NAVY":1,
"ROMAN":1,
"GREEK":1,
},
"names":{
"old english":1,
},
"illegalCommodities":[
"drugs",
"organs",
],
"internalComms":"renis_imperium_internal",
"portraits":{
"standard_male":[
"graphics/portraits/portrait_hegemony01.png",
"graphics/portraits/portrait_hegemony02.png",
"graphics/portraits/portrait_hegemony05.png",
"graphics/portraits/portrait_mercenary01.png",
"graphics/portraits/portrait_mercenary03.png",
"graphics/portraits/portrait13.png",
"graphics/portraits/portrait15.png",
],
"standard_female":[
"graphics/portraits/portrait_hegemony03.png",
"graphics/portraits/portrait_hegemony04.png",
"graphics/portraits/portrait_mercenary02.png",
"graphics/portraits/portrait16.png",
],
},
"shipRoles":{
"interceptor":{
"r_seberat_wing":10,
"thunder_wing":10,
"fallback":{"fighter":1},
},
"fighter":{
"r_seberat_wing":10,
"fallback":{"interceptor":1},
},
"bomber":{
"piranha_wing":10,
},

"fastAttack":{
"r_enim_support":10,
"r_enim_assault":10,
"r_fasustport_assault":2,
"fallback":{"combatSmall":1},
},

"escortSmall":{
"r_enim_support":10,
"r_dreneder_balanced":1,
"r_enim_assault":10,
"fallback":{"combatSmall":1},
},
"escortMedium":{
"r_arloneria_balanced":10,
"r_arloneria_flas":10,
"r_fasustport_elite":10,
"r_fasustport_assault":10,
"fallback":{"combatMedium":1},
},

"combatSmall":{
"r_enim_assault":10,
"r_enim_support":10,
"r_dreneder_balanced":10,
"fallback":{"escortSmall":1},
},
"combatMedium":{
"r_fasustport_assault":10,
"r_fasustport_elite":10,
"r_fasustport_support":10,
"r_arloneria_balanced":10,
"r_arloneria_flas":10,
"sunder_CS":10,
"sunder_Assault":10,
"fallback":{"combatSmall":2},
},
"combatLarge":{
"r_minet_balanced":10,
"fallback":{"combatMedium":2},
},
"combatCapital":{
"r_ultima_balanced":10,
"fallback":{"combatLarge":2},
},


# hybrid ships with good combat and cargo capacity
"combatFreighterSmall":{
"fallback":{"freighterSmall":1},
},
"combatFreighterMedium":{
"fallback":{"combatFreighterSmall":2},
},
"combatFreighterLarge":{
"fallback":{"combatFreighterMedium":2},
},

"civilianRandom":{
"mercury_Standard":10,
"hermes_Standard":10,
"fallback":{"freighterSmall":1},
},

# carriers
"carrierSmall":{
"r_cafarrstier_support":10,
"fallback":{"carrierMedium":1},
},
"carrierMedium":{
"fallback":{"carrierSmall":2},
},
"carrierLarge":{
"fallback":{"carrierMedium":2},
},

# freighters and such
"freighterSmall":{
"hermes_Standard":10,
"fallback":{"freighterMedium":1},
},
"freighterMedium":{
"buffalo_Standard":10,
"fallback":{"freighterSmall":2},
},
"freighterLarge":{
"atlas_Standard":10,
"fallback":{"freighterMedium":2},
},

"tankerSmall":{
"dram_Light":10,
"fallback":{"tankerMedium":1},
},
"tankerMedium":{
"phaeton_Standard":10,
"fallback":{"tankerSmall":2},
},
"tankerLarge":{
"prometheus_Super":10,
"fallback":{"tankerMedium":2},
},

"personnelSmall":{
"mercury_Standard":10,
"fallback":{"personnelMedium":1},
},
"personnelMedium":{
"valkyrie_Elite":10,
"fallback":{"personnelSmall":2},
},
"personnelLarge":{
"fallback":{"personnelMedium":2},
},

# utility ships
"tug":{
"ox_Standard":10,
"fallback":{"utility":1},
},
"crig":{
"crig_Standard":10,
"fallback":{"utility":1},
},
"utility":{
"crig_Standard":10,
"ox_Standard":10,
},
},
"traits":{
"admiral":{
},
"captain":{
"cowardly":1,
"cautious":1,
"steady":1,
"aggressive":1,
"suicidal":1,
"fearless":1,
},
},
"dialogue":{
"greetingFriendly":"RIIC received. Friendly status confirmed. Good to see you.",
"greetingNeutral":"You have been scanned and identified. Communique on protocol Nu established. Over.",
"greetingHostileAggressive":"For violation of Rule 98 of the , power down your vessel and surrender. Over.",
"greetingHostileTimid":"For violation of Rule 56 of the , nearby patrol fleets has already been dispatched to intercept your fleet. You are advised to power down weapon systems and surrender. Over.",
}
},

Gen file :
Code
package data.scripts.world;

import java.awt.Color;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.RepLevel;
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.impl.campaign.shared.SharedData;
import com.fs.starfarer.api.impl.campaign.CoreCampaignPluginImpl;
import com.fs.starfarer.api.impl.campaign.CoreScript;
import com.fs.starfarer.api.impl.campaign.events.CoreEventProbabilityManager;
import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetManager;
import com.fs.starfarer.api.impl.campaign.ids.Factions;

import data.scripts.world.renisimsystems.Lorenais;

public class renisim_gen implements SectorGeneratorPlugin {

    public void generate(SectorAPI sector) {

        initFactionRelationships(sector);
        new Lorenais().generate(sector);


// }
    }

    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 ren = sector.getFaction("renis_imperium");

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

        //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) { 
            ren.setRelationship(sra.getId(), RepLevel.WELCOMING); 
        } 
        if (pirateAnar != null) { 
            ren.setRelationship(pirateAnar.getId(), RepLevel.HOSTILE); 
        } 
        if (mayorate != null) { 
            ren.setRelationship(mayorate.getId(), RepLevel.SUSPICIOUS); 
        } 
        if (ice != null) { 
            ren.setRelationship(ice.getId(), RepLevel.NEUTRAL); 
        } 
        if (ici != null) { 
            ren.setRelationship(ici.getId(), RepLevel.HOSTILE); 
        } 
        if (citadel != null) { 
            ren.setRelationship(citadel.getId(), RepLevel.FAVORABLE); 
        } 
         
        if (II != null) { 
            ren.setRelationship(uglystals.getId(), RepLevel.INHOSPITABLE); 
        } 
*/
        //named bounties
        SharedData.getData().getPersonBountyEventData().addParticipatingFaction("renis_imperium");
    }
}

System file :
Code
package data.scripts.world.renisimsystems;

import com.fs.starfarer.api.Global;
//import com.fs.starfarer.api.InteractionDialogImageVisual;
import com.fs.starfarer.api.campaign.JumpPointAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.OrbitAPI;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import java.awt.Color;
import com.fs.starfarer.api.impl.campaign.ids.Conditions;
import com.fs.starfarer.api.impl.campaign.ids.Submarkets;
import java.util.ArrayList;
import java.util.Arrays;

public class Lorenais {

    public void generate(SectorAPI sector) {

        StarSystemAPI system = sector.createStarSystem("Lorenais");
        system.getLocation().set(8500, -8500);
        LocationAPI hyper = Global.getSector().getHyperspace();

        system.setBackgroundTextureFilename("graphics/backgrounds/background4.jpg");

        PlanetAPI lorenais = system.initStar("lorenais", "star_yellow", 800f);

        PlanetAPI lore1 = system.addPlanet("hexis", lorenais, "Hexis", "barren", 36, 80, 1000, 64);
        lore1.setFaction("renis_imperium");

        PlanetAPI lore2 = system.addPlanet("poliensar", lorenais, "Poliensar", "gas_giant", 196, 180, 2250, 179);
        PlanetAPI lore3 = system.addPlanet(null, lore2, "Crelanom", "cryovolcanic", 50, 50, 600, 40);

        system.addRingBand(lore2, "misc", "rings1", 128f, 2, Color.white, 128f, 550, 40f);

        SectorEntityToken relay = system.addCustomEntity("lorenais_relay", // unique id
                "Lorenais Relay", // name - if null, defaultName from custom_entities.json will be used
                "comm_relay", // type of object, defined in custom_entities.json
                "renis_imperium"); // faction
        relay.setCircularOrbit( system.getEntityById("lorenais"), 279, 2000, 485);

        SectorEntityToken l1 = system.getEntityById("hexis");
        JumpPointAPI jumpPoint = Global.getFactory().createJumpPoint("hexis_gate", "Hexis Gate");
        OrbitAPI orbit = Global.getFactory().createCircularOrbit(l1, 0, 550, 30);
        jumpPoint.setOrbit(orbit);
        jumpPoint.setRelatedPlanet(l1);

        jumpPoint.setStandardWormholeToHyperspaceVisual();
        system.addEntity(jumpPoint);

        system.autogenerateHyperspaceJumpPoints(true, true);

 
    }
}
Looking into other mod's files, i assume the three files above are the only files necessary to set up a system. But still, it only shows the faction in the intel screen without any known enemies nor allies (even if it has been defined in the gen class) and the systems i am trying to set up are missing. Am i missing something? Thank you.
« Last Edit: November 18, 2014, 02:13:57 AM by Lcu »
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1907 on: November 18, 2014, 02:42:12 AM »

Yeah,

You'll need to have a line in your BaseModPlugin file

something like:

Code: java
public class My_modPlugin extends BaseModPlugin {

    @Override
    public void onNewGame() {
        initMyFaction();
}

    private static void initMyFaction() {
        try {
            Global.getSettings().getScriptClassLoader().loadClass("data.scripts.world.ExerelinGen");
            //Got Exerelin, so just Exerelin
        } catch (ClassNotFoundException ex) {
            new MyFaction_gen().generate(Global.getSector());
        }
    }

}


Then in your mod_info.json file ensure you have the following:
Code
  "modPlugin":"data.scripts.My_modPlugin",


So what's happening is

Game engine -> mod_info.json -> modPlugin element (telling it where the modPlugin file is)

modPlugin on New Game -> Init faction -> Sector Generator Plugin --> System File

Not exactly straight forward is it?
Logged

Lcu

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

Actually it seems straightforward to me, but i just don't know which files to fiddle with.
Thank you very much!
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

Runoved

  • Lieutenant
  • **
  • Posts: 62
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1909 on: November 21, 2014, 10:04:25 AM »

I apologize in advance if the answer to my question was already in this thread.
Why in the files of many mods is a file BaseSpawnPoint.java? Usually it is in the directory "\data\scripts\world".
How it affects the appearance of the faction fleets in the latest version of the game (0.65.1)?
Do the old methods of creating fleets through Spawn Points files works or now they depend only on the properties of the markets?
Thanks in advance for your answers.
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1910 on: November 21, 2014, 11:56:26 AM »

Forget all about the base spawn point, just let market auto generation do its thing. Otherwise the fleet factory in the API is another place to look,  or extending / implementing your own fleet factory.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1911 on: November 21, 2014, 11:42:51 PM »

Is there any way to check and see all of the possible actions (scripts) you can do in rules.csv? Alex listed "Etc" in the documentation, so I was wondering if there was an easy way to check and see all of the options.
Logged

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1912 on: November 22, 2014, 06:33:42 AM »

So i managed to generate a star system. I defined the location in the .java file for the star system, but when i changed it, it still stays on the same location in a new game. Why can't it change the positions?

(Tested with .jars as well, didn't work as well).
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1913 on: November 22, 2014, 06:37:39 AM »

Do you have a starmap.json in your campaign folder? Maybe that is overriding it?

I cannot immediately think of any other reason...usually it just works. Can you paste your system gen on paste bin? or paste it here. But be sure to use the code=java tag if you do paste it here, helps format it.
Logged

Runoved

  • Lieutenant
  • **
  • Posts: 62
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1914 on: November 22, 2014, 12:04:42 PM »

Thank you for your answer to my previous question. Sorry for so many questions. Here are some more:
How market properties affect to the fact how often and what fraction fleets appear? Is the number of appearing fleets depends on how the market is filled? Or certain market conditions affect the composition of the fleet? In the end, what are the conditions for planet I have to give to round it was a lot of fleets of certain fraction?
Thanks in advance for your answers.
Logged

Arumac

  • Lieutenant
  • **
  • Posts: 98
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1915 on: November 26, 2014, 05:08:01 PM »

Hi all, Im making an onhit script for a projectile. Basically, I want it to deal additional damage. I had it working well for awhile, until I realized that it was still dealing the same amount of damage across the board vs shields, armor, AND fortress shields. So I figured I could do something like a target.getShieldAbsorptionMult() to not have it basically ignore defenses. However I figured it wouldn't work, and it doesn't. I'm not aware of any way to modify damage dealt based on a target's shield defense and armor defense.
Logged

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1916 on: November 28, 2014, 02:08:54 AM »

Looking into the starfarer api, and i found :
com.fs.starfarer.api.impl.campaign.fleets.FleetFactory

Looks like a great way to add custom fleets,
Also does classes in the .impl package need to be implemented?

EDIT : Nevermind, already tried it myself and it worked.
« Last Edit: November 28, 2014, 04:15:42 AM by Lcu »
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

TrashMan

  • Admiral
  • *****
  • Posts: 1329
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1917 on: November 29, 2014, 02:51:48 AM »

Stupid question - where the hell are systems/planets defined?
Logged

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1918 on: November 29, 2014, 03:13:48 AM »

Stupid question - where the hell are systems/planets defined?
In data/scripts/world. These scripts are the ones that define the systems.

Now my question :
In the ship_data.csv there are 3 new values, c, c/fp, and c/l.
What does these do?
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 #1919 on: November 29, 2014, 03:32:58 AM »

Stupid question - where the hell are systems/planets defined?
data/config/planet.json for the planets

Now my question :
In the ship_data.csv there are 3 new values, c, c/fp, and c/l.
What does these do?
Nothing. Like the 8/6/5/4% column they are derived data that Alex use for balancing (and are automatically calculated with his tools).

Mine  now:
I'm trying to create custom shields using
ship.getShield().setRadius(200, "ART_innerShield", "ART_outerShield");

the API says:
Code
setRadius

void setRadius(float radius,
               java.lang.String textureInner,
               java.lang.String textureRing)

    Textures should be already loaded (i.e. via settings.json).
So I created this in my settings:
   "graphics":{   
      "shields":{
         "ART_outerShield":"graphics/SCY/vectorCruiser/ART_outerShield.png",
         "ART_innerShield":"graphics/SCY/vectorCruiser/ART_innerShield.png",
      },
         },

But I keep getting NPE because the game can't find the texture...
« Last Edit: November 29, 2014, 03:45:54 AM by Tartiflette »
Logged
 
Pages: 1 ... 126 127 [128] 129 130 ... 752