Modding Help Fixing altability code for Cheerful Giraffe

Discussion in 'Starbound Modding' started by L3W, Feb 27, 2016.

  1. L3W

    L3W Ketchup Robot

    Alright so this thread is to help anyone who is having trouble with altabilies like I did. I even added the new bow.activeitem code as an example as well. I will leave this up just in case any other modders have any questions.
     
    Last edited: Mar 2, 2016
  2. lazarus78

    lazarus78 The Waste of Time

    Weapons changed in format a little. Compare your weapons with the new ones.
     
  3. L3W

    L3W Ketchup Robot

    I did compare them and I still can't seem to figure it out. I don't get what they changed and it is kind of frustrating. I guess I should show what my code is if I want any help.

    EDIT: I fixed the demisesword.activeitem code below thanks to @lazuras78 and his suggestions!

    Code for the demisesword.activeitem file (based off of the rarebroadsword.activeitem)

    Code:
    
    {
      "itemName" : "demisesword",
      "price" : 170,
      "level" : 4,
      "maxStack" : 1,
      "rarity" : "legendary",
      "description" : "Blade of Demise! Said to once had been Ghirahim.",
      "shortdescription" : "Demise Sword",
      "tooltipKind" : "sword",
      "weaponType" : "Broadsword",
      "twoHanded" : true,
      "itemTags" : ["weapon","melee","broadsword"],
    
      "inventoryIcon" : "demisesword.png",
    
      "animation" : "/items/active/weapons/melee/broadsword/demisesword/demisesword.animation",
      "animationParts" : {
        "handle" : "",
        "blade" : "demisesword.png"
      },
      "animationCustom" : {
        "sounds" : {
          "fire" : [ "/sfx/melee/swing_broadsword_electric1.ogg" ]
        }
      },
    
      "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],
    
      "elementalType" : "electric",
    
      "primaryAbility" : {
        "scripts" : ["/items/active/weapons/melee/meleeslash.lua"],
        "class" : "MeleeSlash",
    
        "fireTime" : 0.83,
        "baseDps" : 11,
        "damageConfig" : {
          "damageSourceKind" : "broadsword",
          "statusEffects" : [ "electrified" ],
          "knockback" : 25,
          "knockbackMode" : "facing",
          "timeoutGroup" : "primary"
        },
    
        "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
          }
        }
      },
      "palette" : "/items/active/weapons/colors/melee.weaponcolors",
    
      "altAbilitySource" : "/items/active/weapons/melee/altabilities/broadsword/travelingslash/travelingslash.altability",
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    
    
    *Note I like to use custom .animation files like the demisesword.animation file*
     
    Last edited: Mar 2, 2016
  4. lazarus78

    lazarus78 The Waste of Time

    Check out everything between primaryAttack to palette.

    Example:
    Code:
    {
      "itemName" : "timepierce",
      "price" : 170,
      "level" : 4,
      "maxStack" : 1,
      "rarity" : "Legendary",
      "description" : "This blade can pierce through the fabric of time itself.",
      "shortdescription" : "Time Pierce",
      "tooltipKind" : "sword",
      "weaponType" : "Broadsword",
      "twoHanded" : true,
      "itemTags" : ["weapon","melee","broadsword"],
    
      "inventoryIcon" : "timepierce.png",
    
      "animation" : "/items/active/weapons/melee/broadsword/timepierce.animation",
      "animationParts" : {
        "handle" : "",
        "blade" : "timepierce.png"
      },
      "animationCustom" : {
        "sounds" : {
          "fire" : [ "/sfx/melee/swing_broadsword.ogg" ]
        }
      },
    
      "scripts" : ["/items/active/weapons/melee/meleeweapon.lua"],
    
      "elementalType" : "physical",
    
      "primaryAbility" : {
        "scripts" : ["/items/active/weapons/melee/meleeslash.lua"],
        "class" : "MeleeSlash",
    
        "fireTime" : 0.83,
        "baseDps" : 11,
        "damageConfig" : {
          "damageSourceKind" : "broadsword",
          "statusEffects" : [ ],
          "knockback" : 25,
          "knockbackMode" : "facing",
          "timeoutGroup" : "primary"
        },
    
        "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
          }
        }
      },
    
      "altAbility" : {
        "scripts" : ["/items/active/weapons/melee/meleeslash.lua"],
        "class" : "MeleeSlash",
    
        "elementalType" : "time",
    
        "fireTime" : 1.5,
        "baseDps" : 7.6,
        "energyUsage" : 80.0,
        "damageConfig" : {
          "damageSourceKind" : "broadsword",
          "statusEffects" : [ "timeslow" ],
          "knockback" : 40,
          "knockbackMode" : "facing",
          "timeoutGroup" : "primary"
        },
    
        "fireSound" : "altFire",
    
        "stances" : {
          "idle" : {
            "armRotation" : -90,
            "weaponRotation" : -10,
            "allowRotate" : false,
            "allowFlip" : true
          },
          "windup" : {
            "duration" : 0.333,
            "armRotation" : 90,
            "weaponRotation" : -90,
            "armAngularVelocity" : -1080,
            "twoHanded" : true,
    
            "animationStates" : {
              "alt" : "windup"
            },
    
            "allowRotate" : false,
            "allowFlip" : true
          },
          "fire" : {
            "duration" : 0.5,
            "armRotation" : -45,
            "weaponRotation" : -55,
            "twoHanded" : true,
    
            "animationStates" : {
              "alt" : "fire"
            },
    
            "allowRotate" : false,
            "allowFlip" : false
          }
        }
      },
    
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    
    
     
    L3W likes this.
  5. L3W

    L3W Ketchup Robot

    Alright the broadswords are fixed (for now). I need to fix the spear and hammer.activeitem files. The only problem is I don't know if the spears need an .animation file now.

    EDIT: I fixed the code shown below. So, if you are trying to figure out how the new spear code works then I hope this helps!

    The code is based on the rarespear.activeitem file.

    Code:
    
    {
      "itemName" : "ganontrident",
      "price" : 160,
      "level" : 6,
      "maxStack" : 1,
      "rarity" : "legendary",
      "description" : "The Ultimate Weapon of Darkness.",
      "shortdescription" : "Ganon Trident",
      "tooltipKind" : "sword",
      "weaponType" : "Spear",
      "twoHanded" : true,
      "itemTags" : ["weapon","melee","spear"],
    
      "inventoryIcon" : "ganontrident.png",
    
      "animation" : "/items/active/weapons/melee/spear/ganontrident/ganontrident.animation",
      "animationParts" : {
        "handle" : "",
        "blade" : "ganontrident.png"
      },
      "animationCustom" : {
        "sounds" : {
          "fire" : [ "/sfx/melee/swing_spear_fire1.ogg" ]
        }
      },
    
      "scripts" : ["/items/active/weapons/melee/spear/spear.lua"],
    
      "elementalType" : "fire",
    
      "aimOffset" : -1.0,
      "primaryAbility" : {
        "scripts" : ["/items/active/weapons/melee/spear/spear.lua"],
        "class" : "SpearStab",
    
        "fireTime" : 0.9,
        "baseDps" : 11.11,
        "damageConfig" : {
          "damageSourceKind" : "spear",
          "statusEffects" : [ "burning" ],
          "knockbackMode" : "aim",
          "knockback" : 30,
          "timeoutGroup" : "primary"
        },
        "allowHold" : false,
        "holdDamageMultiplier" : 0.1,
        "holdDamageConfig" : {
          "timeoutGroup" : "hold",
          "timeout" : 0.5
        },
        "stances" : {
          "idle" : {
            "armRotation" : -90,
            "weaponRotation" : 0,
            "twoHanded" : false,
            "weaponOffset" : [0, 0.5],
            "allowRotate" : true,
            "allowFlip" : true
          },
          "windup" : {
            "hold" : true,
            "duration" : 0.55,
            "armRotation" : -110,
            "weaponRotation" : 20,
            "twoHanded" : true,
            "weaponOffset" : [0, 0.5],
            "allowRotate" : false,
            "allowFlip" : false
          },
          "fire" : {
            "duration" : 0.3,
            "armRotation" : -20,
            "weaponRotation" : -70,
            "twoHanded" : true,
            "weaponOffset" : [0, 2.5],
            "allowRotate" : false,
            "allowFlip" : false
          },
          "hold" : {
            "armRotation" : -30,
            "weaponRotation" : -60,
            "twoHanded" : true,
            "weaponOffset" : [0, 2.0],
            "allowRotate" : true,
            "allowFlip" : true
          }
        }
      },
    
      "palette" : "/items/active/weapons/colors/tier10melee.weaponcolors",
    
      "altAbilitySource" : "/items/active/weapons/melee/altabilities/spear/elementalspin/elementalspin.altability",
    
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    
    
    *Note that I use a custom spear.animation file. I named mine ganontrident.animation*
     
    Last edited: Mar 2, 2016
  6. L3W

    L3W Ketchup Robot

    I finally fixed my megatonhammer.activeitem code! It uses a custom hammer.animation file called megatonhammer.animation.

    The code is based on the commonhammer.activeitem file.

    Code:
    
    {
      "itemName" : "megatonhammer",
      "price" : 160,
      "level" : 6,
      "maxStack" : 1,
      "rarity" : "legendary",
      "description" : "The legendary hammer that slayed Volvagia not once, but twice.",
      "shortdescription" : "Megaton Hammer",
      "tooltipKind" : "sword",
      "weaponType" : "Hammer",
      "twoHanded" : true,
      "itemTags" : ["weapon","melee","hammer"],
    
      "inventoryIcon" : "megatonhammer.png",
    
      "animation" : "/items/active/weapons/melee/hammer/megatonhammer/megatonhammer.animation",
      "animationParts" : {
        "handle" : "",
        "blade" : "megatonhammer.png"
      },
      "animationCustom" : {
        "sounds" : {
          "fire" : [ "/sfx/melee/megatonhammer.wav" ]
        }
      },
    
      "scripts" : ["/items/active/weapons/melee/hammer/hammer.lua"],
    
      "elementalType" : "physical",
    
      "primaryAbility" : {
        "scripts" : [],
        "class" : "HammerSmash",
    
        "fireTime" : 1.3,
        "baseDps" : 12.3,
        "damageConfig" : {
          "damageSourceKind" : "hammer",
          "statusEffects" : [ ],
          "knockbackMode" : "facing",
          "knockback" : 45
        },
       
        "smashMomentum" : [0, -45],
        "stances" : {
          "idle" : {
            "armRotation" : -90,
            "weaponRotation" : -10,
            "weaponOffset" : [-0.125, 0.5],
            "allowRotate" : false,
            "allowFlip" : true
          },
          "windup" : {
            "duration" : 0.8,
            "armRotation" : 90,
            "weaponRotation" : -10,
            "twoHanded" : true,
            "weaponOffset" : [0, 1.75],
            "allowRotate" : false,
            "allowFlip" : true,
            // Windup animation
            "idleHammerAngle" : -20,
            "windupHammerAngle" : 0,
            "dropHammerAngle" : 60,
            "bounceHammerAngle" : 55,
           
            "minWindup" : 0.7,
            "windupBaseAngle" : -90,
            "windupAngleRange" : 140
          },
          "preslash" : {
            "duration" : 0.025,
            "armRotation" : 55,
            "weaponRotation" : -45,
            "twoHanded" : true,
            "weaponOffset" : [0, 2.0],
            "allowRotate" : false,
            "allowFlip" : false
          },
          "fire" : {
            "duration" : 0.4,
            "armRotation" : -35,
            "weaponRotation" : -55,
            "twoHanded" : true,
            "smashTimer" : 1.5,
            "weaponOffset" : [0, 2.0],
            "allowRotate" : false,
            "allowFlip" : false
          }
        }
      },
    
      "palette" : "/items/active/weapons/colors/melee.weaponcolors",
    
      "altAbilitySource" : "/items/active/weapons/melee/altabilities/hammer/shockwave/physicalshockwave.altability",
    
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    
    
     
    Last edited: Mar 2, 2016
  7. lazarus78

    lazarus78 The Waste of Time

    look in your starbound.log for errors.
     
  8. L3W

    L3W Ketchup Robot

    @lazarus78 Well I looked at the Starbound log and It said this for both my hammer and spear items. I really dislike errors that let you run the game fine, but don't allow the weapons to show up because of this.

    [23:11:26.861] Error: Could not instantiate item '[megatonhammer, 1, {}]'. (LuaException) Error code 2, [string "/items/buildscripts/buildunrandweapon.lua"]:50: attempt to perform arithmetic on a table value (field 'baseDps')

    [23:11:27.742] Error: Could not instantiate item '[ganontrident, 1, {}]'. (LuaException) Error code 2, [string "/items/buildscripts/buildunrandweapon.lua"]:50: attempt to perform arithmetic on a table value (field 'baseDps')

    So, I am guessing I have to fix the the base dps. I might have to get rid of the brackets around the values as well.

    EDIT: Yes, that was the problem. I had to pick a value and get rid of the brackets.
     
    Last edited: Feb 29, 2016
  9. lazarus78

    lazarus78 The Waste of Time

    Yeah. since you are making a single static item, not a random generated item.
     
  10. L3W

    L3W Ketchup Robot

    So, here is my fairybow.activeitem code. It works, but I thought I would let people see the changes so they can update their bows.

    Code:
    
    {
      "itemName" : "fairybow",
      "price" : 40,
      "inventoryIcon" : "fairybowicon.png",
      "maxStack" : 1,
      "rarity" : "legendary",
      "tooltipKind" : "bow",
      "weaponType" : "Bow",
      "description" : "A Fairy bow, once found inside the Forest Temple.",
      "shortdescription" : "Fairy Bow",
      "twoHanded" : true,
      "itemTags" : ["weapon", "ranged", "bow"],
    
      "radioMessagesOnPickup" : [ "pickupbow" ],
    
      "level" : 3,
    
      "animation" : "/items/active/weapons/bow/bow.animation",
      "animationParts" : {
        "bow" : "fairybowfull.png"
      },
      "animationCustom" : {
        "animatedParts" : { "parts" : { "bow" : { "properties" : {
          "offset" : [0.25, 0]
        }}}},
        "sounds" : {
          "draw" : [ "/sfx/gun/bow_draw1.ogg", "/sfx/gun/bow_draw2.ogg", "/sfx/gun/bow_draw3.ogg" ],
          "release" : [ "/sfx/bow/fairybow_loose.wav" ],
          "perfectRelease" : [ "/sfx/bow/fairybow_loose.wav" ]
        }
      },
    
      "scripts" : ["/items/active/weapons/bow/bow.lua"],
    
      "walkWhileFiring" : true,
    
      "fireOffset" : [1.75, 0],
    
      "energyPerShot" : 30,
    
      "cooldownTime" : 0.25,
      "inaccuracy" : 0.01,
    
      "drawFrameSelector" : "bowImageSelector",
      "drawPowerMultiplier" : "drawTimeMultiplier",
      "drawSpeedMultiplier" : "drawTimeMultiplier",
    
      "projectileType" : "fairyarrow",
      "powerProjectileType" : "chargedfirearrow",
      "powerProjectileTime" : [0.9, 1.1],
      "projectileParameters" : {
        "speed" : 80,
        "power" : 5.2
      },
    
      "builder" : "/items/buildscripts/buildbow.lua"
    }
    
    
    So, you only need the bowfull.png and bowicon.png now. You no longer need a bow.png. Also you need to have a bow.animation file as well. I used the regular one, but you can modify it like other .activeitems. I hope this helps other modders out and makes it easier than what I had to go through...

    *Note I use my own .wav sounds sometimes*

    EDIT: I am thinking about converting from .wavs to .oggs if they are that much better.
     
    Last edited: Mar 3, 2016
  11. lazarus78

    lazarus78 The Waste of Time

    Should use the OGG format to save some space.

    Audacity can export ogg.
     
    L3W likes this.

Share This Page