Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Modding help  (Read 2441 times)

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Modding help
« on: October 24, 2014, 12:10:45 AM »

Now with the economy in the 0.65 update, i assume that adding star systems and factions to the game are way more difficult.
Has anyone made a tutorial on this? If so, please give me a link.
Thanks.
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Modding help
« Reply #1 on: October 24, 2014, 02:01:46 AM »

You'll know when we know  ???
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Modding help
« Reply #2 on: October 24, 2014, 02:16:44 AM »

Without even beginning to dive into the java side, here is a rough overview of some of the more significant changes you need to be aware of for the campaign.

Spoiler
[close]
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Modding help
« Reply #3 on: October 24, 2014, 02:20:39 AM »

> i assume that adding star systems and factions to the game are way more difficult.

Its more or less the same, what really changed was the addition of a economy and markets that need to be setup with the new systems. Those however are also simple enough, but right now, due to a few problems on the current 0.65 version that are being fix on the next hotfix, we wont be able to help much.

Once their fixed, a few mods will immediately jump into 0.65.2a and u'll be able to see the how-to
Logged

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Modding help
« Reply #4 on: October 24, 2014, 04:16:34 AM »

Okay, thanks for the information guys!
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Modding help
« Reply #5 on: October 26, 2014, 12:53:51 AM »

FYI: Here is a method creating an economy with compiled code:

Code: java

    private void addMarketplace(String factionID, SectorEntityToken primaryEntity, ArrayList<SectorEntityToken> connectedEntities, String name, int size, ArrayList<String> marketConditions, ArrayList<String> submarkets, float tarrif) {
        EconomyAPI globalEconomy = Global.getSector().getEconomy();

        String planetID = primaryEntity.getId();
       
        //generate the market ID
        String marketID = planetID + "_market";
       
        //generate the market
        MarketAPI newMarket = Global.getFactory().createMarket(marketID, name, size);
       
        //set the faction associated with the market
        newMarket.setFactionId(factionID);
       
        //set the primary entity related to the market
        newMarket.setPrimaryEntity(primaryEntity);
       
        //set the base smuggling value (starting value)
        newMarket.setBaseSmugglingStabilityValue(0);
       
        //set the starting tarrif, could also make this value an input
        newMarket.getTariff().modifyFlat("generator", tarrif);
       
        //add each sub-market types to the mark
        if (null != submarkets){
            for (String market: submarkets){
                newMarket.addSubmarket(market);
            }
        }
       
        //add each market conditions
        for (String condition : marketConditions) {
            newMarket.addCondition(condition);
        }
       
        //add all connected entities to this marketplace, moons/stations etc.
        if (null != connectedEntities) {
            for (SectorEntityToken entity : connectedEntities) {
                newMarket.getConnectedEntities().add(entity);
            }
        }
       
        //add the market to the global market place
        globalEconomy.addMarket(newMarket);
       
        //get the primary entity and associate it back to the market that we've created
        primaryEntity.setMarket(newMarket);
       
        //get all associated entities and associate it back to the market we've created
        if (null != connectedEntities) {
            for (SectorEntityToken entity : connectedEntities) {
                entity.setMarket(newMarket);
            }
        }
    }


here is usage of this method:

Code: java
        PlanetAPI rocky2 = system.addPlanet("uaf_shizuka", star, "Shizuka", "rocky_unstable", 175, 60, 3432, 125);
        PlanetAPI rocky2moon1 = system.addPlanet("uaf_shizuka_kai", rocky2, "Shizuka Kai", "rocky_metallic", 305, 10, 100, 3);

        addMarketplace("uaf_d", //faction ID
                rocky2, //primary entity
                new ArrayList<>(Arrays.asList((SectorEntityToken) rocky2moon1)), //list of associated entities
                "Ryoko Mining Facility", //name of the market
                3, //market size
                new ArrayList<>(Arrays.asList(Conditions.ARID, Conditions.ORE_COMPLEX, Conditions.OUTPOST, Conditions.FRONTIER, Conditions.STEALTH_MINEFIELDS, Conditions.POPULATION_3)), //market conditions
                new ArrayList<>(Arrays.asList(Submarkets.SUBMARKET_STORAGE, Submarkets.SUBMARKET_BLACK, Submarkets.SUBMARKET_OPEN)), //submarkets
                0.3f //tarrif
        );
Logged

Lcu

  • Commander
  • ***
  • Posts: 213
    • View Profile
Re: Modding help
« Reply #6 on: October 26, 2014, 12:58:31 AM »

What about faction creation? Has it changed?
Logged
Spoiler
66766766
66766766
66666766
66766766
66766766
Ctrl+F, type 6
[close]