Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Fleet ID null  (Read 3405 times)

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Fleet ID null
« on: August 21, 2012, 12:51:06 PM »

Can someone help me find the problem? its in here somewhere.

Spoiler
Quote
{
id:"nephalem",
  "color":[143,175,78,119],
    "displayName":"Nephalem",
     "shipNamePrefix":"NHI",
       
   "shipNameSources":{
      "BEASTS":2,
      "JAPANESE":1,
   },
  
   "description":"<description>",

  
   "names":{
      "modern":1,
   },
  
   "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",
      ],
   },
  
   "fleetCompositions":{
      "heavyassaultfleet":{
     
         "displayName":"Heavy Assault Fleet",
         "maxFleetPoints":125,
         "daysWorthOfSupplies":[30, 50],
         "lyWorthOfFuel":[40, 60],
         "extraCrewPercent":[100, 100],
         "marinesPercent":[20, 20],
         "ships":{
          "talos_standard":[4, 6],
           "keres_support":[4, 8],

         },
      },
      "navycore":{
         "displayName":"Navy Core",
         "maxFleetPoints":185,
         "daysWorthOfSupplies":[40, 80],
         "lyWorthOfFuel":[40, 60],
         "extraCrewPercent":[100, 100],
         "marinesPercent":[20, 20],
         "ships":{
             "nyx_standard":[2, 2],                  
                "talos_standard":[4, 6],    
            "keres_support":[6, 10],

         },
      },
      "resupplyfleet":{
         "displayName":"Resupply Fleet",
         "maxFleetPoints":200,
         "daysWorthOfSupplies":[150, 150],
         "lyWorthOfFuel":[40, 60],
         "extraCrewPercent":[80, 80],
         "marinesPercent":[20, 20],
         "ships":{
            "talos_standard":[4, 4],
            "atlas_Standard":[4, 4],
            "keres_support":[6, 10],

         },
      },
      "fuelfleet":{
         "displayName":"Fuel Fleet",
         "maxFleetPoints":150,
         "daysWorthOfSupplies":[20, 50],
         "lyWorthOfFuel":[500, 500],
         "extraCrewPercent":[80, 80],
         "marinesPercent":[20, 20],
         "ships":{
            "talos_standard":[2, 2],
            "phaeton_Standard":[4, 6],
               "keres_support":[6, 10],                          
        
         },
      },
      "personnelfleet":{
         "displayName":"Personnel Fleet",
         "maxFleetPoints":150,
         "daysWorthOfSupplies":[20, 50],
         "lyWorthOfFuel":[50, 60],
         "extraCrewPercent":[100, 100],
         "marinesPercent":[20, 20],
         "ships":{
         "talos_standard":[1, 1],           
            "valkyrie_Elite":[6, 8],   
            "keres_support":[6, 10],                              

         },
      },        
   },
  
   "traits":{
      "admiral":{
        "steady":1,
       "cautious":1,
       "aggressive":1,
        
      },
      "captain":{

         "cautious":1,
         "steady":1,
         "aggressive":1,        
         "fearless":1,
      },
   },
  
   "dialogue":{
      "greetingFriendly":"A friendly face, that is a rare sight around here.",
      "greetingNeutral":"Haven't seen you around, are you perhaps new to the corvus space lanes?",
      "greetingHostileAggressive":"By order from the badass admiral you are to be exterminated, surrender or we will board your ships, steal your pretty female officers and literaly crush you beneath our feet.",
      "greetingHostileTimid":"Im sorry, i will do anything, please let us go!",
   }
},
[close]

EDIT log + spawn file if you click this:
Spoiler
Quote
65349 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.RuntimeException: Fleet id [null] not found for faction [nephalem]
java.lang.RuntimeException: Fleet id [null] not found for faction [nephalem]
[/sp

Spawn file
Spoiler
Quote
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 nephalemSpawnPoint extends BaseSpawnPoint {

   public nephalemSpawnPoint(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 > .8f) {
        type = "heavyassaultfleet";
      } else if (r > 0.20f) {
         type = "navycore";
      }
     
      //
      CampaignFleetAPI fleet = getSector().createFleet("nephalem", 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("heavyassaultfleet")) {
         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]
[close]
« Last Edit: August 21, 2012, 01:04:26 PM by ValkyriaL »
Logged

FlashFrozen

  • Admiral
  • *****
  • Posts: 988
    • View Profile
Re: Fleet ID null
« Reply #1 on: August 21, 2012, 12:59:22 PM »

Please post up the starfarer.log preferably near the bottom and where it contains this part

Spoiler
[Thread-6] ERROR
[close]

It's most likely a simple misspelling in your spawnpoint files, or misspelling in your file, but without the log your asking to find what's wrong with something that could possibly in a different file.

Then please post up either your Spawnpoint / Convoyspawnpoint
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Fleet ID null
« Reply #2 on: August 21, 2012, 01:04:35 PM »

There you go
Logged

FlashFrozen

  • Admiral
  • *****
  • Posts: 988
    • View Profile
Re: Fleet ID null
« Reply #3 on: August 21, 2012, 01:34:14 PM »

Okay, got it, it's your spawn file, Because you've left out most of your other fleets unspawned and with ids


JUST AS AN EXAMPLE:
Code
		if (r > 0.50f) {			//	50% (50)
type = "heavyassaultfleet";
} else if (r > 0.35f) { // 15% (35)
type = "navycore";
} else if (r > 0.25f) { // 10% (25)
type = "resupplyfleet";
} else if (r > 0.20f) { // 5% (20)
type = "fuelfleet";
} else { // 20%
type = "Personnel Fleet";
}


    
Code
 if (r > .8f) {
        type = "heavyassaultfleet";
      } else if (r > 0.20f) {
         type = "navycore";
      }


See if that helps but it's more of keep adding in the fleets to make it work, since you just didn't get to the part where you finished it.
« Last Edit: August 21, 2012, 01:36:21 PM by FlashFrozen »
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Fleet ID null
« Reply #4 on: August 21, 2012, 01:52:19 PM »

I know, my personnel convoy crashes the game on both my factions so i commented them out and set convoy spawn to 1000 days so they would never spawn, i have no idea how to fix them.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7233
  • Harpoon Affectionado
    • View Profile
Re: Fleet ID null
« Reply #5 on: August 21, 2012, 09:34:41 PM »

It doesn't matter if you never spawn a particular type of fleet, but 20% of the time your variable "type" is never given a value. When your random variable 'r' is < .2 none of the if statements are true, so you never get a "type = blah" line. That will cause an error when you call .createFleet("nephalem", type).

If you want the mix to be 20/80 use:
Code
 if (r > .8f) {
        type = "heavyassaultfleet";
      } else {
         type = "navycore";
      }
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Fleet ID null
« Reply #6 on: August 21, 2012, 11:44:13 PM »

It doesn't matter if you never spawn a particular type of fleet, but 20% of the time your variable "type" is never given a value. When your random variable 'r' is < .2 none of the if statements are true, so you never get a "type = blah" line. That will cause an error when you call .createFleet("nephalem", type).

If you want the mix to be 20/80 use:
Code
 if (r > .8f) {
        type = "heavyassaultfleet";
      } else {
         type = "navycore";
      }

i have 2 separate files for combat and convoys, so my spawn file for combat fleets already look like that =I and my convoys are set to 1000 days so they couldn't cause the problem. because the game never crash on my other faction witch has an identical convoy spawn file.
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Fleet ID null
« Reply #7 on: August 22, 2012, 09:05:10 AM »

The only way to get Fleet ID null is to try to spawn a fleet with a null id. It might sound like I'm being condescending, but I'm not. We're just establishing the logic by which you'll be able to debug this.

Next you'll need to post the source code for all your spawners. If you only want to post the pertinent bits, here's what I'm really looking for:
  • Any line where you call spawn fleet.
  • Any line which assigns a value to a variable which is passed as any of the arguments to the above.

That will tell us if it's ever possible to have a null or not. I'm hoping that you've simply overlooked something, but we'll get to the bottom of it.
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Fleet ID null
« Reply #8 on: August 22, 2012, 02:56:02 PM »

Quote
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 > .8f) {
        type = "explorer";
      } else if (r > 0.50f) {
         type = "strikefleet";
      } else if (r > 0.25f) {
         type = "heavyassaultfleet";
      } else if (r > 0.10f) {
         type = "navydetachment";
      }
Quote
CampaignFleetAPI fleet = getSector().createFleet("nephalem", 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("explorer") || type.equals("strikefleet") || type.equals("heavyassaultfleet") || type.equals("navydetachment")) {
         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);

i cant even start the game anymore because of fleet id null, and nothing is wrong. ive searched every file on my computer for anything that has anything to do with this faction. all fleet ids are correct, and now my working faction is starting to crash because of the same error. don't think the game likes me =(

EDIT: can adding a new fleet type give fleet id null even if its correct? i made a awful ship in paint and put it in a new fleet. it never spawned in the game tho. =I
« Last Edit: August 22, 2012, 03:03:31 PM by ValkyriaL »
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Fleet ID null
« Reply #9 on: August 22, 2012, 03:10:50 PM »

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 > .8f) {
        type = "explorer";
      } else if (r > 0.50f) {
         type = "strikefleet";
      } else if (r > 0.25f) {
         type = "heavyassaultfleet";
      } else if (r > 0.10f) {
         type = "navydetachment";
      }

You have at least one logic bug, ValkyriaL. If r == 0.05, type will remain null.

fixed typo ~T
« Last Edit: August 22, 2012, 03:20:17 PM by Trylobot »
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7233
  • Harpoon Affectionado
    • View Profile
Re: Fleet ID null
« Reply #10 on: August 22, 2012, 03:45:19 PM »

Well, if you want to post your mod I promise to not steal anything! I don't know if I'll be able to find the error, but I'll spend some time trying :).
Logged