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: Codex Overhaul (05/11/24)

Pages: 1 ... 61 62 [63] 64 65 ... 717

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

Vayra

  • Admiral
  • *****
  • Posts: 627
  • jangala delenda est
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #930 on: October 03, 2013, 02:17:41 PM »

Took a quick look; I'm not sure there's anything necessarily wrong, though I could easily have missed some duplication. A save is naturally going to get larger compared to its size on startup as ships get damaged and more fleets spawn, the question is, does it continue to grow, or does it top out at a certain point? If you simply have 50mb worth of stuff, I'd suggest turning on save file compression. Should reduce file size by a factor of 20, and improve the save/load times a good deal.

(I'll have to deal with this at some point, ofc, as the vanilla Sector grows larger. Regardless of other measures, pretty sure that save compression will be on by default in some future release.)

Thank you! That's a load off my mind, then. I'll do what optimization I can and stop worrying about it so much.

Man it takes FOREVER to make an original sprite and get it into the game, I have a LOT more respect for you modders now, whew.

I suppose my question is how do you spriters usually star out with fresh art? I tried starting big, like 1000 pixels high, and then shrinking to 100 pixels for a frigate, but of course it really dilutes the image and makes it looks quite childish. Do you guys usually start at the pixel size you want?

Getting a detailed model into 100 pixels is incredible, the artists for this game and the mods have some genuine talent.

I believe most people who make sprites from scratch draw them at 10x or 4x eventual scale and then shrink them at do detail work, cleanup, etc. at actual final scale, yes. :)

I don't know if you've read it already or not, but this thread has a lot of good info: http://fractalsoftworks.com/forum/index.php?topic=3342.0
Logged
Kadur Remnant: http://fractalsoftworks.com/forum/index.php?topic=6649
Vayra's Sector: http://fractalsoftworks.com/forum/index.php?topic=16058
Vayra's Ship Pack: http://fractalsoftworks.com/forum/index.php?topic=16059

im gonna push jangala into the sun i swear to god im gonna do it

Turdicus

  • Ensign
  • *
  • Posts: 33
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #931 on: October 03, 2013, 02:23:43 PM »

Yeah that thread has been a godsend, among many other useful portions of this forum, and quite a few posts by you too, Vayra. I've taken it upon myself to make a decent ship, and with almost zero experience spriting I've managed to get myself to make a basic frigate sprite in under four hours =P One day I'll make something worth putting up for you guys to see, I hope.
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #932 on: October 04, 2013, 10:09:12 AM »

So I have this 'ere script that spawns Nexus ships randomly in Corvus.
Code
package data.scripts.world;

import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorGeneratorPlugin;
import com.fs.starfarer.api.campaign.StarSystemAPI;

public class NexusGen implements SectorGeneratorPlugin{

public void generate( SectorAPI sector ){
StarSystemAPI system = sector.getStarSystem( "Corvus" );

NexusSpawnPoint nexusSpawn1 = new NexusSpawnPoint(sector, system, 14, 100,
system.getEntityByName("star"),"nexus","nexus1");
system.addSpawnPoint(nexusSpawn1);
for( int i = 0; i < 2; i++ ) nexusSpawn1.spawnFleet();

NexusSpawnPoint nexusSpawn2 = new NexusSpawnPoint(sector, system, 28, 100,
system.getEntityByName("star"),"nexus","nexus3");
system.addSpawnPoint(nexusSpawn2);
for( int i = 0; i < 1; i++ ) nexusSpawn2.spawnFleet();
        }
}

But I'd like to spawn these guys in Hyperspace. Is that possible? If so, can someone explain how?
Does the Hyperspace have a 'system' name like a regular system? (I've been looking in the api file, but could not locate it.)
Logged
  

Magician

  • Commander
  • ***
  • Posts: 156
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #933 on: October 04, 2013, 06:07:59 PM »

I found this thread http://fractalsoftworks.com/forum/index.php?topic=6519.0 which states that it is possible to change hull sprites, including boundaries, during combat, if weapon mounts stay untouched.
Now my question is if it is possible to create visual effect as if old hull slowly transforms into new. I can only think of animated sprite with one-time playback. And to transform back in same manner, it will require to use another animated hull sprite only to show reverse transformation; and after that default static hull sprite will be finally used.
Along with question if its possible at all, I am also interested to know if such extensive use of animation will strain game alot. I read somewhere that it is recommended to use small and simple animations, because game will not handle bigger ones. But this was aimed to animations which are used in normal hulls - thus always visible and active. So if animation is only used during activation of shipsystem and after that used normal static hull sprite, does it affect game performance alot?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24329
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #934 on: October 05, 2013, 05:11:24 PM »

But I'd like to spawn these guys in Hyperspace. Is that possible? If so, can someone explain how?
Does the Hyperspace have a 'system' name like a regular system? (I've been looking in the api file, but could not locate it.)

Use:
LocationAPI hyperspace = sector.getHyperspace()

I found this thread http://fractalsoftworks.com/forum/index.php?topic=6519.0 which states that it is possible to change hull sprites, including boundaries, during combat, if weapon mounts stay untouched.
Now my question is if it is possible to create visual effect as if old hull slowly transforms into new. I can only think of animated sprite with one-time playback. And to transform back in same manner, it will require to use another animated hull sprite only to show reverse transformation; and after that default static hull sprite will be finally used.
Along with question if its possible at all, I am also interested to know if such extensive use of animation will strain game alot. I read somewhere that it is recommended to use small and simple animations, because game will not handle bigger ones. But this was aimed to animations which are used in normal hulls - thus always visible and active. So if animation is only used during activation of shipsystem and after that used normal static hull sprite, does it affect game performance alot?

It'll eat a lot of memory just to keep all the sprites loaded, so a long animation for a large ship would probably be a bad idea. Frame-rate-wise the game won't care one bit.
Logged

Xalendi

  • Commander
  • ***
  • Posts: 198
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #935 on: October 05, 2013, 05:38:53 PM »

If I made a starbase with its own defence fleet that could be attacked, by basically making a ship with no move speed, how could I prevent it from ever getting boarded? I don't particularly want players to be playing with the starbases.
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #936 on: October 06, 2013, 12:18:30 AM »

halp its broken!!!
https://www.dropbox.com/s/tdc7jzbx80aqlju/Biso%20broken.7z
I think...   ???

I cant get my mothballed ships to show up in the corvus Corporate HQ,
based it off vayra's tutorial for the halcyon carier

spawnpoint code
Spoiler
Code
// the "package" is the folder it's in, pretty self-explanatory
package data.scripts.world;

// you have to import anything that's not in the package that you want to use
// we need a lot of stuff to spawn a supply fleet and add ships to it
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.fleet.FleetMemberAPI;
import com.fs.starfarer.api.fleet.FleetMemberType;
import data.scripts.world.BaseSpawnPoint;

// btw, i copied this almost entirely from the existing scripts in the vanilla game and then tweaked it until it served my purposes
// this is essentially how i do everything, and unless you're a coding god it is what i would reccommend doing yourself

@SuppressWarnings("unchecked")
public class BISOSpawnPoint extends BaseSpawnPoint {

// basic setup stuff, initialize a convoyDestination variable
private final SectorEntityToken convoyDestination;

// ...and the class for the whole script
public BISOSpawnPoint(SectorAPI sector, LocationAPI location,
float daysInterval, int maxFleets, SectorEntityToken anchor,
SectorEntityToken convoyDestination) {
super(sector, location, daysInterval, maxFleets, anchor);
this.convoyDestination = convoyDestination;
}

@Override
protected CampaignFleetAPI spawnFleet() {
// first things first, create a tritachyon supply fleet
// the faction has to line up with a faction that exists, and the fleet has to line up with a fleet that exists for that faction
// so if you wanted to change that to "Advent" and "Halcyon Carrier Delivery Fleet" or w/e you'd need to first create an Advent
// faction file and a halcyon carrier delivery fleet entry within it
CampaignFleetAPI fleet = getSector().createFleet("tritachyon", "supplyfleet");
// then we spawn the fleet we just created
getLocation().spawnFleet(getAnchor(), 0, 0, fleet);

// addShips is a function that we'll define later in this file
// it's what we're going to use to add the Halcyon Carrier to a tri-tachyon supply fleet
// (which obviously doesn't contain one by default)
addShips(fleet);

// we're also going to add enough crew and supplies to the fleet for it to be able to field the halcyon, heh
CargoAPI cargo = fleet.getCargo();
cargo.addCrew(CrewXPLevel.VETERAN, 4000);
cargo.addSupplies(5000);

// createDockedScripts is a function that we'll define later in this file
// we're going to use it to display a message when the supply fleet docks with the station
Script dockScript = null;
dockScript = createDockedScript(fleet);

// we're also going to tell the fleet what to do so it doesn't just wander around lost
fleet.addAssignment(FleetAssignment.DELIVER_RESOURCES, convoyDestination, 1000, dockScript);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);

return fleet;
}

private Script createDockedScript(final CampaignFleetAPI fleet) {
return new Script() {
public void run() {
if (fleet.isInCurrentLocation()) {
Global.getSector().addMessage("The Tri-Tachyon long distance tech trading expedition has docked");
// this is pretty self-explanatory, if the player's fleet is in Corvus when the halcyon supply fleet docks it displays a message
}
}
};
}

private void addShips(CampaignFleetAPI fleet) {
for (int i = 0; i < 4; i++) { // this line is a fancy way of saying "do the following 4 times"
FleetMemberAPI wasp = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "wasp_wing");
fleet.getFleetData().addFleetMember(wasp);
// so we just added 4 Wasp wings to the fleet (to escort the Halcyon, since it IS a carrier)
}
for (int i = 0; i < 2; i++) { // this line is a fancy way of saying "do the following 2 times"
FleetMemberAPI xyphos = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "xyphos_wing");
fleet.getFleetData().addFleetMember(xyphos);
// so we just added 2 Xyphos wings to the fleet (to escort the Halcyon, since it IS a carrier)
}
FleetMemberAPI activeC1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "C1_S");
fleet.getFleetData().addFleetMember(activeC1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedC1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "C1_S");
fleet.getFleetData().addFleetMember(mothballedC1);
mothballedC1.getRepairTracker().setMothballed(true);
// and last but not least, one mothballed Halcyon to be dropped off at the station! :)

FleetMemberAPI activeB1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "B1_S");
fleet.getFleetData().addFleetMember(activeB1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedB1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "B1_S");
fleet.getFleetData().addFleetMember(mothballedB1);
mothballedB1.getRepairTracker().setMothballed(true);

FleetMemberAPI activeD1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "D1_S");
fleet.getFleetData().addFleetMember(activeD1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedD1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "D1_S");
fleet.getFleetData().addFleetMember(mothballedD1);
mothballedD1.getRepairTracker().setMothballed(true);

FleetMemberAPI activeR1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RB1_S");
fleet.getFleetData().addFleetMember(activeR1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedRB1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RB1_S");
fleet.getFleetData().addFleetMember(mothballedRB1);
mothballedRB1.getRepairTracker().setMothballed(true);

FleetMemberAPI mothballedRB2 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RB2");
fleet.getFleetData().addFleetMember(mothballedRB2);
mothballedRB2.getRepairTracker().setMothballed(true);

FleetMemberAPI mothballedX1 = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "X1_variant_wing");
fleet.getFleetData().addFleetMember(mothballedX1);
mothballedX1.getRepairTracker().setMothballed(true);

FleetMemberAPI mothballedRA1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RA1");
fleet.getFleetData().addFleetMember(mothballedRA1);
mothballedRA1.getRepairTracker().setMothballed(true);
}
}



[close]

gen code
Spoiler
Code
// the "package" is the folder it's in, pretty self-explanatory
package data.scripts.world;

// you have to import anything that's not in the package that you want to use
// we need a fair bit of stuff to do the basic generating
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
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.fleet.FleetMemberType;

@SuppressWarnings("unchecked")
public class BISOGen {

// this is where the magic happens
public void generate(SectorAPI sector) {
// first we declare that "system" is Corvus so we can call it "system" later on instead of the whole sector.getStarSystem etc every time
StarSystemAPI system = sector.getStarSystem("Corvus");
// then we do the same but for "hyper" and hyperspace
LocationAPI hyper = Global.getSector().getHyperspace();
// then we do the same for the tri-tachyon station in Corvus
SectorEntityToken corvusttbase = Global.getSector().getStarSystem("Corvus").getEntityByName("Corporate HQ");

// then we do the same for the cargo interface IN the tt station in Corvus
CargoAPI cargo = corvusttbase.getCargo();
// and now the fun part: we add two mothballed Halcyon hulls to the station
// the _Hull variant is an empty variant automatically generated by the game for any ship
cargo.addMothballedShip(FleetMemberType.SHIP, "D1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "C1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "B1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RB1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "D1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "C1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "B1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RB1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RB2", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RA1", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "X1_variant_wing", null);

// now we do the other cool thing: we initialize a script that spawns a supply fleet
// the parameters are this: which sector it's in (there's only one), which system will handle the spawning (in this case, hyperspace)
// how many days will pass in between spawns (28) and how many max fleets there can be at once (1)
// where it will spawn (-6000, 2000 in hyperspace), and where it's going (the tt station in Corvus)
system.addScript(new BISOSpawnPoint(sector, hyper, 1, 1, hyper.createToken(-6000, 2000), corvusttbase));
// the script HalcyonCarrierSpawnPoint also needs to actually exist and have more code in it, so lets go read that one next

}

}















[close]
« Last Edit: October 06, 2013, 12:21:11 AM by dmaiski »
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

etherealblade

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #937 on: October 06, 2013, 03:38:44 AM »

1)Is it possible to mod a weapon that fires a projectile, only the projectile expands (gets bigger) as it travels?

2)Is it possible to have a weapon that fires a projectile that stays persistent on the screen and does damage over time?

3) I've seen weapons push ships away, is it possible to have a projectile that pulls them inward.

Even if it is theoretically possible I shall find the possiblity or workaround necessary. I just needed to know since there is many with much experience in tinkering.
« Last Edit: October 06, 2013, 03:42:08 AM by etherealblade »
Logged
Spoiler

[close]

Fireball14

  • Ensign
  • *
  • Posts: 22
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #938 on: October 06, 2013, 04:06:46 AM »

Ok, im trying to create new skill, its showin on game fine, i can spend points on it, but it dose not modfy anything.

Code
{
"id":"aptitude_precursor",
"governingAptitude":"precursor",
"effectGroups":[
{
"effects":[
{
"type":"SHIP",
"script":"data.characters.skills.scripts.PrecursorAptitudeEffect1",
},
]
},
],
}

and

Code
package data.characters.skills.scripts;

import com.fs.starfarer.api.characters.ShipSkillEffect;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;

public class PrecursorAptitudeEffect1 implements ShipSkillEffect {

    public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
stats.getCRPerDeploymentPercent().modifyPercent(id, -1f * PA_SkillData.APTITUDE_CR_LOSS_PER_SECOND_REDUCTION_PERCENT * level);
    }

    public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
stats.getCRPerDeploymentPercent().unmodify(id);
    }

public String getEffectDescription(float level) {
return "Decrease combat readiness consumption after peak efficiency time by " + (int)(PA_SkillData.APTITUDE_CR_LOSS_PER_SECOND_REDUCTION_PERCENT * level) + "%";
}

public String getEffectPerLevelDescription() {
return "" + (int)(PA_SkillData.APTITUDE_CR_LOSS_PER_SECOND_REDUCTION_PERCENT) + "%";
}

public ScopeDescription getScopeDescription() {
return ScopeDescription.PILOTED_SHIP;
}

}

Any idea why it dosent show up on ships stats info?
Logged

Xalendi

  • Commander
  • ***
  • Posts: 198
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #939 on: October 06, 2013, 05:32:06 AM »

halp its broken!!!
https://www.dropbox.com/s/tdc7jzbx80aqlju/Biso%20broken.7z
I think...   ???

I cant get my mothballed ships to show up in the corvus Corporate HQ,
based it off vayra's tutorial for the halcyon carier

spawnpoint code
Spoiler
Code
// the "package" is the folder it's in, pretty self-explanatory
package data.scripts.world;

// you have to import anything that's not in the package that you want to use
// we need a lot of stuff to spawn a supply fleet and add ships to it
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.fleet.FleetMemberAPI;
import com.fs.starfarer.api.fleet.FleetMemberType;
import data.scripts.world.BaseSpawnPoint;

// btw, i copied this almost entirely from the existing scripts in the vanilla game and then tweaked it until it served my purposes
// this is essentially how i do everything, and unless you're a coding god it is what i would reccommend doing yourself

@SuppressWarnings("unchecked")
public class BISOSpawnPoint extends BaseSpawnPoint {

// basic setup stuff, initialize a convoyDestination variable
private final SectorEntityToken convoyDestination;

// ...and the class for the whole script
public BISOSpawnPoint(SectorAPI sector, LocationAPI location,
float daysInterval, int maxFleets, SectorEntityToken anchor,
SectorEntityToken convoyDestination) {
super(sector, location, daysInterval, maxFleets, anchor);
this.convoyDestination = convoyDestination;
}

@Override
protected CampaignFleetAPI spawnFleet() {
// first things first, create a tritachyon supply fleet
// the faction has to line up with a faction that exists, and the fleet has to line up with a fleet that exists for that faction
// so if you wanted to change that to "Advent" and "Halcyon Carrier Delivery Fleet" or w/e you'd need to first create an Advent
// faction file and a halcyon carrier delivery fleet entry within it
CampaignFleetAPI fleet = getSector().createFleet("tritachyon", "supplyfleet");
// then we spawn the fleet we just created
getLocation().spawnFleet(getAnchor(), 0, 0, fleet);

// addShips is a function that we'll define later in this file
// it's what we're going to use to add the Halcyon Carrier to a tri-tachyon supply fleet
// (which obviously doesn't contain one by default)
addShips(fleet);

// we're also going to add enough crew and supplies to the fleet for it to be able to field the halcyon, heh
CargoAPI cargo = fleet.getCargo();
cargo.addCrew(CrewXPLevel.VETERAN, 4000);
cargo.addSupplies(5000);

// createDockedScripts is a function that we'll define later in this file
// we're going to use it to display a message when the supply fleet docks with the station
Script dockScript = null;
dockScript = createDockedScript(fleet);

// we're also going to tell the fleet what to do so it doesn't just wander around lost
fleet.addAssignment(FleetAssignment.DELIVER_RESOURCES, convoyDestination, 1000, dockScript);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);

return fleet;
}

private Script createDockedScript(final CampaignFleetAPI fleet) {
return new Script() {
public void run() {
if (fleet.isInCurrentLocation()) {
Global.getSector().addMessage("The Tri-Tachyon long distance tech trading expedition has docked");
// this is pretty self-explanatory, if the player's fleet is in Corvus when the halcyon supply fleet docks it displays a message
}
}
};
}

private void addShips(CampaignFleetAPI fleet) {
for (int i = 0; i < 4; i++) { // this line is a fancy way of saying "do the following 4 times"
FleetMemberAPI wasp = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "wasp_wing");
fleet.getFleetData().addFleetMember(wasp);
// so we just added 4 Wasp wings to the fleet (to escort the Halcyon, since it IS a carrier)
}
for (int i = 0; i < 2; i++) { // this line is a fancy way of saying "do the following 2 times"
FleetMemberAPI xyphos = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "xyphos_wing");
fleet.getFleetData().addFleetMember(xyphos);
// so we just added 2 Xyphos wings to the fleet (to escort the Halcyon, since it IS a carrier)
}
FleetMemberAPI activeC1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "C1_S");
fleet.getFleetData().addFleetMember(activeC1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedC1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "C1_S");
fleet.getFleetData().addFleetMember(mothballedC1);
mothballedC1.getRepairTracker().setMothballed(true);
// and last but not least, one mothballed Halcyon to be dropped off at the station! :)

FleetMemberAPI activeB1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "B1_S");
fleet.getFleetData().addFleetMember(activeB1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedB1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "B1_S");
fleet.getFleetData().addFleetMember(mothballedB1);
mothballedB1.getRepairTracker().setMothballed(true);

FleetMemberAPI activeD1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "D1_S");
fleet.getFleetData().addFleetMember(activeD1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedD1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "D1_S");
fleet.getFleetData().addFleetMember(mothballedD1);
mothballedD1.getRepairTracker().setMothballed(true);

FleetMemberAPI activeR1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RB1_S");
fleet.getFleetData().addFleetMember(activeR1);
// we also added one Halcyon that is fully armed and operational (this is what the crew and supplies were for, mainly)

FleetMemberAPI mothballedRB1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RB1_S");
fleet.getFleetData().addFleetMember(mothballedRB1);
mothballedRB1.getRepairTracker().setMothballed(true);

FleetMemberAPI mothballedRB2 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RB2");
fleet.getFleetData().addFleetMember(mothballedRB2);
mothballedRB2.getRepairTracker().setMothballed(true);

FleetMemberAPI mothballedX1 = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "X1_variant_wing");
fleet.getFleetData().addFleetMember(mothballedX1);
mothballedX1.getRepairTracker().setMothballed(true);

FleetMemberAPI mothballedRA1 = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "RA1");
fleet.getFleetData().addFleetMember(mothballedRA1);
mothballedRA1.getRepairTracker().setMothballed(true);
}
}



[close]

gen code
Spoiler
Code
// the "package" is the folder it's in, pretty self-explanatory
package data.scripts.world;

// you have to import anything that's not in the package that you want to use
// we need a fair bit of stuff to do the basic generating
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
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.fleet.FleetMemberType;

@SuppressWarnings("unchecked")
public class BISOGen {

// this is where the magic happens
public void generate(SectorAPI sector) {
// first we declare that "system" is Corvus so we can call it "system" later on instead of the whole sector.getStarSystem etc every time
StarSystemAPI system = sector.getStarSystem("Corvus");
// then we do the same but for "hyper" and hyperspace
LocationAPI hyper = Global.getSector().getHyperspace();
// then we do the same for the tri-tachyon station in Corvus
SectorEntityToken corvusttbase = Global.getSector().getStarSystem("Corvus").getEntityByName("Corporate HQ");

// then we do the same for the cargo interface IN the tt station in Corvus
CargoAPI cargo = corvusttbase.getCargo();
// and now the fun part: we add two mothballed Halcyon hulls to the station
// the _Hull variant is an empty variant automatically generated by the game for any ship
cargo.addMothballedShip(FleetMemberType.SHIP, "D1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "C1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "B1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RB1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "D1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "C1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "B1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RB1", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RB2", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "RA1", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "X1_variant_wing", null);

// now we do the other cool thing: we initialize a script that spawns a supply fleet
// the parameters are this: which sector it's in (there's only one), which system will handle the spawning (in this case, hyperspace)
// how many days will pass in between spawns (28) and how many max fleets there can be at once (1)
// where it will spawn (-6000, 2000 in hyperspace), and where it's going (the tt station in Corvus)
system.addScript(new BISOSpawnPoint(sector, hyper, 1, 1, hyper.createToken(-6000, 2000), corvusttbase));
// the script HalcyonCarrierSpawnPoint also needs to actually exist and have more code in it, so lets go read that one next

}

}















[close]

In the file named "BISOModPlugin.java", you need to replace the line "import data.scripts.world.HalcyonCarrierGen;" with "import data.scripts.world.BISOGen;"
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #940 on: October 06, 2013, 08:50:14 AM »

thanks xalendi!  ;D
i knew it was some silly mistake like that but i just couldnt see where it was   ::)
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Andy H.K.

  • Commander
  • ***
  • Posts: 232
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #941 on: October 06, 2013, 09:09:14 AM »

Is there any way in mission to make 2 ships on different team spawn in stationary position, facing each other, and make their AI keep shooting regardless of risk in overloading?

EDIT. never mind, I'll take a different approach in the design.
« Last Edit: October 07, 2013, 02:18:18 AM by Andy H.K. »
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #942 on: October 06, 2013, 09:46:09 AM »

Spoiler
[close]
me

the broken
same issue again, i fixed what xendi spotted, but aparently they still dont feel like spawning in the stations sale screen
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Psiyon

  • Admiral
  • *****
  • Posts: 772
  • Trippy
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #943 on: October 06, 2013, 06:31:10 PM »

A question about Java and persistent data:

Code: java

public class ascData {

/*
csix
okt
thi
esk
kta
lys
*/

public static String ERA = "ASC";

public static String ASC_FACTIONCHOICE = "csix";

public static boolean ASC_TEAM_KILLER = false;
public static float ASC_FACTION_RELATION = 0;

public static boolean ASC_EASY_MODE = false;

public static String isWorkingFor = " ";
public static boolean hasContract = false;

public static Map FC_RECEIVING_BONUS = new HashMap(50);

}

Is there a really fast and effective way to save and retrieve these few variables from persistent data? Maybe it's just my current state of mind, but I can't seem to figure it out. Any tips or quick examples would be greatly appreciated.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7299
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #944 on: October 06, 2013, 09:03:49 PM »

A question about Java and persistent data:

...
Is there a really fast and effective way to save and retrieve these few variables from persistent data? Maybe it's just my current state of mind, but I can't seem to figure it out. Any tips or quick examples would be greatly appreciated.

Yup, no problem.

1) Semi-related, but in general don't use static with modding. It screws with the way the game saves the object graph and can cause duplication (or at least thats what I've gathered from reading stuff Alex posted).

2) To add:

Code: java

Global.getSector().getPersistentData().put("ascDataInstance",new ascData());


To use (fetching the ERA string for example):

Code: java

string theERA = Global.getSector().getPersistentData().get("ascDataInstance").ERA;


Or if you include get/set methods for the ascData class, you can call those the same way. You can also just pull the whole object if that suits your needs better.

[edit] You could also store each value individually.
« Last Edit: October 06, 2013, 09:05:55 PM by Thaago »
Logged
Pages: 1 ... 61 62 [63] 64 65 ... 717