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 ... 208 209 [210] 211 212 ... 706

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

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3135 on: April 24, 2017, 03:40:09 AM »

How do I now define number of fighters in a wing?

Spoiler
[close]
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3136 on: April 24, 2017, 03:53:26 AM »

How do I tell within a reportBattleFinished call if a ship was disabled and then recovered after the battle?
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3137 on: April 24, 2017, 04:06:19 AM »

How do I now define number of fighters in a wing?

Spoiler
[close]

How do you get the xml to separate the text in columan? For me it just dump everything in the first one if I open with excell

EDIT: NEvermind, I think I got it
« Last Edit: April 24, 2017, 04:10:41 AM by TrashMan »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3138 on: April 24, 2017, 09:14:15 AM »

How do I tell within a reportBattleFinished call if a ship was disabled and then recovered after the battle?

I don't believe you can.


This should be really explained in more depth.
Plenty of people who are trying to update their mods are left scratching their heads since they have no idea what effect some fields actually have or the value ranges or anything.

You should really make a detailed post with changes to ships/fighters/weapon and what the new fields/values do.

Ideally, yeah, but things are a bit hectic right now so it's not really a good option.
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 592
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3139 on: April 24, 2017, 11:34:10 AM »

Hello everyone!

I'm trying to revive my old mod again and get it to run with Starsector 0.8, problem is there's quite a lot of old code not working anymore.
I've got this script in particular:
Spoiler
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.VectorUtils;
import org.lazywizard.lazylib.MathUtils;
import org.lwjgl.util.vector.Vector2f;

public class Greifer_effect implements BeamEffectPlugin
{
    private IntervalUtil tracker = new IntervalUtil(0.1f, 0.2f);
   
    @Override
    public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
    {
        tracker.advance(amount);
       
        CombatEntityAPI target = beam.getDamageTarget();
        //Do we have a valid Entity to effect?
        if (target != null)
        {
            //Yes!  Is it in range, and the beam's on?
            if (beam.getBrightness() >= 1f)
            {
                if(tracker.intervalElapsed())
                {
                    float force = 0f;
                    Vector2f dir;

                    if(target instanceof ShipAPI)
                    {
                        ShipAPI ship = (ShipAPI) target;
                        ShipAPI source = beam.getSource();
                        ShipSystemAPI cloak = ship.getPhaseCloak();
                        if (cloak != null && cloak.isActive())
                        {
                                return;
                        }

                        if(ship != beam.getSource())
                        {
                            force = 15 - (source.getMass() /255);            
                     
                            dir = (Vector2f) VectorUtils.getDirectionalVector(beam.getSource(), target).scale(force);
                            Vector2f.add(source.getVelocity(), dir, source.getVelocity());
                        }
                    }
                    else
                    {
                        if(target != beam.getSource())
                        {
                            force = Math.max(1 / target.getMass() * 15000f, 0.01f);
                            dir = (Vector2f) VectorUtils.getDirectionalVector(beam.getSource(), target).scale(force);
                            Vector2f.add(target.getVelocity(), dir, target.getVelocity());     
                        }
                    }
                }
            }
        }
    }   
}
[close]

and it throws this crash error at me:
Spoiler
17070 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.plugins.Greifer_effect]
java.lang.RuntimeException: Error compiling [data.scripts.plugins.Greifer_effect]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: File 'data/scripts/plugins/Greifer_effect.java', Line 49, Column 79: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.combat.ShipAPI, com.fs.starfarer.api.combat.CombatEntityAPI"; candidates are: "public static org.lwjgl.util.vector.Vector2f org.lazywizard.lazylib.VectorUtils.getDirectionalVector(org.lwjgl.util.vector.Vector2f, org.lwjgl.util.vector.Vector2f)"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:226)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File 'data/scripts/plugins/Greifer_effect.java', Line 49, Column 79: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.combat.ShipAPI, com.fs.starfarer.api.combat.CombatEntityAPI"; candidates are: "public static org.lwjgl.util.vector.Vector2f org.lazywizard.lazylib.VectorUtils.getDirectionalVector(org.lwjgl.util.vector.Vector2f, org.lwjgl.util.vector.Vector2f)"
[close]

It would be great if anyone could help me get BGE up to date again, thanks in advance!
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

HELMUT

  • Admiral
  • *****
  • Posts: 1363
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3140 on: April 24, 2017, 11:53:31 AM »

I genuinely thought you were dead or something.

Glad i'm wrong, i hope to see your space crabs soon.
Logged

coyote.j.p.m

  • Ensign
  • *
  • Posts: 10
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3141 on: April 24, 2017, 12:15:55 PM »

Hello everyone!

I'm trying to revive my old mod again and get it to run with Starsector 0.8, problem is there's quite a lot of old code not working anymore.
I've got this script in particular:
Spoiler
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.VectorUtils;
import org.lazywizard.lazylib.MathUtils;
import org.lwjgl.util.vector.Vector2f;

public class Greifer_effect implements BeamEffectPlugin
{
    private IntervalUtil tracker = new IntervalUtil(0.1f, 0.2f);
   
    @Override
    public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
    {
        tracker.advance(amount);
       
        CombatEntityAPI target = beam.getDamageTarget();
        //Do we have a valid Entity to effect?
        if (target != null)
        {
            //Yes!  Is it in range, and the beam's on?
            if (beam.getBrightness() >= 1f)
            {
                if(tracker.intervalElapsed())
                {
                    float force = 0f;
                    Vector2f dir;

                    if(target instanceof ShipAPI)
                    {
                        ShipAPI ship = (ShipAPI) target;
                        ShipAPI source = beam.getSource();
                        ShipSystemAPI cloak = ship.getPhaseCloak();
                        if (cloak != null && cloak.isActive())
                        {
                                return;
                        }

                        if(ship != beam.getSource())
                        {
                            force = 15 - (source.getMass() /255);            
                     
                            dir = (Vector2f) VectorUtils.getDirectionalVector(beam.getSource(), target).scale(force);
                            Vector2f.add(source.getVelocity(), dir, source.getVelocity());
                        }
                    }
                    else
                    {
                        if(target != beam.getSource())
                        {
                            force = Math.max(1 / target.getMass() * 15000f, 0.01f);
                            dir = (Vector2f) VectorUtils.getDirectionalVector(beam.getSource(), target).scale(force);
                            Vector2f.add(target.getVelocity(), dir, target.getVelocity());     
                        }
                    }
                }
            }
        }
    }   
}
[close]

and it throws this crash error at me:
Spoiler
17070 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.plugins.Greifer_effect]
java.lang.RuntimeException: Error compiling [data.scripts.plugins.Greifer_effect]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: File 'data/scripts/plugins/Greifer_effect.java', Line 49, Column 79: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.combat.ShipAPI, com.fs.starfarer.api.combat.CombatEntityAPI"; candidates are: "public static org.lwjgl.util.vector.Vector2f org.lazywizard.lazylib.VectorUtils.getDirectionalVector(org.lwjgl.util.vector.Vector2f, org.lwjgl.util.vector.Vector2f)"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:226)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File 'data/scripts/plugins/Greifer_effect.java', Line 49, Column 79: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.combat.ShipAPI, com.fs.starfarer.api.combat.CombatEntityAPI"; candidates are: "public static org.lwjgl.util.vector.Vector2f org.lazywizard.lazylib.VectorUtils.getDirectionalVector(org.lwjgl.util.vector.Vector2f, org.lwjgl.util.vector.Vector2f)"
[close]

It would be great if anyone could help me get BGE up to date again, thanks in advance!

Just purely from looking at the error, it looks likethe VectorUtils.getDirectionalVector function from lazylib is expecting 2 Vector2f objects to be passed as parameters, rather than the currently passed ShipAPI and CombatEntityAPI objects. You can call getLocation() on these two parameters to get their coordinates to pass to the function instead.
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 592
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3142 on: April 24, 2017, 12:37:58 PM »

Thanks Coyote but I still don't really know how to do it now since I don't really understand coding and had a lot of help or codebashed a lot for BGE.

I think I would be better off if I could tell someone what my ships are intended to do and I would do art and animation ...

Edit: Everything I still got from BGE is a total mess btw, I really don't know anymore what would even be modifiable to work and what not.
Best would be to start from scratch I guess ...

Edit: Okay, I fixed that script I think.
But now I got this:
Spoiler
22128 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.AbstractMethodError
java.lang.AbstractMethodError
   at com.fs.starfarer.title.ooOO.o0oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO$Oo.?0000(Unknown Source)
   at com.fs.starfarer.combat.A.new.new(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.render(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
[close]
« Last Edit: April 24, 2017, 01:55:43 PM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3143 on: April 24, 2017, 02:49:10 PM »

I think I would be better off if I could tell someone what my ships are intended to do and I would do art and animation ...
Dammit, I would really like to help you with that but I do not have enough time to manage a 5th ( ! ) faction mod. I hope you find someone and good luck. (I'm still available if you need some animations here and there)
Logged
 

WKOB

  • Admiral
  • *****
  • Posts: 732
  • Odobenidine Benefactor
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3144 on: April 24, 2017, 03:50:31 PM »

Quote
Fatal: JSONObject["buildInWings"] is not a JSONArray.
Well, crap, I spent like 10 minutes trying to get the syntax right only for Starfarer to throw this at me. :D

So, is it possible to have multiple built-in wings? I'm only just now realizing there are no ships in Vanilla that have multiple built-in wings so... hoping that's not the case.
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3145 on: April 24, 2017, 06:57:48 PM »

first glance: it's "builtInWings", not "buildInWings"

failing that, paste the file and I'll have a look, it's definitely possible to have multiple built-in wings
Logged
mmm.... tartiflette

WKOB

  • Admiral
  • *****
  • Posts: 732
  • Odobenidine Benefactor
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3146 on: April 24, 2017, 08:36:07 PM »

Good catch, but thankfully that's only a typo here and not in the file. :D

Code
{
  "bounds": [
    -40.5,
    16,
    20.5,
    27,
    30,
    16,
    43.5,
    16,
    44,
    -26,
    -43.5,
    -24
  ],
  "builtInWeapons": {
    "WS0003": "armcom_fic_turret"
  },
  "center": [
    28.5,
    48
  ],
#    "builtInWings": {
#   "LB 1": "svolbergtdi_wing",
#   "LB 1": "svolbergtdi_rapid",
#   "LB 1": "svolbergtdi_missile",
#},
#    "main": [
#        39,
#        45
#  ],
  "collisionRadius": 75,
  "engineSlots": [
    {
      "angle": 180,
      "contrailSize": 30,
      "length": 30,
      "location": [
        -45.5,
        6
      ],
      "style": "LOW_TECH",
      "width": 10
    },
    {
      "angle": 180,
      "contrailSize": 30,
      "length": 30,
      "location": [
        -45.5,
        -16
      ],
      "style": "LOW_TECH",
      "width": 10
    }
  ],
  "height": 96,
  "hullId": "m3fic",
  "hullName": "Jacobson M3 FIC",
  "hullSize": "FRIGATE",
  "shieldCenter": [
    0,
    0
  ],
  "shieldRadius": 0,
  "spriteName": "graphics/ships/ARMCOM_FIC.png",
  "style": "MIDLINE",
  "viewOffset": 0,
  "weaponSlots": [
    {
      "angle": 0,
      "arc": 75,
      "id": "WS0001",
      "locations": [
        42,
        -3
      ],
      "mount": "HARDPOINT",
      "size": "SMALL",
      "type": "BALLISTIC"
    },
    {
      "angle": 0,
      "arc": 0,
      "id": "WS0002",
      "locations": [
        9,
        21
      ],
      "mount": "HARDPOINT",
      "size": "SMALL",
      "type": "MISSILE"
    },
    {
      "angle": 0,
      "arc": 360,
      "id": "WS0003",
      "locations": [
        -11,
        -10.5
      ],
      "mount": "TURRET",
      "size": "MEDIUM",
      "type": "BUILT_IN"
    },
    {
      "angle": 0,
      "arc": 360,
      "id": "LB 1",
      "locations": [
        -29,
        -25.5
      ],
      "mount": "HIDDEN",
      "size": "SMALL",
      "type": "LAUNCH_BAY"
    },
    {
      "angle": 40,
      "arc": 5,
      "id": "WS0004",
      "locations": [
        20.5,
        8
      ],
      "mount": "HIDDEN",
      "size": "SMALL",
      "type": "SYSTEM"
    },
    {
      "angle": 140,
      "arc": 0,
      "id": "WS0005",
      "locations": [
        -38.5,
        5
      ],
      "mount": "HIDDEN",
      "size": "SMALL",
      "type": "SYSTEM"
    }
  ],
  "width": 57
}
Logged

Buttery

  • Ensign
  • *
  • Posts: 49
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3147 on: April 24, 2017, 08:46:20 PM »

How would I go about fixing the placement of a weapon on a fighter? I've tried changing the weapon slot on the fighter itself and changing offsets thinking that might do it but so far none of them have worked.
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3148 on: April 24, 2017, 09:00:23 PM »

How would I go about fixing the placement of a weapon on a fighter? I've tried changing the weapon slot on the fighter itself and changing offsets thinking that might do it but so far none of them have worked.

You'll have to move the slot itself around manually. The slot has coordinates on the ship sprite relative to the ship's centrepoint. Are you using Trylobot's (or whoever-does-it-now's) Ship Editor to edit things?
Logged

Buttery

  • Ensign
  • *
  • Posts: 49
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3149 on: April 24, 2017, 09:06:58 PM »

How would I go about fixing the placement of a weapon on a fighter? I've tried changing the weapon slot on the fighter itself and changing offsets thinking that might do it but so far none of them have worked.

You'll have to move the slot itself around manually. The slot has coordinates on the ship sprite relative to the ship's centrepoint. Are you using Trylobot's (or whoever-does-it-now's) Ship Editor to edit things?

Yeah I am, and I've got it working now thanks for the help
Logged
Pages: 1 ... 208 209 [210] 211 212 ... 706