Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 [2] 3 4

Author Topic: Tutorial: Adding your own faction to the campaign.  (Read 46814 times)

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #15 on: February 28, 2012, 11:54:21 AM »

I made some changes, so here the new file is, if you can detect any errors:

[attachment deleted by admin]
Logged

Paul

  • Commander
  • ***
  • Posts: 159
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #16 on: February 28, 2012, 11:59:49 AM »

Heh...

SectorEntityToken CorvusIV = system.getEntityByName("Corvus IV");
station = system.addOrbitalStation(Corvus V)), 45, 150, 30, "Imperial Orbital Base", "TimCORP");

1. You set it to CorvusIV, and are then trying to use an undeclared Corvus V
2. You have a space in Corvus V
3. You have two ) after the V that shouldn't be there.

This is what it should be:

station = system.addOrbitalStation(CorvusIV, 45, 150, 30, "Imperial Orbital Base", "TimCORP");
Logged

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #17 on: February 28, 2012, 12:06:12 PM »

WORKS PERFECTLY, but how long does it take for the station and fleets to spawn, according to your file, which i copied?
Logged

Paul

  • Commander
  • ***
  • Posts: 159
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #18 on: February 28, 2012, 12:12:37 PM »

Depends what you have the day interval set to in your gen file for that spawn point.

Heh, looking at the file I see you're also adding two additional TimCORPConvoySpawnPoints when it creates the station. Not sure what you're trying to do, but your current code would create the station on the first convoy, then begin spawning in more convoys at the station itself, which deliver resources to the station and immediately despawn at the station.
Logged

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #19 on: February 28, 2012, 12:16:28 PM »

yes, that was kind of my intetion, to have the player have more of my factions ships, to make up for the lack of ship variants, but looking back, i see this may be a mistake.  I just removed the extra line of spawn. And i didn't change the day interval for spawn, so what is your default value?
Logged

washout

  • Lieutenant
  • **
  • Posts: 90
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #20 on: February 28, 2012, 12:53:00 PM »

yes, that was kind of my intetion, to have the player have more of my factions ships, to make up for the lack of ship variants, but looking back, i see this may be a mistake.  I just removed the extra line of spawn. And i didn't change the day interval for spawn, so what is your default value?
I am totally going to steal this idea.
Logged

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #21 on: February 28, 2012, 01:03:06 PM »

yes, that was kind of my intetion, to have the player have more of my factions ships, to make up for the lack of ship variants, but looking back, i see this may be a mistake.  I just removed the extra line of spawn. And i didn't change the day interval for spawn, so what is your default value?
I am totally going to steal this idea.
CREDIT ME FOR IT ;D
Logged

washout

  • Lieutenant
  • **
  • Posts: 90
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #22 on: February 29, 2012, 11:03:26 AM »

Quote
DISCLAIMER: Currently, due to a bug, getEntityByName does not work in the gen files, which is why most mods are editing the default SectorGen. For now, you can do the same – but your mod won't be all that compatible with other mods if you do. You could do a workaround like I did with adding them in the convoy scripts. You can see an example of how I did that in my mod. This is FIXED in the next patch though, so as soon as we get the next patch making your own gen file and using getEntityByName will be the preferred way of adding things.
This means that I can't add mothballed ships directly to existing stations at the beginning right? I can only spawn convoys and make them go to the station?
Logged

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #23 on: February 29, 2012, 11:07:48 AM »

Well, i don't know really about that, but you can spawn ships inside stations ( i have done so) but i can't seem to remeber how......, i think you just need to add it to the stations cargo. Or i am SURE you just need to add it to the stations cargo.
Logged

washout

  • Lieutenant
  • **
  • Posts: 90
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #24 on: February 29, 2012, 11:12:08 AM »

Well I answered my own question with that question. If you can't get entity by name to get the object then you can't do anything in your custom gen file. So I need to do it in a convoy instead. Otherwise it will be incompatible with junk pirates.
« Last Edit: February 29, 2012, 11:15:17 AM by washout »
Logged

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #25 on: February 29, 2012, 11:13:39 AM »

Or you just can add the ship(s) into the station cargo if you want them to spawn immidiately with the station. Much less wait.
Logged

washout

  • Lieutenant
  • **
  • Posts: 90
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #26 on: February 29, 2012, 11:18:30 AM »

Or you just can add the ship(s) into the station cargo if you want them to spawn immidiately with the station. Much less wait.

I'm not creating new stations though, there are already too many stations in various mods. I just want to add ships to existing stations. I'd like to do it in the gen, but can't because of this bug, so I'll have to do it with convoys instead.
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #27 on: April 30, 2012, 09:53:30 PM »

sorry for necro... this seemed relevant...

When booting sf with my mod I'm getting a fatal error saying unable to boot the generator file

I can't figure out what's wrong... hope someone can help

file follows:
Code
package data.scripts.world;

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 asgardGen implements SectorGeneratorPlugin {

   public void generate(SectorAPI sector) {
   
    StarSystemAPI system = sector.getStarSystem("Corvus");
    SectorEntityToken token = system.createToken(15000, 0);
    System.addSpawnPoint(new asgardSpawnPoint(sector, system, 1, 3, token));
    FactionAPI asgard = sector.getFaction("asgard");
     
    asgard.setRelationship("hegemony", -1);
    asgard.setRelationship("tritachyon", 0);
    asgard.setRelationship("pirates", -1);
    asgard.setRelationship("independent", 0);
    asgard.setRelationship("player", 0);
   }
}

Logged
mmm.... tartiflette

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #28 on: May 01, 2012, 01:18:14 AM »

You need to have generator file inside your data/world folder.
Logged

Erick Doe

  • Global Moderator
  • Admiral
  • *****
  • Posts: 2489
  • "Pretty cunning, don't you think?"
    • View Profile
Re: Tutorial: Adding your own faction to the campaign.
« Reply #29 on: May 01, 2012, 07:13:17 AM »

I'm sort of having the same problem as gunnyfreak.

I get this message, when booting SF with my mod:

Quote
Fatal: Error compiling [data.scripts.world.AntediluvianGen]
Cause: Compiling unit "data/scripts/world/AntediluvianGen.java."
Check starferer.log for more info.

It seems that there is a problem with my AntediluvianGen.java file. But I can't find it:

Quote
package data.scripts.world;

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 AntediluvianGen implements SectorGeneratorPlugin {

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

      // SectorEntityToken centre = system.getEntityByName("star_yellow");
      
      SectorEntityToken token = system.createToken(15000, 0);

      system.addSpawnPoint(new AntediluvianSpawnPoint(sector, system, 20, 1, token));

      FactionAPI antediluvian = sector.getFaction("antediluvian");

      antediluvian.setRelationship("hegemony", 0);
      antediluvian.setRelationship("tritachyon", -1);
      antediluvian.setRelationship("pirates", -1);
      antediluvian.setRelationship("independent", 0);
      antediluvian.setRelationship("player", 0);

      
      
   }
}

the generators.CSV file is located in "data/world", and has the line "data.scripts.world.AntediluvianGen"


Any help would be appreciated!
Logged
Pages: 1 [2] 3 4