Modding Help I can't find any info on this error anywhere...

Discussion in 'Starbound Modding' started by Zalerias, Jan 27, 2016.

  1. Zalerias

    Zalerias Yeah, You!

    Sorry if the solution is simple and I just haven't noticed it yet, but I've been dipping my toes into creating custom weapons for myself and a friend of mine, and I've cannibalized information from the vanilla assets as well as a variety of tutorials and forum posts not unlike this one I am posting now... this will probably look rather sloppy but...


    Code:
    {
      "itemName" : "custombroadsword",
      "price" : 1,
      "level" : 6,
      "maxStack" : 1,
      "rarity" : "common",
      "description" : "custombroadsword",
      "shortdescription" : "custombroadsword",
      "tooltipKind" : "sword",
      "weaponType" : "Broadsword",
      "twoHanded" : true,
      "itemTags" : ["weapon","melee","broadsword"],
    
      "inventoryIcon" : "custombroadsword.png",
    
      "animation" : "/items/active/weapons/melee/broadsword/tieredbroadsword.animation",
      "animationParts" : {
      "sword" : "/items/active/weapons/melee/broadsword/customrace/custombroadsword.png"
      },
      "animationCustom" : {
      "sounds" : {
      "fire" : [ "/sfx/melee/swing_broadsword_fire3.ogg" ]
      }
      },
    
      "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],
    
      "elementalType" : "fire",
    
      "primaryAttack" : {
      "fireTime" : 0.83,
      "baseDps" : 15,
      "damageConfig" : {
      "damageSourceKind" : "broadsword",
      "statusEffects" : [ ],
      "knockback" : 20,
      "knockbackMode" : "facing",
      "timeoutGroup" : "primary"
      }
      },
    
      "baseWeaponRotation" : 10,
      "stances" : {
      "idle" : {
      "armRotation" : -90,
      "weaponRotation" : -10,
      "allowRotate" : false,
      "allowFlip" : true
      },
      "windup" : {
      "duration" : 0.1,
      "armRotation" : 90,
      "weaponRotation" : -10,
      "twoHanded" : true,
    
      "allowRotate" : false,
      "allowFlip" : true
      },
      "preslash" : {
      "duration" : 0.025,
      "armRotation" : 55,
      "weaponRotation" : -45,
      "twoHanded" : true,
    
      "allowRotate" : false,
      "allowFlip" : false
      },
      "fire" : {
      "duration" : 0.4,
      "armRotation" : -45,
      "weaponRotation" : -55,
      "twoHanded" : true,
    
      "allowRotate" : false,
      "allowFlip" : false
      }
      },
    
    
      "altAbilitySource" : "/items/active/weapons/melee/altabilities/broadsword/travelingslash/travelingslash.altability",
    
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    Here is the error message:

    Code:
    [00:00:14.889] Error: Could not instantiate item '[dragonbuster, 1, {}]'. (LuaException) Error code 2, [string "/scripts/util.lua"]:374: bad argument #1 to 'pairs' (table expected, got nil)
    The error pops up twice for some reason... And I have seen this error message on another post where someone was looking to make custom weapons, but the suggestions they recieved did not help me.

    I ran it through JSON Validation and it checked out, but running it through the "repl.it - Lua" language checker yielded this odd error message.

    [string "stdin"]:1: unexpected symbol near '{'attempt to call a nil value

    I don't know what this is all about, but that line it has a problem with is exactly the same as my perfectly working mods... So I am at a loss, I'd greatly appreciate it if someone were to help me out. Maybe point me in the direction of a more up-to-date guide to making weapon mods?


    Note: I have tried a few combinations for element types since I wasn't sure what it could be, those include "Ember", "firebroadsword" and "firebroadsword.damage".
     
  2. Zalerias

    Zalerias Yeah, You!

    (now that I fixed the emoticons I'll change this post to include some more info on what's going on.)

    The game doesn't crash by the way, the item just turns into a PGI in the crafting menu, and when I spawn it in.
     
    Last edited: Jan 27, 2016
  3. Owl_Stalker

    Owl_Stalker Guest

    Don't you need two images in animationParts, "blade" and "handle"?
     
  4. Zalerias

    Zalerias Yeah, You!

    That only seemed to be the case for the randomly generated? I am not really sure. None of the racial weapons that have abilities are like that either.
     
  5. lazarus78

    lazarus78 The Waste of Time

    Is your weapon's alt ability an elemental one? I hit this issue by putting an elemental based ability on a weapon whos damage type was not elemental. Thus the "bad pairs" error. I do see you set the damage as fire, but does the alt ability have the necessary bits for a "fire" version of it?
     
  6. Zalerias

    Zalerias Yeah, You!

    I didn't consider that inside the travelingslash altability file that there might be other elements keyed into it, but I opened it up just now and if that is the case I am not sure what the keywords would be? I only see sfx for different elements, and swoosh of different elements, the ability itself is only listed as flying slash/travelingslash... here's the code for it, maybe that'll help figure out what I'm missing?


    Code:
    {
      "animationParts" : { },
      "animationCustom" : {
        "sounds" : {
          "fireTravelSlash" : [ "/sfx/melee/travelingslash_fire1.ogg" ],
          "iceTravelSlash" : [ "/sfx/melee/travelingslash_ice2.ogg" ],
          // "electricTravelSlash" : [ "/sfx/melee/travelingslash_electric1.ogg", "/sfx/melee/travelingslash_electric2.ogg", "/sfx/melee/travelingslash_electric3.ogg" ],
          "electricTravelSlash" : [ "/sfx/melee/travelingslash_electric4.ogg" ],
          "poisonTravelSlash" : [ "/sfx/melee/travelingslash_poison2.ogg" ]
        }
      },
    
      "altAbility" : {
        "name" : "Flying Slash",
        "type" : "travelingslash",
        "scripts" : ["/items/active/weapons/melee/altabilities/broadsword/travelingslash/travelingslash.lua"],
    
        "projectileOffset" : [0,0],
        "elementalConfig" : {
          "fire" : {
            "projectileType" : "firetravelingswoosh"
          },
          "ice" : {
            "projectileType" : "icetravelingswoosh"
          },
          "poison" : {
            "projectileType" : "poisontravelingswoosh"
          },
          "electric" : {
            "projectileType" : "electrictravelingswoosh"
          }
        },
    
        "baseDamage" : 7,
        "energyUsage" : 120,
        "cooldownTime" : 1.5,
    
        "stances" : {
          "windup" : {
            "duration" : 0.25,
            "armRotation" : 70,
            "weaponRotation" : 0,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : false
          },
          "fire" : {
            "duration" : 0.4,
            "armRotation" : -45,
            "weaponRotation" : -55,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : false
          }
        }
      }
    }
     
  7. lazarus78

    lazarus78 The Waste of Time

    Found it:

    On your weapon, the line "damageSourceKind" : "broadsword", needs to be "damageSourceKind" : "<elementalType>broadsword",




    Also a point of nitpick about Chucklefish's design choice...

    They include the line "baseWeaponRotation" : 10, which applies a 10 degree rotation by default, then later, they have "weaponRotation" : -10, which just undoes the base rotation... its redundant, and they have things like this ALL over the game assets.
     
  8. Zalerias

    Zalerias Yeah, You!

    Didn't fix it, still getting that luaexception error, and the item is still a PGI. I've been scratching my head at this problem for over 24 hours straight, I know if I ever figure out what the heck the problem is, I can fix it, do I need some kind of secondary file for lua or something? I've only really figured out how to do JSON files and do what I have posted up top. And most of what I put together was copied from a post you made. x'D
     
  9. lazarus78

    lazarus78 The Waste of Time

    Wait... change <elementalType> to fire...

    Sorry, Im working off random generated weapons. :rofl:
     
  10. Zalerias

    Zalerias Yeah, You!

    Oh, apparently I had it saved as ember, changed it to fire and now the lua exception error is gone, but now I have two other errors...


    [14:09:22.571] Error: Could not load image asset '/items/active/weapons/melee/broadsword/customrace/custombroadsword.png', using placeholder default.
    (AssetException) No such asset '/items/active/weapons/melee/broadsword/customrace/custombroadsword.png'

    and

    [14:09:22.572] Error: Could not instantiate item '[custombroadsword, 1, {}]'. (JsonException) No such key in Json::get("firePosition")

    have no idea what this one could mean, I thought it might have meant the


    "fire" : {
    "duration" : 0.4,
    "armRotation" : -45,
    "weaponRotation" : -55,
    "twoHanded" : true,

    "allowRotate" : false,
    "allowFlip" : false
    }

    but removing that didn't fix it so I put it back.
     
    Last edited: Jan 27, 2016
  11. lazarus78

    lazarus78 The Waste of Time

    Well the first error is self explanatory. Your file path for the sword image must be wrong.

    Here is what I have and tested:
    Code:
    {
        "itemName" : "TACO",
        "price" : 1,
        "level" : 6,
        "maxStack" : 1,
        "rarity" : "common",
        "description" : "custombroadsword",
        "shortdescription" : "custombroadsword",
        "tooltipKind" : "sword",
        "weaponType" : "Broadsword",
        "twoHanded" : true,
        "itemTags" : ["weapon","melee","broadsword"],
    
        "inventoryIcon" : "FabricantSword.png",
    
        "animation" : "/items/active/weapons/melee/broadsword/tieredbroadsword.animation",
        "animationParts" : {
            "sword" : "/items/active/fabricant/FabricantSword.png"
        },
        "animationCustom" : {
            "sounds" : {
                "fire" : [ "/sfx/melee/swing_broadsword_fire3.ogg" ]
                }
        },
    
        "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],
    
        "elementalType" : "fire",
    
        "primaryAttack" : {
            "fireTime" : 0.83,
            "baseDps" : 15,
            "damageConfig" : {
                "damageSourceKind" : "firebroadsword",
                "statusEffects" : [ ],
                "knockback" : 20,
                "knockbackMode" : "facing",
                "timeoutGroup" : "primary"
            }
        },
    
        "baseWeaponRotation" : 10,
        "stances" : {
            "idle" : {
                "armRotation" : -90,
                "weaponRotation" : -10,
                "allowRotate" : false,
                "allowFlip" : true
            },
            "windup" : {
                "duration" : 0.1,
                "armRotation" : 90,
                "weaponRotation" : -10,
                "twoHanded" : true,
    
                "allowRotate" : false,
                "allowFlip" : true
            },
            "preslash" : {
                "duration" : 0.025,
                "armRotation" : 55,
                "weaponRotation" : -45,
                "twoHanded" : true,
    
                "allowRotate" : false,
                "allowFlip" : false
            },
            "fire" : {
                "duration" : 0.4,
                "armRotation" : -45,
                "weaponRotation" : -55,
                "twoHanded" : true,
    
                "allowRotate" : false,
                "allowFlip" : false
            }
        },
    
        "altAbilitySource" : "/items/active/weapons/melee/altabilities/broadsword/travelingslash/travelingslash.altability",
    
        "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    
    Made some changes to fit what I have on my end.


    On an additional note, the absolute file paths are only necessary if the file you are referencing is NOT in the same one as the weapon file. IE the sword graphic can be just the name of the image without the long file path. IE "
    custombroadsword.png"
     
  12. Zalerias

    Zalerias Yeah, You!

    I don't know how I got the image location wrong, and using your code there and changing it around a bit I fixed those two errors, but now I have yet another one...

    Code:
    [14:49:34.295] Error: Could not instantiate item '[custombroadsword, 1, {}]'. (ItemException) No such item 'custombroadsword'
    Now, if I just made it, then how does it not exist? is the item ID supposed to be of an existing item or did I screw up somewhere else? as far as I can tell the way I've set up the rest of the mod SHOULD create a new item and a recipe for said item... Sorry if I am taking up a lot of your time here, just trying to get this fixed, once I've got this down I should be able to make just about anything out of it...
     
  13. lazarus78

    lazarus78 The Waste of Time

    could you pack it up so I could test it exactly as you have it?
     
  14. Zalerias

    Zalerias Yeah, You!

    How exactly do I go about sending it to you? And just a warning, it's a bit messy, I was planning to clean out unnecssary files after I got it working, kinda just drag and dropped anything that sounded like it could be needed... and the naming will probably sound a bit lame, I was trying to hide that... And I use models from another mod, figured that would be fine since I wasn't intending to distribute it, and the mod doesn't seem to get updated anymore, it's only going to be for my personal use...

    Edit: Tried the "upload a file" button, won't take .rar files or the packed mod, so...?
     
    Last edited: Jan 27, 2016
  15. lazarus78

    lazarus78 The Waste of Time

    upload it to like mediafire or dropbox.
     
  16. Zalerias

    Zalerias Yeah, You!

  17. lazarus78

    lazarus78 The Waste of Time

    No worried, Sometimes the simple solution is the last thought.

    Ill get back to you with what I find.
     
  18. Zalerias

    Zalerias Yeah, You!

    Alright, thank you very much for the help so far. Hopefully you can fix it, and my friend and I can play around with modding our own custom weapons. x'3
     
  19. lazarus78

    lazarus78 The Waste of Time

    Ok, first thing I notice is this mod includes a lot of vanilla things such as the build scripts. This is completely unnecessary and can even be problematic. If they change for any reason, even an official update, then this mod will overwrite them. You should only include what is necessary.

    Second - Your sword file needs to have the extension "activeitem" and not "sword".

    Third - On this part:
    Code:
    "animationParts" : {
            "sword" : "/items/active/fabricant/sword/Dragonbuster.png"
        },
    
    ... needs to be this instead...

    Code:
    "animationParts" : {
            "blade" : "/items/active/fabricant/sword/Dragonbuster.png"
        },
    
    Fourth - Your sword image is called Dragonbuster.png.png <-- Notice the 2 file extensions.
     
  20. Zalerias

    Zalerias Yeah, You!

    That's weird, dunno why the image is like that... the rest I simply had no idea due to the overwhelming lack of information of modded weapons with abilities.

    And I've tried to remove the build scripts but the file becomes invalid when I do, haven't been able to figure out how to remove it safely.
     

Share This Page