Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Titann

Pages: 1 [2]
16
Suggestions / Capital ship explosions
« on: June 13, 2014, 11:46:19 AM »
I have an idea for Capital ships,

In this game capital ships exploding instantly, They should be explode like in this video;
-***-Click Here-***-

Small explosions then Bigger explosions and Capital ship blews up.

17
Modding / fatal error Null WTF...?
« on: November 19, 2012, 07:45:33 AM »
Im making a mod but I got error everytime Its opening the game menu but I cant start the campaign

starfarerlog:
Spoiler
13526 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.campaign.CampaignOrbitalStation.readResolve(Unknown Source)
   at com.fs.starfarer.campaign.CampaignOrbitalStation.<init>(Unknown Source)
   at com.fs.starfarer.campaign.StarSystem.addOrbitalStation(Unknown Source)
   at data.scripts.world.AllianceGen.generate(AllianceGen.java:44)
   at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
   at com.fs.starfarer.title.OoOO.o00000(Unknown Source)
   at com.fs.starfarer.ui.float.ÔO0000(Unknown Source)
   at com.fs.starfarer.ui.impl.B.ÔO0000(Unknown Source)
   at com.fs.starfarer.campaign.save.o0OO.o00000(Unknown Source)
   at com.fs.starfarer.ui.O00o.o00000(Unknown Source)
   at com.fs.starfarer.ui.E.o00000(Unknown Source)
   at com.fs.starfarer.ui.T.o00000(Unknown Source)
   at com.fs.starfarer.A.öOÓ000(Unknown Source)
   at com.fs.oOOO.A.new(Unknown Source)
   at com.fs.starfarer.combat.String.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
[close]

my alliancegen.java
Spoiler
package data.scripts.world;

//Importing required libraries and such. Be sure to have all the required imports
import java.awt.Color;
import java.util.List;

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;

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

   public void generate(SectorAPI sector) {

            //These lines are getting data from vanilla Starfarer's Corvus System. Critical for locations and such

            //Getting the system itself
            StarSystemAPI system = sector.getStarSystem("Corvus");
           
            //In this one, it's getting the abandoned station orbiting Corvus I. This line can be done with Stars, planets

or stations. Basically any fixed object in a star system it will get by name in quotations
            SectorEntityToken stock = system.getEntityByName("Abandoned Storage Facility");
         SectorEntityToken corvustoken = system.getEntityByName("Corvus");
         SectorEntityToken token = system.createToken(-15000, 15000);

            //Creating a token in the system. Doesn't do much except act as a reference point for getting the planet

placement right for any added
            //SectorEntityToken <token> = system.createToken(0, 0);

            //Creates a new planet. <planet type> can be gas_giant, ice_giant, lava, frozen, barren, toxic, jungle,

terran, desert, arid, or cryovolcanic. <angle> refers to the planet's bearing dependant on <token>. 0 would be to the

“east”, with increasing values                going anti-clockwise
            SectorEntityToken carius = system.addPlanet(corvustoken, "Carius", "ice_giant", 90, 300, 8500, 225);
         
            //If you so desire, you can even make an asteroid belt for yourself. <orbit-parent> refers to the entity

that the belt orbits
            system.addAsteroidBelt (carius, 250, 750, 250, 10, 15);
           
            //This is where you create the station for your faction, or just another station for an existing faction, if

you so please.
            SectorEntityToken Alliancestarbase = system.addOrbitalStation(carius, 90, 500, 15, "Starbase", "alliance");
         SectorEntityToken starbasetoken = system.getEntityByName("Starbase");
           
            //Creates a spawn point for the faction's convoys. The combat/reconnaissance fleets will be dealt with in

the next line
            system.addSpawnPoint (new AllianceConvoySpawnPoint(sector, system, 10, 1, token, starbasetoken));
           
            //Creates a spawn point for the factions combat/reconnaissance fleets. Just a repetition of before, but still

important, as the values will likely be different.
            AllianceSpawnPoint AllianceSpawn = new AllianceSpawnPoint(sector, system, 5, 10, starbasetoken);
           
            //Actually adding the combat/reconnaissance spawn
            system.addSpawnPoint(AllianceSpawn);
           
            //This for example, creates 4 fleets from the <Faction>Spawn.java specs. More on that when the time

comes
            for (int i = 0; i < 3; i ++) AllianceSpawn.spawnFleet();
           
            //Getting the cargo of the station. Vital for adding more cargo and ships to the station
            CargoAPI Alliancecargo = Alliancestarbase.getCargo();
           
           
            //Adding weapons to the station's initial inventory.
            Alliancecargo.addWeapons("meddriv", 5);
                     
            //Adding misc. cargo to the station's inventory. In this instance it is regular crew and supplies
            Alliancecargo.addCrew(CrewXPLevel.GREEN, 250);
         Alliancecargo.addCrew(CrewXPLevel.REGULAR, 250);
         Alliancecargo.addCrew(CrewXPLevel.VETERAN, 100);
         Alliancecargo.addCrew(CrewXPLevel.ELITE, 50);
         Alliancecargo.addMarines(250);
            Alliancecargo.addSupplies(500);
         Alliancecargo.addFuel(250);
           
            //Adding a ship to the station's inventory. Note that you'll have to repeat lines if you're wanting multiple of

the same hull type
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_CargoShip_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_CargoShip_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "alliance_cruiser_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "alliance_cruiser_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_Dreadnaught_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_Dreadnaught_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_Carrier_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_Carrier_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_Carrier_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "Alliance_Dreadnaught_Hull", null);
         Alliancecargo.addMothballedShip(FleetMemberType.SHIP, "alliance_cruiser_Hull", null);


         
         
           
            //Fighter wings are slightly different, but it's the same principle
         Alliancecargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "wasp_wing", null);
         Alliancecargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "wasp_wing", null);


           
               FactionAPI alliance = sector.getFaction("alliance");
            alliance.setRelationship("hegemony", -1);
            alliance.setRelationship("tritachyon", 1);
            alliance.setRelationship("pirates", -1);
            alliance.setRelationship("independent", -1);
            alliance.setRelationship("player", 0);
         }
}
[close]

AllianceConvoySpawnPoint.java
Spoiler
package data.scripts.world;


//And yet again with this, make sure you have the imports correct
import java.util.List;

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.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.FleetMemberType;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;


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

   //All of this is required for the script to work. So just copy this in
   private final SectorEntityToken convoyDestination;

   public AllianceConvoySpawnPoint(SectorAPI sector, LocationAPI location,
                     float daysInterval, int maxFleets, SectorEntityToken anchor,
                     SectorEntityToken convoyDestination) {
      super(sector, location, daysInterval, maxFleets, anchor);
      this.convoyDestination = convoyDestination;
   }

   //This line is for if you're wanting incremental convoys to add more stuff. For example if you want to simulate an arms race, or just have a bit of pacing with the way things are going
   private static int convoyNumber = 0;
   
   @Override
   protected CampaignFleetAPI spawnFleet() {
      String type = null;

      //For creating different kinds of convoy, similar to the Hegemony ones, with different resources depending on convoy. Not required, but still worth knowing about
      float r = (float) Math.random();
      if (r > .6f) {
         type = "resupplyfleet";
      } else if (r > .4f) {
         type = "fuelfleet";
      } else {
         type = "personnelfleet";
      }   
      //Creates the convoy
      CampaignFleetAPI fleet = getSector().createFleet("alliance", type);
      getLocation().spawnFleet(getAnchor(), 0, 0, fleet);
     

      //Changes the delivered goods depending on the convoy type
      if (type.equals("resupplyfleet")) {
         //In the case of a Supply convoy, delivers 5 random weapons from the list to the station
         CargoAPI cargo = fleet.getCargo();
         addRandomWeapons(cargo, 5);
      }     
      else if (type.equals("personnelfleet")) {
         CargoAPI cargo = fleet.getCargo();
         cargo.addCrew(CrewXPLevel.ELITE, 175);
            cargo.addCrew(CrewXPLevel.VETERAN, 375);
     }     
     
      //Line used for determining what random ships from the list of defined ships are actually added to the station on the delivery run
      addRandomShips(fleet.getCargo(), (int) (Math.random() * 4f));
     
      //Message for when the supply convoy has entered the system.
      Script script = null;
      if (type.equals("resupplyfleet") || type.equals("fuelfleet") || type.equals("personnelfleet")) {
         script = createArrivedScript();
         Global.getSectorAPI().addMessage("A convoy belonging to the nephalem industries has arrived in the system");
      }
      //Tells the fleet to go to the station, then afterwards return to the point and despawn. To simulate delivering to the station, then moving to another system
      fleet.addAssignment(FleetAssignment.DELIVER_RESOURCES, convoyDestination, 1000, script);
      fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
     
      return fleet;
   }
   
   //Message for when the supply convoy has successfully delivered its cargo
   private Script createArrivedScript() {
      return new Script() {
         public void run() {
            Global.getSectorAPI().addMessage("The convoy has delivered new supplies to the nephalem starbase");
         }
      };
   }
   
   //Determining random weapons to add to the station from the list at the end
   private void addRandomWeapons(CargoAPI cargo, int count) {
      List weaponIds = getSector().getAllWeaponIds();
      for (int i = 0; i < count; i++) {
         String weaponId = (String) weaponIds.get((int) (weaponIds.size() * Math.random()));
         int quantity = (int)(Math.random() * 4f + 2f);
         cargo.addWeapons(weaponId, quantity);
      }
   }
   
   //Determining random ships to add to the station from the list at the end. Including fighter wings
   private void addRandomShips(CargoAPI cargo, int count) {
      List weaponIds = getSector().getAllWeaponIds();
      for (int i = 0; i < count; i++) {
         if ((float) Math.random() > 0.4f) {
            String wing = (String) wings[(int) (wings.length * Math.random())];
            cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, wing, null);
         } else {
            String ship = (String) ships[(int) (ships.length * Math.random())];
            cargo.addMothballedShip(FleetMemberType.SHIP, ship, null);
         }
      }
   }

   //These three blocks are for defining the different types of ships, fighter wings and weapons the station stocks. No repetition of types is needed for this part.
   private static String [] ships = {
                           "Alliance_CargoShip_Hull",
                     "Alliance_CargoShip_Hull",
                     "Alliance_CargoShip_Hull",
                     "alliance_cruiser_Hull",
                     "alliance_cruiser_Hull",
                     "alliance_cruiser_Hull",
                     "alliance_cruiser_Hull",
                     "alliance_cruiser_Hull",
                     "Alliance_Dreadnaught_Hull",
                     "Alliance_Dreadnaught_Hull",
                     "Alliance_Dreadnaught_Hull",
                     "Alliance_Dreadnaught_Hull",
                     "Alliance_Carrier_Hull",
                     "Alliance_Carrier_Hull",
                     "Alliance_Carrier_Hull",

                           };

   private static String [] wings = {
                           "wasp_wing",
                           "wasp_wing",   
                           "wasp_wing",
                           "wasp_wing",     
                     
                           };
   
   private static String [] weapons = {
                           "meddriv",
                     
                           };
                           
}
[close]

AllianceSpawnPoint.java
Spoiler
package data.scripts.world;

//And another yet again, have the imports correct
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
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 data.scripts.world.BaseSpawnPoint;

public class AllianceSpawnPoint extends BaseSpawnPoint {

   public AllianceSpawnPoint(SectorAPI sector, LocationAPI location,
                     float daysInterval, int maxFleets, SectorEntityToken anchor) {
      super(sector, location, daysInterval, maxFleets, anchor);
   }

   @Override
   protected CampaignFleetAPI spawnFleet() {
      //if ((float) Math.random() < 0.5f) return null;
      //Like for the convoys, this is for determining the fleet type on a random basis.
      String type = null;
      float r = (float) Math.random();
      if (r > .6f) {
        type = "attackFlet";
      } else if (r > 0.40f) {
         type = "attackFlet1";
      } else if (r > 0.35f) {
         type = "attackFlet2";
      } else if (r > 0.25f) {
         type = "Defenseflet";
      }
     
      //
      CampaignFleetAPI fleet = getSector().createFleet("alliance", type);
      getLocation().spawnFleet(getAnchor(), 0, 0, fleet);

      fleet.setPreferredResupplyLocation(getAnchor());
      //Giving the fleets orders depending just on what type of fleet it is. So the patrol, raid and attack fleets will go out and roam the Corvus system The systemDefense fleet, however, will stick by the station to safeguard it
      if (type.equals("attackFlet") || type.equals("attackFlet1") || type.equals("attackFlet2") || type.equals("Defenseflet")) {
         fleet.addAssignment(FleetAssignment.PATROL_SYSTEM, null, 80);
         fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
      } else {
         if ((float) Math.random() > 0.8f) {
            fleet.addAssignment(FleetAssignment.PATROL_SYSTEM, null, 80);
            fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
         } else {
            fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), 60);
            fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
         }
      }
     
     
      return fleet;
   }

}
[close]

What's Wrong???

Pages: 1 [2]