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 ... 13 14 [15] 16 17 ... 706

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

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #210 on: January 30, 2013, 07:39:48 AM »

I also did, as you can see it extends that class. The issue was that I had package data.scripts.world and it was in data\scripts\world, but didn't run. Changing it to package data.scripts.plugins and putting it in data\scripts\plugins however made it run.

This is because data/scripts/plugins is a special folder. All scripts in this folder that implement a plugin will be automatically added to the game, and for all plugins except combat plugins (which can be added via mission definitions) this is the only way to activate them.
I figured it was something along those lines, but had to learn it the hard way xD. Thanks for the clarification, might help avoid similar issues in the future.
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #211 on: January 30, 2013, 07:41:49 AM »

How do you mod the starting player fleet? And the various explanations for each variable inside it.

Been a while....
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #212 on: January 30, 2013, 08:04:13 AM »

How do you mod the starting player fleet? And the various explanations for each variable inside it.

Been a while....
To be more clear, is it just the fleet you want to modify (add ships, resources, weapons, etc.) or modify/add the starting options?

I think (haven't tried) you can type this in your generator, if you just want to add extra stuff:
Code
        CargoAPI cargo = Global.getSector().getPlayerFleet().getCargo();
        cargo.addItems(CargoAPI.CargoItemType.RESOURCES, "supplies", 20);
        cargo.addMothballedShip(FleetMemberType.SHIP, "ID", null);
        cargo.addWeapons("id", 3);
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #213 on: January 30, 2013, 08:09:24 AM »

Starting options :),

Like how, before the last update, you would just do it in the data/world/factions/player.faction file
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #214 on: January 30, 2013, 09:15:51 AM »

Starting options :),

Like how, before the last update, you would just do it in the data/world/factions/player.faction file

Okay, I'll try and break down my working example, although it doesn't do everything you can do and might not be implemented in an optimal way (but it works).

Code
package data.scripts.plugins;

import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import java.util.ArrayList;
import java.util.List;

public class IndustryCharacterCreation extends data.scripts.plugins.CharacterCreationPluginImpl {
    // Not using an enum for this because Janino doesn't support it.
    // It does, apparently, support using enums defined elsewhere - just can't compile new ones.

The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

Code
    private ResponseImpl OPTION1 = new ResponseImpl("option 1 text");
    private ResponseImpl OPTION2 = new ResponseImpl("option 2 text");
    private int stage = 0;
    private boolean isEntr = false;

Here we set up the fields we will use. ResponseImpl is from the class that we extended and if you implemented the interface then you would have to make your own (could just copy-paste it from the extended class). They are the ones that the player can choose from, though we will have to specify when they are shown in getResponses(). Aside from that we have stage as the one in the extended class is private and then a boolean as I only wanted to show the second response if the first was selected.

Code
    @SuppressWarnings("unchecked")
    @Override
    public List getResponses() {
        List result = new ArrayList();
        
        if (stage == 0) {
            result.add(OPTION1);
        } else if (stage == 1) {
            if (isEntr) {
                result.add(OPTION2);
            }
        }
        result.addAll(super.getResponses());
        return result;
    }

Before talking about this code, I want to mention that there is a method before it called getPrompt(). You will only need to override it if you need to change the amount of times the player selects a response. There is also a field called prompts that you can override if you want to change the text above options (the one asking the "questions") or change the amount of times the player selects a response.

About the code itself. The repsonses the player selects from is based of a list. This method, getResponses(), is where we create that list. We start by creating the list and then check what stage we are in. If we're in the second stage (stage == 1) then we also check if the previous choice was our first option through our field isEntr. After this we call the same method from our extended class and put the responses in the list that it returns in our list. Finally we return our list.

Code
    @Override
    public void submit(CharacterCreationPlugin.Response response, CharacterCreationPlugin.CharacterCreationData data) {
        super.submit(response, data);
        
        stage++;
        MutableCharacterStatsAPI stats = data.getPerson().getStats();

        if (response == OPTION1) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.getStartingCargo().getCredits().add(2000);
            isEntr = true;
        }
        if (response == OPTION2) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.addStartingShipChoice("buffalo_Standard");
            data.getStartingCargo().getCredits().add(2000f);
        }

    }

The next method is submit(). This method is called after a response is selected. We start with calling the same method from the extended class, in case that one of ours wasn't selected. Afterwards we increment stage by 1 and create a variable to access player stats so we won't have to type the whole thing again. Then using an if for each possible repsonse we dertermine which response was selected and do the stuff we want to if it was one of ours. To see how to increase a specific skill or apptitude look at the extended class.

Code
    @Override
    public void startingShipPicked(String variantId, CharacterCreationPlugin.CharacterCreationData data) {
        if (variantId.equals("buffalo_Standard")) {
            data.getStartingCargo().addFuel(20);
            data.getStartingCargo().addSupplies(20);
            data.getStartingCargo().addItems(CargoAPI.CargoItemType.RESOURCES, "omncompl_uncmaterial", 200);
            data.getStartingCargo().addCrew(CrewXPLevel.GREEN, 10);
            data.getStartingCargo().addMarines(2);
            return;
        }
        super.startingShipPicked(variantId, data);
    }
}

b]getPrompt()[/b] will return null once stage exceeds the amount of prompts availaible. Once that happens, the player will be given a selection of ships to pick from based of the data.addStartingShipChoice(String Variantid) method. When a ship is selected, this method will be called. We have access to the same amount of information as in submit() and can thus do the same amount of things. In this case, I just add the starting resources including one from my mod. I added a return; in the if and only call the extended class method at the end, because it has an option if none of the ships it expected was picked and will add extra resources to our ship, which we are not interested in.

The end.
« Last Edit: January 30, 2013, 09:27:00 AM by gruntmaster1 »
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #215 on: January 30, 2013, 09:18:16 AM »

Since when is it this complicated :O
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #216 on: January 30, 2013, 09:18:49 AM »

Full code of my implemention:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import java.util.ArrayList;
import java.util.List;

public class IndustryCharacterCreation extends data.scripts.plugins.CharacterCreationPluginImpl {
    // Not using an enum for this because Janino doesn't support it.
    // It does, apparently, support using enums defined elsewhere - just can't compile new ones.

    private ResponseImpl OPTION1 = new ResponseImpl("You started a company which became sucessful...");
    private ResponseImpl OPTION2 = new ResponseImpl("... and lost it all to pirates.");
    private int stage = 0;
    private boolean isEntr = false;

    @SuppressWarnings("unchecked")
    @Override
    public List getResponses() {
        List result = new ArrayList();
        
        if (stage == 0) {
            result.add(OPTION1);
        } else if (stage == 1) {
            if (isEntr) {
                result.add(OPTION2);
            }
        }
        result.addAll(super.getResponses());
        return result;
    }

    @Override
    public void submit(CharacterCreationPlugin.Response response, CharacterCreationPlugin.CharacterCreationData data) {
        super.submit(response, data);
        
        stage++;
        MutableCharacterStatsAPI stats = data.getPerson().getStats();

        if (response == OPTION1) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.getStartingCargo().getCredits().add(2000);
            isEntr = true;
        }
        if (response == OPTION2) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.addStartingShipChoice("buffalo_Standard");
            data.getStartingCargo().getCredits().add(2000f);
        }

    }

    @Override
    public void startingShipPicked(String variantId, CharacterCreationPlugin.CharacterCreationData data) {
        if (variantId.equals("buffalo_Standard")) {
            data.getStartingCargo().addFuel(20);
            data.getStartingCargo().addSupplies(20);
            data.getStartingCargo().addItems(CargoAPI.CargoItemType.RESOURCES, "omncompl_uncmaterial", 200);
            data.getStartingCargo().addCrew(CrewXPLevel.GREEN, 10);
            data.getStartingCargo().addMarines(2);
            return;
        }
        super.startingShipPicked(variantId, data);
    }
}

Full code of the extended class:
Code
package data.scripts.plugins;

import java.util.ArrayList;
import java.util.List;

import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;

public class CharacterCreationPluginImpl implements CharacterCreationPlugin {

public static class ResponseImpl implements Response {
private String text;
public ResponseImpl(String text) {
this.text = text;
}
public String getText() {
return text;
}
}

// Not using an enum for this because Janino doesn't support it.
// It does, apparently, support using enums defined elsewhere - just can't compile new ones.
private ResponseImpl SUPPLY_OFFICER = new ResponseImpl("Served as a junior supply officer in an independent system's navy");
private ResponseImpl GUNNER = new ResponseImpl("Hired out as a gunner on a mercenary ship");
private ResponseImpl ENGINEER = new ResponseImpl("Found employment as an assistant engineer on an exploration vessel");
private ResponseImpl COPILOT = new ResponseImpl("Spent time as a co-pilot on a patrol ship in an independent system");
private ResponseImpl SOMETHING_ELSE_1 = new ResponseImpl("Did something else");
private ResponseImpl ADJUTANT = new ResponseImpl("Served as an adjutant in the Hegemony Navy");
private ResponseImpl QUARTERMASTER = new ResponseImpl("Performed the duties of a quartermaster on an independent warship");
private ResponseImpl HELM = new ResponseImpl("Helmed a patrol ship operating in a backwater system");
private ResponseImpl COMBAT_ENGINEER = new ResponseImpl("Took over the duties of chief combat engineer during a lengthy campaign");
private ResponseImpl SOMETHING_ELSE_2 = new ResponseImpl("Did something else");

private int stage = 0;
private String [] prompts = new String [] {
"Early in your career, you...",
"More recently, you...",
};

public String getPrompt() {
if (stage < prompts.length) return prompts[stage];
return null;
}

@SuppressWarnings("unchecked")
public List getResponses() {
List result = new ArrayList();
if (stage == 0) {
result.add(SUPPLY_OFFICER);
result.add(GUNNER);
result.add(ENGINEER);
result.add(COPILOT);
result.add(SOMETHING_ELSE_1);
} else if (stage == 1) {
result.add(ADJUTANT);
result.add(QUARTERMASTER);
result.add(HELM);
result.add(COMBAT_ENGINEER);
result.add(SOMETHING_ELSE_2);
}
return result;
}


public void submit(Response response, CharacterCreationData data) {
if (stage == 0) { // just in case
data.addStartingShipChoice("shuttle_Attack");
}

stage++;

MutableCharacterStatsAPI stats = data.getPerson().getStats();
if (response == SUPPLY_OFFICER) {
stats.increaseAptitude("leadership");
stats.increaseSkill("fleet_logistics");
stats.increaseSkill("command_experience");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == GUNNER) {
stats.increaseAptitude("combat");
stats.increaseSkill("ordnance_expert");
stats.increaseSkill("target_analysis");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == ENGINEER) {
stats.increaseAptitude("technology");
stats.increaseSkill("field_repairs");
stats.increaseSkill("mechanical_engineering");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == COPILOT) {
stats.increaseAptitude("combat");
stats.increaseSkill("helmsmanship");
stats.increaseSkill("evasive_action");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == SOMETHING_ELSE_1) {
stats.addAptitudePoints(1);
stats.addSkillPoints(2);
data.getStartingCargo().getCredits().add(1000f);
}

else if (response == ADJUTANT) {
stats.increaseAptitude("leadership");
stats.increaseSkill("fleet_logistics");
stats.increaseSkill("advanced_tactics");
data.addStartingShipChoice("lasher_Standard");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == QUARTERMASTER) {
stats.increaseAptitude("technology");
stats.increaseSkill("navigation");
stats.addSkillPoints(1);
data.addStartingShipChoice("wolf_CS");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == HELM) {
stats.increaseAptitude("combat");
stats.increaseSkill("helmsmanship");
stats.increaseSkill("evasive_action");
data.addStartingShipChoice("vigilance_Standard");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == COMBAT_ENGINEER) {
stats.increaseAptitude("combat");
stats.increaseSkill("damage_control");
stats.increaseSkill("flux_modulation");
data.addStartingShipChoice("lasher_Standard");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == SOMETHING_ELSE_2) {
stats.addAptitudePoints(1);
stats.addSkillPoints(2);
data.addStartingShipChoice("hound_Assault");
data.getStartingCargo().getCredits().add(1000f);
}
}

public void startingShipPicked(String variantId, CharacterCreationData data) {
MutableCharacterStatsAPI stats = data.getPerson().getStats();
stats.addAptitudePoints(1);
stats.addSkillPoints(2);

if (variantId.equals("vigilance_Standard")) {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(30);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 20);
data.getStartingCargo().addMarines(5);
} else
if (variantId.equals("lasher_Standard")) {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(20);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 40);
data.getStartingCargo().addMarines(10);
} else
if (variantId.equals("wolf_CS")) {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(20);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 22);
data.getStartingCargo().addMarines(7);
} else
if (variantId.equals("shuttle_Attack")) {
data.getStartingCargo().addFuel(10);
data.getStartingCargo().addSupplies(10);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 10);
data.getStartingCargo().addMarines(3);
} else
if (variantId.equals("hound_Assault")) {
data.getStartingCargo().addFuel(30);
data.getStartingCargo().addSupplies(40);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 25);
data.getStartingCargo().addMarines(15);
} else {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(20);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 20);
data.getStartingCargo().addMarines(10);
}
}
}
Logged

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #217 on: January 30, 2013, 09:22:16 AM »

Since when is it this complicated :O

0.54  :P
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #218 on: January 30, 2013, 09:26:09 AM »

The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.
Logged

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #219 on: January 30, 2013, 09:30:35 AM »

The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.
Thank you for the clarification. That kinda blows :/
Do you know if character creation is called before the generators?
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #220 on: January 30, 2013, 09:33:54 AM »

The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.
Thank you for the clarification. That kinda blows :/
Do you know if character creation is called before the generators?

I'm fairly certain it is. I remember running into an issue implementing CAELUS's character creation plugin because of the run order, at least. :)
Logged

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #221 on: January 31, 2013, 06:06:08 AM »

Been trying to use the sounds.json to modify ship system sounds based on hullsize, like what is done with engine sounds and whatnot in the core game. Seems like the game refuses to run though, no matter how I format it, using the examples provided in the core json. Is this even supported right now?
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #222 on: January 31, 2013, 06:11:58 AM »

I'm not sure, but you could try manually playing the correct sounds in the system script using Global.getSoundPlayer() (you can check if a system is turning on, active, or turning off in the script, so AFAIK you should be able to replicate the sound settings in the .system file).
Logged

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #223 on: February 04, 2013, 05:50:24 AM »

Solved: Thanks to Alex for the help. The problem was caused by NetBeans including old and deleted files in the .jar. To solve this I used the Clean option and it then build the proper .jar.

Okay, I am having a really weird bug. I am not sure if I am missing something obvious or it is a bug with the game. I have tried to implement my first skill which enable you to produce more weapons and ships. The limit is calculated by passing the level to a class, called ProdInfo, when you initialize it and then you can use two methods for getting the description information. This is were things start to get weird.

The class ProdInfo is in my .jar while while the skill related files are in my mod. I first only had one method to return the string called getString(). This worked fine. I then made it to two methods, getStringTotal and getStringLevel. This resoulted in an error saying that it couldn't find method (can't remember if it specified a name). I then tried to make a getString() method returning "ProdInfo". This was now shown in the skills description. Now whatever I tell the skill to return as string, it won't show anything but "ProdInfo". I even tried to tell it to just: return "Total"; and return "Level"; directly, but it would still only show "ProdInfo".

ProdInfo was initially an inner class, but I then made it an outer class to see if that helped. All of this was tested in character creation.
Any ideas?

Edit: I tried removing the omncompl_RepairComplexEffect.java file which didn't resoult in an error. This would indicate a dublicate of sorts, but I can't find one, even when searching the whole starsector folder.

Skill effect:
Code
package data.characters.skills.scripts;

import com.fs.starfarer.api.characters.CharacterStatsSkillEffect;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import data.scripts.world.ProdInfo;

public class omncompl_RepairComplexEffect implements CharacterStatsSkillEffect
{
  
    @Override
    public void apply(MutableCharacterStatsAPI stats, String id, float level)
    {
    }

    
    @Override
    public void unapply(MutableCharacterStatsAPI stats, String id)
    {
        
    }


    @Override
    public String getEffectDescription(float level)
    {
        //ProdInfo pro = new ProdInfo((int)level);
        return "Total";
    }

  
    @Override
    public String getEffectPerLevelDescription()
    {
        //ProdInfo pro = new ProdInfo(0);
        return "Level";
    }

  
    @Override
    public ScopeDescription getScopeDescription()
    {
        return ScopeDescription.ALL_OUTPOSTS;
    }
}

ProdInfo:
Code
package data.scripts.world;

import java.util.ArrayList;

public final class ProdInfo {
    ArrayList<Integer> wepAmount = new ArrayList<Integer>();
    ArrayList<Integer> shipAmount = new ArrayList<Integer>();

    public ProdInfo(int level) {
        wepAmount.add(2 * level + 2);
        wepAmount.add(1 * level + 1);
        wepAmount.add(1 * level + 1);
        wepAmount.add((int) Math.floor(0.5 * level));
        shipAmount.add((int) Math.floor(1.5 * level) + 1);
        shipAmount.add(1 * level + 1);
        shipAmount.add((int) Math.floor(2D / 3D * level));
        shipAmount.add((int) Math.floor(0.5 * level));
        shipAmount.add((int) Math.floor(2D / 7D * level));
    }

    public ProdInfo() {
        wepAmount.add(0);
        wepAmount.add(0);
        wepAmount.add(0);
        wepAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
    }

    public String getTotal() {
        return "Weapons:" + w(0) + w(1) + w(3) + ", ships:" + s(0) + s(1) + s(2) + s(3) + s(4);
    }

    public String getLevel() {
        return "Weapons: + 2 + 1 + 1/2, ships: + 1 1/2 + 1 + 2/3 + 1/2 + 2/7";
    }

    public String getString() {
        if (true) {
            return getLevel();
        }
        else {
            return getTotal();        
        }
    }

    public String w(int size) {
        return " + " + wepAmount.get(size);
    }

    public String s(int size) {
        return " + " + shipAmount.get(size);
    }
    
    
}
« Last Edit: February 05, 2013, 10:21:17 AM by gruntmaster1 »
Logged

gruntmaster1

  • Ensign
  • *
  • Posts: 31
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #224 on: February 05, 2013, 02:20:54 PM »

The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.

A correction to this. I just accidently started Uomoz's Corvus 17 with my Frieghter Start mod and it worked. I am not sure if it is a coincidence, due to Uomoz's having the same name as the original file in starsector-core and thus overwriting it, and mine inherits from it (so it ends up inheriting Uomoz's?).
Logged
Pages: 1 ... 13 14 [15] 16 17 ... 706