Modding Help Shortswords?

Discussion in 'Starbound Modding' started by vojta21212, May 11, 2018.

Tags:
  1. vojta21212

    vojta21212 Aquatic Astronaut

    So ive been mooding for a while now and im still amateur modder i programed some broadswords and it did pretty well. But then i wanted to program that sword from the original LoZ and i tried to do it. I copied "commonshortsword.activeitem" and changed some values then added recipe animation and added it to player config. After all the game crashed so im now posting my codes




    Activeitem



    {
    "itemName" : "Sword Of Legend",
    "price" : 600,
    "maxStack" : 1,
    "rarity" : "Rare",
    "description" : "It's dangerous to go alone. Take this!",
    "shortdescription" : "True sword of legend",
    "tooltipKind" : "sword",
    "category" : "shortsword",
    "twoHanded" : false,
    "itemTags" : ["weapon","melee","shortsword"],

    "animation" : "True.animation",
    "animationParts" : { },
    "animationCustom" : { },

    "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],

    "elementalType" : "physical",

    "primaryAbilityType" : "shortswordcombo",
    "primaryAbility" : {
    "fireTime" : [0.5, 0.67],
    "baseDps" : [6, 7]
    },

    "builder" : "/items/buildscripts/buildweapon.lua",
    "builderConfig" : [{
    "nameGenerator" : "shortswordnames.config:nameGen",
    "animationParts" : {
    "blade" : {
    "path" : "items/active/meele/shortsword/True.png",
    "variants" : 1,
    "paletteSwap" : false
    },
    "handle" : {
    "path" : "items/active/meele/shortsword/True.png",
    "variants" : 1,
    "paletteSwap" : false
    }
    },
    "altAbilities" : [ ],
    "palette" : "/items/active/weapons/colors/melee.weaponcolors",
    "iconDrawables" : [ "blade", "handle" ]
    }]





    Animation


    {
    "itemName" : "Sword Of Legend",
    "price" : 600,
    "maxStack" : 1,
    "rarity" : "Rare",
    "description" : "It's dangerous to go alone. Take this!",
    "shortdescription" : "True sword of legend",
    "tooltipKind" : "sword",
    "category" : "shortsword",
    "twoHanded" : false,
    "itemTags" : ["weapon","melee","shortsword"],

    "animation" : "True.animation",
    "animationParts" : { },
    "animationCustom" : { },

    "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],

    "elementalType" : "physical",

    "primaryAbilityType" : "shortswordcombo",
    "primaryAbility" : {
    "fireTime" : [0.5, 0.67],
    "baseDps" : [6, 7]
    },

    "builder" : "/items/buildscripts/buildweapon.lua",
    "builderConfig" : [{
    "nameGenerator" : "shortswordnames.config:nameGen",
    "animationParts" : {
    "blade" : {
    "path" : "items/active/meele/shortsword/True.png",
    "variants" : 1,
    "paletteSwap" : false
    },
    "handle" : {
    "path" : "items/active/meele/shortsword/True.png",
    "variants" : 1,
    "paletteSwap" : false
    }
    },
    "altAbilities" : [ ],
    "palette" : "/items/active/weapons/colors/melee.weaponcolors",
    "iconDrawables" : [ "blade", "handle" ]
    }]



    Recipe


    {
    "input" : [
    { "item" : "battery", "count" : 2 }
    ],
    "output" : { "item" : "Sword Of Legend", "count" : 1 },
    "groups" : [ "craftingseparator", "weapons", "all" ]
    }




    I hope it get solved.
     
  2. ToddAndChips

    ToddAndChips Tentacle Wrangler

    I'm a bit of an amateur as well, but I picked up a few things from the forum that might help you!

    Firstly, did you look in the Starbound log for errors? It often specifies in there what causes a crash or a loading error, so it's easier to track things down. It should be located here: steamapps\common\Starbound\storage\starbound.log

    At a quick glance it looks like there's an extra square bracket at the very end of the Animation section, maybe that has something to do with it? I'm not very good at reading the layout as it is though, so I could be mistaken.

    For future reference (and also potentially to edit the first post), if you put "CODE" in square brackets into your forum posts, then paste all your code, and then put "/CODE" in square brackets at the end, it'll appear like this:
    Code:
    {
    [ Hello,
    I am code!]
    }
    I believe it remembers formatting too (might be mistaken), but I personally find it a lot easier to read :)
    Btw, there's also a button at the top of the forum box, inside of the "Insert" button, that will allow you to add code in the same way.
     
  3. projectmayhem

    projectmayhem Spaceman Spiff

    For onee, your animation coding is the same as your activeitem coding. thats not good.
    you also have a lot of the coding for random weapons when you can do away with that.

    Here is how your activeitem file should look.
    Code:
    {
     
    "itemName" : "Sword Of Legend",
    "price" : 600,
    "maxStack" : 1,
     "level" : 5,
    "rarity" : "Rare",
    "description" : "It's dangerous to go alone. Take this!",
    "shortdescription" : "True sword of legend",
    "tooltipKind" : "sword",
    "category" : "shortsword",
    "twoHanded" : false,
    "itemTags" : ["weapon","melee","shortsword"],
    
      "inventoryIcon" : "True.png",
    
      "animation" : "True.animation",
      "animationParts" : {
        "handle" : "",
        "blade" : "True.png"
      },
      "animationCustom" : {
      },
    
      "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],
    
      "elementalType" : "physical",
    
    "primaryAbilityType" : "shortswordcombo",
      "primaryAbility" : {
        "fireTime" : 0.625,
        "baseDps" : 7.5
      },
    
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    

    your animation file should just be a modified shortswordcombo.animation file, if you really need a custom animation file. Whenever you are making specific weapons, its best to use specific weapons as a template. I used the ironshortsword.activeitem to make the one above, since its not random, its always the same. You also needed a level attribute at the top, this increases the power of the weapon when its not random.


    your animation file should look like this..

    Code:
    {
      "globalTagDefaults" : {
        "paletteSwaps" : ""
      },
    
      "animatedParts" : {
        "stateTypes" : {
          "swoosh" : {
            "default" : "idle",
            "states" : {
              "idle" : {
              },
              "fire" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "fire2" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              }
            }
          }
        },
    
        "parts" : {
          "blade" : {
            "properties" : {
              "zLevel" : 0,
              "centered" : true,
              "image" : "<partImage><paletteSwaps>?<bladeDirectives>",
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0, 0]
            }
          },
          "handle" : {
            "properties" : {
              "zLevel" : 1,
              "centered" : true,
              "image" : "<partImage><paletteSwaps>",
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0, 0]
            }
          },
          "swoosh" : {
            "properties" : {
              "zLevel" : -1,
              "centered" : true,
              "transformationGroups" : ["swoosh"],
              "rotationCenter" : [0, 0]
            },
    
            "partStates" : {
              "swoosh" : {
                "idle" : {
                  "properties" : {
                    "image" : ""
                  }
                },
                "fire" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/shortsword/swoosh/<elementalType>swoosh.png:<frame>",
                    "offset" : [1.0, 1.0],
                    "damageArea" : [ [-2.25, 1.125], [0.25, 1.125], [1.625, 0.75], [2.5, 0], [2.5, -0.5], [2.125, -0.875], [1, -1.375], [-2.25, -1.375] ]
                  }
                },
                "fire2" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/shortsword/swoosh2/<elementalType>swoosh.png:<frame>",
                    "offset" : [0.25, 0.125],
                    "damageArea" : [[-3, 1], [3, 1], [3, -1], [-3, -1]]
                  }
                }
              }
            }
          }
        }
      },
    
      "transformationGroups" : {
        "weapon" : {},
        "swoosh" : {}
      },
    
      "particleEmitters" : {
        "physicalswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "emissionRate" : 1,
          "burstCount" : 1,
          "particles" : []
        },
        "fireswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "emissionRate" : 50,
          "burstCount" : 4,
          "particles" : [
            { "particle" : "fireswoosh1"},
            { "particle" : "fireswoosh2"},
            { "particle" : "fireswoosh3"}
          ]
        },
        "electricswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "emissionRate" : 50,
          "burstCount" : 3,
          "particles" : [
            { "particle" : "electricswoosh1"},
            { "particle" : "electricswoosh2"},
            { "particle" : "electricswoosh2"}
          ]
        },
        "poisonswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "emissionRate" : 50,
          "burstCount" : 3,
          "particles" : [
            { "particle" : "poisonswoosh1"},
            { "particle" : "poisonswoosh2"},
            { "particle" : "fireswoosh2"}
          ]
        },
        "iceswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "emissionRate" : 50,
          "burstCount" : 3,
          "particles" : [
            { "particle" : "iceswoosh1"},
            { "particle" : "iceswoosh2"},
            { "particle" : "iceswoosh3"}
          ]
        }
      },
    
      "sounds" : {
        "fire" : [ ],
        "fire2" : [ ]
      }
    }
    
    And thats 100% vanilla code, you could even just keep the pathing in your activeitem to match the vanilla.
    "animation" : "/items/active/weapons/melee/shortsword/comboshortsword.animation",
     
  4. vojta21212

    vojta21212 Aquatic Astronaut

    Thank you!
     
  5. vojta21212

    vojta21212 Aquatic Astronaut

    And can i ask, is there a way to set like offset because my character is holding the sword like at the of handle
     
  6. projectmayhem

    projectmayhem Spaceman Spiff

    yeah, in the activeitem file we have the True.png under the "blade"
    So on the animation file, you would add "offset" : [0.0, 0.0],
    to this section

    "blade" : {
    "properties" : {
    "zLevel" : 0,
    "centered" : true,
    "image" : "<partImage><paletteSwaps>?<bladeDirectives>",
    "transformationGroups" : ["weapon"],
    "rotationCenter" : [0, 0]
    }
    },


    change the offset , login and see where it sits. If you dont like it, change it again, spawn a NEW weapon, and see where it sits. Keep going till you get it where you like.
     
  7. vojta21212

    vojta21212 Aquatic Astronaut

    Ok got it. Thanks
     
  8. FieryRuby75

    FieryRuby75 Scruffy Nerf-Herder

    Extremely helpful stuff M8!!!
     

Share This Page