Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: manictiger on January 16, 2019, 11:53:35 PM

Title: JSONArray[1] not found.
Post by: manictiger on January 16, 2019, 11:53:35 PM
My mod seems to have broken something I don't understand.  I wanted to make a weapon with a textured beam like so:
Spoiler
{
   "specClass":"beam",
   "id":"altca_helicalph",
   "type":"ENERGY",
   "size":"MEDIUM",
   "collisionClass":"RAY",
   "collisionClassByFighter":"RAY_FIGHTER",
   "turretSprite":"graphics/weapons/altca_helicalph_turret_base.png",
   "turretGlowSprite":"graphics/weapons/graphics/weapons/altca_helicalph_turret_glow.png",
   "hardpointSprite":"graphics/weapons/altca_helicalph_hardpoint_base.png",
   "hardpointGlowSprite":"graphics/weapons/altca_helicalph_hardpoint_glow.png",
   "turretOffsets":[30, 0],
   "turretAngleOffsets":[0],
   "hardpointOffsets":[30, 0],
   "hardpointAngleOffsets":[0],
   "fringeColor":[0,0,155,1],
   "coreColor":[255,255,255,1],
   "glowColor":[100,100,255,1],
   #"fringeColor":[0,155,0,255],
   #"coreColor":[255,255,255,255],
   #"glowColor":[100,255,100,255],
   "width":30.0,
   "textureType":["graphics/missiles/altca_helicalph_shell.png"],
   "textureScrollSpeed":50.0,
   "pixelsPerTexel":5.0,
   "pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER],
   "fireSoundOne":"altca_helicalph_fire",
}
[close]

sounds.json looks like this:
Spoiler
{
    # CDM Cannon
    "altca_dualcdm_fire":[
      {"file":"sounds/sfx_wpn_energy/altca_dualcdm_fire_01_loud.ogg","pitch":1,"volume":0.7},
      {"file":"sounds/sfx_wpn_energy/altca_dualcdm_fire_01_loud.ogg","pitch":1.05,"volume":0.7},
      {"file":"sounds/sfx_wpn_energy/altca_dualcdm_fire_02_loud.ogg","pitch":0.95,"volume":0.7},
   ],

    # Helical Phase CIWS
    "altca_helicalph_fire":[
      {"file":"sounds/sfx_wpn_energy/aaltca_helicalph_fire.ogg","pitch":1,"volume":0.7},
      {"file":"sounds/sfx_wpn_energy/altca_helicalph_fire.ogg","pitch":1.03,"volume":0.7},
      {"file":"sounds/sfx_wpn_energy/altca_helicalph_fire.ogg","pitch":0.97,"volume":0.7},
   ],
}
[close]

Something is causing this:
Spoiler
6809 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - org.json.JSONException: JSONArray[1] not found.
org.json.JSONException: JSONArray[1] not found.
   at org.json.JSONArray.get(JSONArray.java:204)
   at org.json.JSONArray.getString(JSONArray.java:327)
   at com.fs.starfarer.loading.WeaponSpecLoader.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.WeaponSpecLoader.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.SpecStore.while(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$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
[close]

It could be something else, but I think it's something related to altca_helicalph.
Title: Re: JSONArray[1] not found.
Post by: Morathar on January 17, 2019, 06:36:00 AM
It looks like there's a typo in sounds.json (aaltca_helicalph_fire.ogg instead of altca_helicalph_fire.ogg):

Code
      {"file":"sounds/sfx_wpn_energy/aaltca_helicalph_fire.ogg","pitch":1,"volume":0.7},
Title: Re: JSONArray[1] not found.
Post by: manictiger on January 17, 2019, 10:32:51 AM
It looks like there's a typo in sounds.json (aaltca_helicalph_fire.ogg instead of altca_helicalph_fire.ogg):

Code
      {"file":"sounds/sfx_wpn_energy/aaltca_helicalph_fire.ogg","pitch":1,"volume":0.7},


Alright, fixed it and it's still broken.  Same error about JSONArray[1].
Title: Re: JSONArray[1] not found.
Post by: Morathar on January 17, 2019, 01:52:32 PM
Well, this line in the main weapon file also looks suspicious (graphics/weapons is in there twice):

Code
   "turretGlowSprite":"graphics/weapons/graphics/weapons/altca_helicalph_turret_glow.png",
Title: Re: JSONArray[1] not found.
Post by: manictiger on January 17, 2019, 02:33:13 PM
Well, this line in the main weapon file also looks suspicious (graphics/weapons is in there twice):

Fixed that, too.  Finally got the JSON error to go away.  It still won't render the textured beam, but I got it to stop crashing with this:
   "textureType":["graphics/fx/altca_helicalph_shell.png","graphics/fx/altca_helicalph_shell.png"],

So now the problem is, the texture doesn't show up, in-game.  :/

Edit:
Well, slap me silly!  I needed the texture to be turned 90 degrees!  FIXED!