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); In-development patch notes for Starsector 0.98a (2/8/25)

Author Topic: Creating weapon - like Sabot SMR, need assistance.  (Read 694 times)

Yaveton

  • Ensign
  • *
  • Posts: 7
    • View Profile
Creating weapon - like Sabot SMR, need assistance.
« on: November 03, 2023, 05:59:28 AM »

Hello!

I'm new to the modding in this game, I'm creating a mod for personal use tbh
 I got a ship that I like, that runs well with my faction idea, but I want to add a special weapon that I don't know how to handle.

I want it to basically launch a big tube into space, this tube should track for 4 seconds and then fire a Sabot SMR-like projectile.
I tried to copy and edit a bit the Sabot SMR missile, game returns null.

mk11.wpn (modified sabot.wpn)
{
   "id":"mk11",
   "specClass":"projectile",
   "type":"BALLISTIC",
   "size":"LARGE",
   #"turretSprite":"",
   #"hardpointSprite":"",
   "turretSprite":"graphics/weapons/mk11.png",
   "hardpointSprite":"graphics/weapons/mk11.png",   
   "hardpointOffsets":[15, -6, 15, 6, 15, 0],
   "turretOffsets":[8, -6, 8, 6, 8, 0],
   "hardpointAngleOffsets":[0, 0, 0],
   "turretAngleOffsets":[0, 0, 0],
   "barrelMode":"ALTERNATING",
   "animationType":"SMOKE",
   "renderHints":[RENDER_LOADED_MISSILES],
   "interruptibleBurst":false,
   "displayArcRadius":300,
   "smokeSpec":{"particleSizeMin":20.0,
             "particleSizeRange":20.0,
             "cloudParticleCount":1,
             "cloudDuration":1.0,
             "cloudRadius":10.0,
             "blowbackParticleCount":3,
             "blowbackDuration":2.0,
             "blowbackLength":30.0,
             "blowbackSpread":10.0,
             "particleColor":[100,100,100,200]},
   "projectileSpecId":"mk11a",
   "fireSoundTwo":"sabot_srm_fire",
}
mk11a.proj (modified sabot_srm)
{
   "id":"mk11",
   "specClass":"missile",   
   "missileType":"MIRV",
   "sprite":"graphics/missiles/mk11a.png",
   "size":[10,50],   
   "center":[5,25],
   "collisionRadius":50,
   "collisionClass":"MISSILE_NO_FF",
   "explosionColor":[255,165,0,255],  # purely visual, will get a white additively blended core on top of this color
   "explosionRadius":125, # purely visual
   "engineSpec":{"turnAcc":600,
              "turnRate":150,
              "acc":100,
              "dec":100},
   "engineSlots":[{"id":"ES1",
               "loc":[-50, 0],
                #"style":"MISSILE_MIDLINE",
                "style":"CUSTOM",
               "styleSpec":{
                  "mode":"QUAD_STRIP", # PARTICLES or QUAD_STRIP, determines which params are used
                  #"engineColor":[255,145,75,255],
                  "engineColor":[255,175,100,255],
                  "contrailDuration":1,
                  "contrailWidthMult":1,
                  "contrailWidthAddedFractionAtEnd":2,  # can be negative. makes trail spread out/narrow at the end
                  "contrailMinSeg":7, # min segment length, in pixels
                  "contrailMaxSpeedMult":.0f,
                  "contrailAngularVelocityMult":0.5f,
                  "contrailSpawnDistMult":.5, # how far away from engine it starts
                  "contrailColor":[100,100,100,150],
                   "glowSizeMult":1.5,
                  "type":"SMOKE" # GLOW or SMOKE; additive or regular blend mode
               },
                "width":8.0,
                "length":20.0,
                "angle":180.0}],
   "behaviorSpec":{"behavior":"MIRV",
               "splitRange":10000,
               "splitRangeRange":10000,
               "minTimeToSplit":4,
               "canSplitEarly":false,
               "splitSound":"sabot_srm_split",
               "numShots":1,
               "damage":2500,
               "emp":0, # needs to match highlight in weapon_data.csv
               "damageType":KINETIC,
               "hitpoints":500,
               "evenSpread":true,
               "arc":0,
               "spreadInaccuracy":0,
               #"spreadSpeed":0,
               "spreadSpeed":0,
               "spreadSpeedRange":5000,
               "projectileRange":10000, # only needed if not a missile
               "projectileSpec":"mk11b",
               "smokeSpec":{"particleSizeMin":20.0,
                         "particleSizeRange":20.0,
                         "cloudParticleCount":11,
                         "cloudDuration":1.0,
                         "cloudRadius":20.0,
                         "blowbackParticleCount":0,
                         "blowbackDuration":0,
                         "blowbackLength":0,
                         "blowbackSpread":0,
                         "particleColor":[100,100,100,200]}
               }               
}

mk11b.proj (modified sabot_warhead)
{
   "id":"mk11b",
   "specClass":"missile",   
   "missileType":"NO_AI",
   #"missileType":"ROCKET",
   "sprite":"graphics/missiles/missile_sabot_warhead.png",
   "glowColor":[255,200,100,40],
   "glowRadius":30,
   "size":[10,50],   
   "center":[5,25],
   "collisionRadius":12,
   "collisionClass":"PROJECTILE_FIGHTER",
   "collisionClassAfterFlameout":"PROJECTILE_FIGHTER",
   "explosionColor":[235,255,215,195],  # purely visual, will get a white additively blended core on top of this color
   "explosionRadius":75, # purely visual
   "maxFlightTime":1,
   "engineSpec":{"turnAcc":240,
              "turnRate":240,
              "maxSpeed":270,
              "acc":0,
              "dec":0},
#   "engineSlots":[{"id":"ES1",
#               "loc":[-7, 0],
#               "style":"CUSTOM",
#               "styleSpec":{
#                  "mode":"QUAD_STRIP", # PARTICLES or QUAD_STRIP, determines which params are used
#                  "engineColor":[255,255,255,0],
#                  "contrailDuration":1,
#                  "contrailWidthMult":1,
#                  "contrailWidthAddedFractionAtEnd":0,  # can be negative. makes trail spread out/narrow at the end
#                  "contrailMinSeg":15, # min segment length, in pixels
#                  "contrailMaxSpeedMult":0,
#                  "contrailAngularVelocityMult":0,
#                  "contrailColor":[255,255,255,255],
#                  "type":"SMOKE" # GLOW or SMOKE; additive or regular blend mode
#               },
#                "width":2.0,
#                "length":0.0,
#                "angle":180.0}]
   #"engineSlots":[{"id":"ES1",
   #            "loc":[-7, 0],
   #             "style":"MISSILE_MIDLINE",
   #             "width":4.0,
   #             "length":20.0,
   #             "angle":180.0}]               
}

mk11c (modified sabot_warhead2)
{
   "id":"mk11c",
   "specClass":"projectile",
   "onHitEffect":"com.fs.starfarer.api.impl.combat.SabotOnHitEffect",
   "spawnType":"BALLISTIC",
   "collisionClass":"PROJECTILE_FIGHTER",
   "collisionClassByFighter":"PROJECTILE_FIGHTER",
   #"glowColor":[235,255,215,90],
   "glowColor":[175,200,255,90],
   "glowRadius":25,
   #"glowColor":[255,200,100,30],
   #"glowRadius":20,
   "length":50.0,
   "width":3.5,
   "hitGlowRadius":35,
   "fadeTime":0.1,
   "fringeColor":[200,225,255,125],
   "coreColor":[255,255,255,255],   
   "textureScrollSpeed":64.0,
   "pixelsPerTexel":5.0,
   "bulletSprite":"graphics/missiles/missile_sabot_warhead.png",
}



LOG
11224 [Thread-3] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading JSON from [DIRECTORY: C:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\ATTBehemoth (data\weapons\mk11.wpn)]
11267 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
        at com.fs.starfarer.loading.specs.N.setProjectileSpec(Unknown Source)
        at com.fs.starfarer.loading.WeaponSpecLoader.new(Unknown Source)
        at com.fs.starfarer.loading.WeaponSpecLoader.new(Unknown Source)
        at com.fs.starfarer.loading.SpecStore.public(Unknown Source)
        at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
        at com.fs.state.AppDriver.begin(Unknown Source)
        at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
        at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
        at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:748)
I want it to be on Ballistic Large spot, but act as missiles



« Last Edit: November 03, 2023, 07:41:39 AM by Yaveton »
Logged

Yaveton

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Creating weapon - like Sabot SMR, need assistance.
« Reply #1 on: November 03, 2023, 06:24:35 AM »

I added what was written here into first post
« Last Edit: November 03, 2023, 07:40:10 AM by Yaveton »
Logged

Yaveton

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Creating weapon - like Sabot SMR, need assistance.
« Reply #2 on: November 03, 2023, 07:15:12 AM »

Seems tagms in weapons_daya.csv might cause problem, and sabot_smr modified file, as i can't get it to work as in Sabot SRM
« Last Edit: November 03, 2023, 07:40:54 AM by Yaveton »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4976
    • View Profile
    • GitHub profile
Re: Creating weapon - like Sabot SMR, need assistance.
« Reply #3 on: November 03, 2023, 08:43:04 AM »

Unless you've already changed it: Weapon is looking for a projectile with ID mk11a, but the ID specified in file mk11a.proj is just mk11. Change the mk11a projectile to have the correct ID.
Logged

Yaveton

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Creating weapon - like Sabot SMR, need assistance.
« Reply #4 on: November 03, 2023, 10:09:21 AM »

... I am going to scream, yes, that's it... thanks...
Logged