Modding Help Need help with custom particles (& ability) on a weapon.

Discussion in 'Starbound Modding' started by Danger Noodle, Oct 21, 2018.

  1. Danger Noodle

    Danger Noodle Poptop Tamer

    Hi! So essentially someone suggested that i create elemental flamethrowers, so instead of shooting fire, something like lightning bolts, and thats what im trying to do. Thing is, I cant get it to work. The gun will spawn, but won't follow the cursor/rotate/move at all other than flip to face the direction the character is facing. Not only that, the starbound.log file is giving me this error:

    "[Error] Exception while calling script init: (LuaException) Error code 2, [string "/items/active/weapons/weapon.lua"]:308: bad argument #1 to 'for iterator' (table expected, got nil)
    stack traceback:
    [C]: in ?
    [C]: in for iterator 'for iterator'
    [string "/items/active/weapons/weapon.lua"]:308: in function <[string "/items/active/weapons/weapon.lua"]:307>
    (...tail calls...)
    [string "/items/active/weapons/ranged/gun.lua"]:14: in function <[string "/items/active/weapons/ranged/gun.lua"]:5>"

    I have no idea what im meant to do here. If the files need to provided i can provide them, but as a heads up i have already checked the JSON files with jsonlint and have re-read the files multiple times. Since this is a flamethrower, the particles are linked to the primary ability (being a flamethrower) and if i set the primary ability back to the default "flamethrower" it works fine, so obviously something is wrong with my projectile files or the ability files.
     
  2. The Avelon

    The Avelon Phantasmal Quasar

    So the error is happening in gun.lua's init. The primaryAbility variable doesn't store the weapon's elementalType from the .activeitem file; the secondaryAbility does. This may be what is causing your error. You can probably best solve this by creating a copy of gun.lua, naming it something like dangernoodlegun.lua, and adding the elemental storage parameter to it. Point your guns to this Lua file instead of gun.lua.
     
  3. Danger Noodle

    Danger Noodle Poptop Tamer

    Thanks for the response! So far I understand what you're saying I should do and I get the issue now, but I still only know the very basics of coding the .lua files. I've messed around with the files after reading this but I haven't been able to get anything to work. I'll provide the files below so you can see what i've done so far. I undid the stuff i changed just to make it clearer.
     

    Attached Files:

Share This Page