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 ... 15 16 [17] 18 19 ... 706

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

WhoopieMonster

  • Ensign
  • *
  • Posts: 39
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #240 on: February 09, 2013, 04:01:17 AM »

Thanks dude :)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #241 on: February 09, 2013, 09:19:22 AM »

Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?

fleet.getLocation().set(x, y);

You can do this with every method that returns a Vector2f, though how much of a good idea that is varies based on the specifics.

Here's the javadoc for Vector2f, for reference:
http://lwjgl.org/javadoc/org/lwjgl/util/vector/Vector2f.html
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 #242 on: February 09, 2013, 11:37:04 AM »

Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?

fleet.getLocation().set(x, y);

You can do this with every method that returns a Vector2f, though how much of a good idea that is varies based on the specifics.

Here's the javadoc for Vector2f, for reference:
http://lwjgl.org/javadoc/org/lwjgl/util/vector/Vector2f.html

I think he was asking how to keep the reference to the fleet object outside of the method that creates it.


If all you want is to have access to the fleet in its assignment script, you can write your own implementation of Script that accepts a CampaignFleetAPI as an argument in its constructor. Something like this:

Code
package data.scripts;

import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;

public abstract class FleetScript implements Script
{
    private final CampaignFleetAPI fleet;

    public FleetScript(CampaignFleetAPI fleet)
    {
        this.fleet = fleet;
    }

    public CampaignFleetAPI getFleet()
    {
        return fleet;
    }

    public abstract void run();
}

With this, all you need to do is change the new Script() { // blah } to new FleetScript(fleet) { // blah } in your convoy file, and you'll have access to the fleet object in your run() method.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #243 on: February 09, 2013, 12:02:02 PM »

Oh, I think you're right, I totally misread that.
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #244 on: February 09, 2013, 06:25:13 PM »

Thanks Alex and LW :)
Logged

Vilu

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #245 on: February 10, 2013, 04:15:03 AM »

Is it possible to have mods load up on old saves?

I'm asking because i got quite good game going on Uomoz's Corvus and would like to add Fleet Control to the mix, but don't feel like starting yet again from start :( (few too many restarts recently)


(if this has been asked and answered before, sorry that i missed it)

edit: the skills from FC add up to old save, however the planets do not.
« Last Edit: February 10, 2013, 04:30:13 AM by Vilu »
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 #246 on: February 10, 2013, 10:22:12 AM »

Is it possible to have mods load up on old saves?

I'm asking because i got quite good game going on Uomoz's Corvus and would like to add Fleet Control to the mix, but don't feel like starting yet again from start :( (few too many restarts recently)


(if this has been asked and answered before, sorry that i missed it)

edit: the skills from FC add up to old save, however the planets do not.

This is relevant to my interests. :)

The mod's generator will not run if you add it to an existing game, so stations, planets, spawn points etc won't be set up. Any vanilla content that's modified by the mod might work, unless it references something that doesn't exist in the current save. In other words, a rebalance of the Tactical Laser would work, a rewrite of a vanilla spawn point that tries to tie into a mod-added economy won't.

As you've already noticed, stuff from CSVs like skills will be loaded (you might get errors if you try to put points in them), but ships won't automatically appear in stations (they might appear in vanilla fleets if the mod changes their composition). Added weapons will eventually start appearing since the vanilla convoys choose from every weapon loaded when they select cargo.

Factions are only created at the start of a new game, so you can't activate a mod's generator manually if it refers to a new faction. Station placement will also be off (if the mod tells a station to orbit at 270 degrees because that's opposite where another station spawns, it will still choose 270 degrees even if that other station is currently at 269 degrees itself).

Some mods can force themselves to activate in an old save via very hacky methods. The Respec Mod I wrote does so. Again, this is limited to mods that don't add new factions, and the mod authors will have to implement it themselves.

tl;dr: it's complicated. ;)
« Last Edit: February 10, 2013, 10:24:32 AM by LazyWizard »
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #247 on: February 11, 2013, 05:18:14 AM »

Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?

fleet.getLocation().set(x, y);

You can do this with every method that returns a Vector2f, though how much of a good idea that is varies based on the specifics.

Here's the javadoc for Vector2f, for reference:
http://lwjgl.org/javadoc/org/lwjgl/util/vector/Vector2f.html

I think he was asking how to keep the reference to the fleet object outside of the method that creates it.


If all you want is to have access to the fleet in its assignment script, you can write your own implementation of Script that accepts a CampaignFleetAPI as an argument in its constructor. Something like this:

Code
package data.scripts;

import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;

public abstract class FleetScript implements Script
{
    private final CampaignFleetAPI fleet;

    public FleetScript(CampaignFleetAPI fleet)
    {
        this.fleet = fleet;
    }

    public CampaignFleetAPI getFleet()
    {
        return fleet;
    }

    public abstract void run();
}

With this, all you need to do is change the new Script() { // blah } to new FleetScript(fleet) { // blah } in your convoy file, and you'll have access to the fleet object in your run() method.

I created the new implementation of Script and Netbeans says it's allright, BUT, in campaign the script is not activating:

Spoiler
   private void BOSS_Spawn(StarSystemAPI system, SectorEntityToken despawn_location, String boss_base, String boss_faction, String boss_id, String boss_name, String boss_hello)   {
        SectorEntityToken base = system.getEntityByName(boss_base);
        if (EventsTimerReset == 0) {
            Global.getSector().addMessage("EVENT: " + boss_name + " is in the system! All Frequency Message incoming.", Color.YELLOW);
        }
        if (EventsTimerReset == -1) {
        Global.getSector().addMessage(boss_hello, Color.magenta);
        CampaignFleetAPI fleet = getSector().createFleet("events", boss_id);
        system.spawnFleet (base, 0, 0, fleet);
        Event_Faction_Change (boss_faction);
        event_ON = true;
        Script script = null;
        script = DespawnScript(fleet);
        fleet.addAssignment(FleetAssignment.RAID_SYSTEM, null, 10, script);
        fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, despawn_location, 10);
        }
    }
    private Script DespawnScript(final CampaignFleetAPI fleet)  {                              <-------------------- ALL THIS STUFF NEVER HAPPENS
        return new UomozFleetScript(fleet) {
            public void run() {
                fleet.getLocation().set(30000, 30000);
                event_ON = false;
                EventsTimerReset = (int) (10 + (Math.random() * 6));
            }
            };
    }
[close]
Logged

EnderNerdcore

  • Commander
  • ***
  • Posts: 172
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #248 on: February 11, 2013, 10:23:37 AM »

Where in your code are you calling DespawnScript(fleet)?
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #249 on: February 11, 2013, 10:38:42 AM »

After the RAID_SYSTEM completion.
Logged

EnderNerdcore

  • Commander
  • ***
  • Posts: 172
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #250 on: February 11, 2013, 11:52:53 AM »

Oh, duh, there it is. Huh. Unfortunately that's starting to stretch my Java knowledge there, I've never used a Script like that.
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #251 on: February 13, 2013, 12:06:01 PM »

Trying to create a CharacterCreationPlugin where choices creates other (selective) choices is not working:

Spoiler
   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);
      } else if (stage == 2) {
         result.add(SOV);
         result.add(SUP);
         result.add(PIR);
         result.add(COR);
         result.add(INV);
         result.add(NOBLOC);
                } else if (stage == 3) {
                       if (result.contains(SOV)) {
         result.add(HE);
         result.add(IF);
      } else if (result.contains(SUP)) {
         result.add(TT);
         result.add(SI);
      } else if (result.contains(PIR)) {
         result.add(PP);
         result.add(JP);
                        result.add(GD);
      } else if (result.contains(COR)) {
         result.add(BR);
         result.add(NC);
      } else if (result.contains(INV)) {
         result.add(AN);
         result.add(TL);
      } else if (result.contains(NOBLOC)) {
         result.add(AS);
      }
                        result.add(NOFAC);
      }
      return result;
[close]

The else if chain in stage 3 is not appearing in the response list in-game while NOFAC (out of the else if chain) option appears. Any ideas?
Logged

TheHappyFace

  • Admiral
  • *****
  • Posts: 1168
  • The critic
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #252 on: February 13, 2013, 10:08:35 PM »

if you don't want to start over again you could also guess whats the worth of your fleet in credits and edit your new save to have this amount.
you would be able to rebuy most of your ships and weaponry.
Logged
Fractalsoftworks limited edition ban hammer.

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #253 on: February 15, 2013, 11:40:33 AM »

Is there any way to force the hit glow radius on a beam weapon? I made a custom graphic beam with a really wide sprite and the hit glow is enormous. Since beams dont have a proj file I'm not sure where to rectify this. And yes, I've tried adding glow radius and hitglow radius to the weapon file.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #254 on: February 15, 2013, 12:22:32 PM »

Huh, could've sworn that's possible, but no, it's not - it's always 3x the width of the beam.

A really wide beam is going to have some other issues, btw, since hit detection will only be done for the middle of the beam. So, it'll look odd when it's not hitting something it's obviously overlapping, or when something that's not big enough to interrupt it, does.
Logged
Pages: 1 ... 15 16 [17] 18 19 ... 706