Modding Help Empowerment Swords!?

Discussion in 'Starbound Modding' started by Jaxine, Aug 27, 2016.

  1. Jaxine

    Jaxine Big Damn Hero

    Alright, I wana make a new version of the Protector's Broadsword, and have the Alt. Ability "Empowerment" on it. The code is a big pile of gibberish to me compared to normal weapons.

    So far I have the weapon working in game, but the recipe won't show up in /admin mode. That I might be able to fix on my own. The main issue is the sword is invisible. I lengthened the blade in its image, but otherwise the sword should fit the Weapon Frame.

    All proper folders placed in "items/active/weapons/protectorate/protectoratebroadsword4" (I have a 1,2,and 3. So its 4.) Renamed all folders to avoid conflicting with other game files.

    protectoratebroadsword4.png (transparent)
    protectoratebroadsword4.png
    protectoratebroadswordfullbright2.png (transparent)
    protectoratebroadswordfullbright2.png
    default2.frames
    empowerment2.lua
    protectoratebroadsword4.activeitem
    protectoratebroadsword4.animation
    protectoratebroadsword4.lua

    Anyone know whats up?


    Code:
    require "/scripts/util.lua"
    require "/scripts/vec2.lua"
    require "/items/active/weapons/weapon.lua"
    
    function init()
      animator.setGlobalTag("paletteSwaps", config.getParameter("paletteSwaps", ""))
      animator.setGlobalTag("directives", "")
      animator.setGlobalTag("bladeDirectives", "")
    
      self.weapon = Weapon:new()
    
      self.weapon:addTransformationGroup("weapon", {0,0}, util.toRadians(config.getParameter("baseWeaponRotation", 0)))
      self.weapon:addTransformationGroup("swoosh", {0,0}, math.pi/2)
    
      self.primaryAbility = getPrimaryAbility()
      self.weapon:addAbility(self.primaryAbility)
    
      self.altAbility = getAltAbility()
      self.weapon:addAbility(self.altAbility)
    
      self.weapon:init()
    
      self.inactiveBaseDps = config.getParameter("inactiveBaseDps")
      self.activeBaseDps = config.getParameter("activeBaseDps")
    
      self.active = false
      animator.setAnimationState("sword", "inactive")
      self.primaryAbility.animKeyPrefix = "inactive"
      self.primaryAbility.baseDps = self.inactiveBaseDps
      self.primaryAbility:computeDamageAndCooldowns()
    end
    
    function update(dt, fireMode, shiftHeld)
      self.weapon:update(dt, fireMode, shiftHeld)
    
      setActive(self.altAbility.active)
    end
    
    function uninit()
      self.weapon:uninit()
    end
    
    function setActive(active)
      if self.active ~= active then
        self.active = active
        if self.active then
          animator.setAnimationState("sword", "extend")
          self.primaryAbility.animKeyPrefix = "active"
          self.primaryAbility.baseDps = self.activeBaseDps
          self.primaryAbility:computeDamageAndCooldowns()
        else
          animator.setAnimationState("sword", "retract")
          self.primaryAbility.animKeyPrefix = "inactive"
          self.primaryAbility.baseDps = self.inactiveBaseDps
          self.primaryAbility:computeDamageAndCooldowns()
        end
      end
    end
    


    Code:
    empowerment2 = WeaponAbility:new()
    
    function empowerment2:init()
      self.cooldownTimer = self.cooldownTime
    
      self.active = false
    end
    
    function empowerment2:update(dt, fireMode, shiftHeld)
      WeaponAbility.update(self, dt, fireMode, shiftHeld)
    
      self.cooldownTimer = math.max(0, self.cooldownTimer - self.dt)
    
      if self.active and not status.overConsumeResource("energy", self.energyPerSecond * self.dt) then
        self.active = false
      end
    
      if fireMode == "alt"
          and not self.weapon.currentAbility
          and self.cooldownTimer == 0
          and not status.resourceLocked("energy") then
    
        if self.active then
          self:setState(self.windup)
        else
          self:setState(self.empower)
        end
      end
    end
    
    function empowerment2:empower()
      self.weapon:setStance(self.stances.empower)
    
      util.wait(self.stances.empower.durationBefore)
    
      animator.playSound("empower")
      self.active = true
    
      util.wait(self.stances.empower.durationAfter)
    end
    
    function empowerment2:windup()
      self.weapon:setStance(self.stances.windup)
      self.weapon:updateAim()
    
      util.wait(self.stances.windup.duration)
    
      self:setState(self.fire)
    end
    
    function empowerment2:fire()
      self.weapon:setStance(self.stances.fire)
      self.weapon:updateAim()
    
      local position = vec2.add(mcontroller.position(), {self.projectileOffset[1] * mcontroller.facingDirection(), self.projectileOffset[2]})
      local params = {
        powerMultiplier = activeItem.ownerPowerMultiplier(),
        power = self:damageAmount()
      }
      world.spawnProjectile(self.projectileType, position, activeItem.ownerEntityId(), self:aimVector(), false, params)
    
      animator.playSound("slash")
      status.overConsumeResource("energy", status.resourceMax("energy"))
      self.active = false
    
      util.wait(self.stances.fire.duration)
    
      self.cooldownTimer = self.cooldownTime
    end
    
    function empowerment2:uninit()
    
    end
    
    function empowerment2:aimVector()
      return {mcontroller.facingDirection(), 0}
    end
    
    function empowerment2:damageAmount()
      return self.baseDamage * config.getParameter("damageLevelMultiplier")
    end
    


    Code:
    {
      "itemName" : "protectoratebroadsword4",
      "price" : 9999,
      "level" : 7,
      "maxStack" : 1,
      "rarity" : "Legendary",
      "description" : "An upgraded, powerful experimental weapon designed by the Terrene Protectorate for their Elite Officers.",
      "shortdescription" : "Protector's Elitesword",
      "tooltipKind" : "sword",
      "category" : "broadsword",
      "twoHanded" : true,
      "itemTags" : ["weapon","melee","broadsword"],
    
      "inventoryIcon" : "protectoratebroadsword4.png:inactive",
    
      "animation" : "/items/active/weapons/protectorate/protectoratebroadsword4/protectoratebroadsword4.animation",
      "animationParts" : {
        "sword" : "protectoratebroadsword4.png",
        "swordfullbright" : "protectoratebroadsword4fullbright2.png"
      },
      "animationCustom" : { },
    
      "scripts" : ["/items/active/weapons/protectorate/protectoratebroadsword4/protectoratebroadsword4.lua"],
    
      "elementalType" : "physical",
    
      "primaryAbilityType" : "broadswordcombo",
      "primaryAbility" : {
        "fireTime" : 0.45,
        "baseDps" : 15,
    
        "animKeyPrefix" : "inactive"
      },
    
      "inactiveBaseDps" : 10,
      "activeBaseDps" : 13,
    
      "altAbility" : {
        "name" : "empowerment2",
        "type" : "empowerment2",
        "scripts" : ["/items/active/weapons/protectorate/protectoratebroadsword4/empowerment2.lua"],
        "class" : "empowerment2",
    
        "energyPerSecond" : 15,
    
        "projectileOffset" : [1, 0],
        "projectileType" : "energytravelingswoosh",
        "baseDamage" : 16,
    
        "cooldownTime" : 1.0,
    
        "stances" : {
          "empower" : {
            "durationBefore" : 0.2,
            "durationAfter" : 0.5,
            "armRotation" : 90,
            "weaponRotation" : -90,
            "twoHanded" : true,
    
            "weaponOffset" : [0.5, -0.375],
    
            "allowRotate" : false,
            "allowFlip" : false
          },
          "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
          }
        }
      },
    
      "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }
    


    Code:
    {
      "globalTagdefaults" : {
        "paletteSwaps" : ""
      },
    
      "animatedParts" : {
        "stateTypes" : {
          "swoosh" : {
            "default" : "idle",
            "states" : {
              "idle" : {},
              "inactivefire" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "inactivefire2" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "inactivefire3" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "activefire" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "activefire2" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "activefire3" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              }
            }
          },
          "sword" : {
            "default" : "inactive",
            "states" : {
              "inactive" : {
                "properties" : {
                  "lightsOff" : ["glow"],
                  "particleEmittersOff" : ["blade"]
                }
              },
              "extend" : {
                "frames" : 4,
                "cycle" : 0.2,
                "mode" : "transition",
                "transition" : "active",
                "properties" : {
                  "lightsOn" : ["glow"],
                  "particleEmittersOn" : ["blade"],
                  "immediateSound" : "/sfx/tools/energypickaxe_start.ogg"
                }
              },
              "active" : {
                "properties" : {
                  "lightsOn" : ["glow"],
                  "particleEmittersOn" : ["blade"],
                  "persistentSound" : "/sfx/tools/energypickaxe_idle.ogg"
                }
              },
              "retract" : {
                "frames" : 4,
                "cycle" : 0.2,
                "mode" : "transition",
                "transition" : "inactive",
                "properties" : {
                  "lightsOn" : ["glow"],
                  "particleEmittersOn" : ["blade"],
                  "immediateSound" : "/sfx/tools/energypickaxe_stop2.ogg"
                }
              }
            }
          }
        },
    
        "parts" : {
          "sword" : {
            "properties" : {
              "zLevel" : 0,
              "centered" : true,
              "offset" : [0, 2.125],
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0, 0]
            },
    
            "partStates" : {
              "sword" : {
                "inactive" : {
                  "properties" : {
                    "image" : "<partImage>:inactive?<directives>?<bladeDirectives>"
                  }
                },
                "extend" : {
                  "properties" : {
                    "image" : "<partImage>:extend.<frame>?<directives>?<bladeDirectives>"
                  }
                },
                "active" : {
                  "properties" : {
                    "image" : "<partImage>:active?<directives>?<bladeDirectives>"
                  }
                },
                "retract" : {
                  "properties" : {
                    "image" : "<partImage>:retract.<frame>?<directives>?<bladeDirectives>"
                  }
                }
              }
            }
          },
    
          "swordfullbright" : {
            "properties" : {
              "zLevel" : 1,
              "centered" : true,
              "fullbright" : true,
              "offset" : [0, 2.125],
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0, 0],
              "damageArea" : [[-0.7, -1.0], [-0.7, 2.5], [0.5, 2.5], [0.5, -1.0]]
            },
    
            "partStates" : {
              "sword" : {
                "inactive" : {
                  "properties" : {
                    "image" : "<partImage>:inactive?<directives>?<bladeDirectives>"
                  }
                },
                "extend" : {
                  "properties" : {
                    "image" : "<partImage>:extend.<frame>?<directives>?<bladeDirectives>"
                  }
                },
                "active" : {
                  "properties" : {
                    "image" : "<partImage>:active?<directives>?<bladeDirectives>"
                  }
                },
                "retract" : {
                  "properties" : {
                    "image" : "<partImage>:retract.<frame>?<directives>?<bladeDirectives>"
                  }
                }
              }
            }
          },
    
          "swoosh" : {
            "properties" : {
              "zLevel" : -1,
              "centered" : true,
              "fullbright" : true,
              "transformationGroups" : ["swoosh"],
              "rotationCenter" : [0, 0]
            },
    
            "partStates" : {
              "swoosh" : {
                "idle" : {
                  "properties" : {
                    "image" : ""
                  }
                },
                "inactivefire" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh/physicalswoosh.png:<frame>",
                    "offset" : [0, 2.5],
                    "damageArea" : [[-5, 2], [-2.5, 3], [1, 3], [4, 1.75], [5, -0.25], [5, -2.25], [4, -3.25], [0, -2.5]]
                  }
                },
                "inactivefire2" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh2/physicalswoosh.png:<frame>",
                    "offset" : [5.0, 1.0],
                    "damageArea" : [[-4, 1], [2.5, 1], [2.5, -2], [-4, -2]]
                  }
                },
                "inactivefire3" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh3/physicalswoosh.png:<frame>",
                    "offset" : [3.5, 0],
                    "damageArea" : [[-4.75, 1.5], [3, 1], [3, -1], [-4.75, -1.5]]
                  }
                },
                "activefire" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh/protectorswoosh.png:<frame>",
                    "offset" : [0, 2.5],
                    "damageArea" : [[-5, 2], [-2.5, 3], [1, 3], [4, 1.75], [5, -0.25], [5, -2.25], [4, -3.25], [0, -2.5]]
                  }
                },
                "activefire2" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh2/protectorswoosh.png:<frame>",
                    "offset" : [5.0, 1.0],
                    "damageArea" : [[-4, 1], [2.5, 1], [2.5, -2], [-4, -2]]
                  }
                },
                "activefire3" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh3/protectorswoosh.png:<frame>",
                    "offset" : [3.5, 0],
                    "damageArea" : [[-4.75, 1.5], [3, 1], [3, -1], [-4.75, -1.5]]
                  }
                }
              }
            }
          }
        }
      },
    
      "transformationGroups" : {
        "weapon" : {},
        "swoosh" : {}
      },
    
      "particleEmitters" : {
        "inactivephysicalswoosh" : {
          "active" : false,
          "particles" : []
        },
        "activephysicalswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "burstCount" : 6,
          "particles" : [
            { "particle" : "protectorblade"},
            { "particle" : "protectorblade2"}
          ]
        },
        "blade" : {
          "active" : false,
          "transformationGroups" : ["weapon"],
          "offsetRegion" : [-0.5, 1.5, 0.5, 4.0],
          "emissionRate" : 10,
          "particles" : [
            { "particle" : "protectorblade"},
            { "particle" : "protectorblade2"}
          ]
        }
      },
    
      "lights" : {
        "glow" : {
          "position" : [0, 2.0],
          "color" : [0, 90, 140],
          "transformationGroups" : ["weapon"]
        }
      },
    
      "sounds" : {
        "inactivefire" : [ "/sfx/melee/swing_broadsword.ogg" ],
        "inactivefire2" : [ "/sfx/melee/swing_shortsword.ogg" ],
        "inactivefire3" : [ "/sfx/melee/swing_spear.ogg" ],
        "activefire" : [ "/sfx/melee/laser_weapon_swing1.ogg", "/sfx/melee/laser_weapon_swing2.ogg", "/sfx/melee/laser_weapon_swing3.ogg" ],
        "activefire2" : [ "/sfx/melee/laser_weapon_swing1.ogg", "/sfx/melee/laser_weapon_swing2.ogg", "/sfx/melee/laser_weapon_swing3.ogg" ],
        "activefire3" : [ "/sfx/melee/laser_weapon_swing1.ogg", "/sfx/melee/laser_weapon_swing2.ogg", "/sfx/melee/laser_weapon_swing3.ogg" ],
        "empower" : [],
        "slash" : ["/sfx/melee/laser_weapon_swing2.ogg"]
      }
    }
    
    Code:
    {
      "globalTagdefaults" : {
        "paletteSwaps" : ""
      },
    
      "animatedParts" : {
        "stateTypes" : {
          "swoosh" : {
            "default" : "idle",
            "states" : {
              "idle" : {},
              "inactivefire" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "inactivefire2" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "inactivefire3" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "activefire" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "activefire2" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              },
              "activefire3" : {
                "frames" : 3,
                "cycle" : 0.1,
                "mode" : "transition",
                "transition" : "idle"
              }
            }
          },
          "sword" : {
            "default" : "inactive",
            "states" : {
              "inactive" : {
                "properties" : {
                  "lightsOff" : ["glow"],
                  "particleEmittersOff" : ["blade"]
                }
              },
              "extend" : {
                "frames" : 4,
                "cycle" : 0.2,
                "mode" : "transition",
                "transition" : "active",
                "properties" : {
                  "lightsOn" : ["glow"],
                  "particleEmittersOn" : ["blade"],
                  "immediateSound" : "/sfx/tools/energypickaxe_start.ogg"
                }
              },
              "active" : {
                "properties" : {
                  "lightsOn" : ["glow"],
                  "particleEmittersOn" : ["blade"],
                  "persistentSound" : "/sfx/tools/energypickaxe_idle.ogg"
                }
              },
              "retract" : {
                "frames" : 4,
                "cycle" : 0.2,
                "mode" : "transition",
                "transition" : "inactive",
                "properties" : {
                  "lightsOn" : ["glow"],
                  "particleEmittersOn" : ["blade"],
                  "immediateSound" : "/sfx/tools/energypickaxe_stop2.ogg"
                }
              }
            }
          }
        },
    
        "parts" : {
          "sword" : {
            "properties" : {
              "zLevel" : 0,
              "centered" : true,
              "offset" : [0, 2.125],
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0, 0]
            },
    
            "partStates" : {
              "sword" : {
                "inactive" : {
                  "properties" : {
                    "image" : "<partImage>:inactive?<directives>?<bladeDirectives>"
                  }
                },
                "extend" : {
                  "properties" : {
                    "image" : "<partImage>:extend.<frame>?<directives>?<bladeDirectives>"
                  }
                },
                "active" : {
                  "properties" : {
                    "image" : "<partImage>:active?<directives>?<bladeDirectives>"
                  }
                },
                "retract" : {
                  "properties" : {
                    "image" : "<partImage>:retract.<frame>?<directives>?<bladeDirectives>"
                  }
                }
              }
            }
          },
    
          "swordfullbright" : {
            "properties" : {
              "zLevel" : 1,
              "centered" : true,
              "fullbright" : true,
              "offset" : [0, 2.125],
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0, 0],
              "damageArea" : [[-0.7, -1.0], [-0.7, 2.5], [0.5, 2.5], [0.5, -1.0]]
            },
    
            "partStates" : {
              "sword" : {
                "inactive" : {
                  "properties" : {
                    "image" : "<partImage>:inactive?<directives>?<bladeDirectives>"
                  }
                },
                "extend" : {
                  "properties" : {
                    "image" : "<partImage>:extend.<frame>?<directives>?<bladeDirectives>"
                  }
                },
                "active" : {
                  "properties" : {
                    "image" : "<partImage>:active?<directives>?<bladeDirectives>"
                  }
                },
                "retract" : {
                  "properties" : {
                    "image" : "<partImage>:retract.<frame>?<directives>?<bladeDirectives>"
                  }
                }
              }
            }
          },
    
          "swoosh" : {
            "properties" : {
              "zLevel" : -1,
              "centered" : true,
              "fullbright" : true,
              "transformationGroups" : ["swoosh"],
              "rotationCenter" : [0, 0]
            },
    
            "partStates" : {
              "swoosh" : {
                "idle" : {
                  "properties" : {
                    "image" : ""
                  }
                },
                "inactivefire" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh/physicalswoosh.png:<frame>",
                    "offset" : [0, 2.5],
                    "damageArea" : [[-5, 2], [-2.5, 3], [1, 3], [4, 1.75], [5, -0.25], [5, -2.25], [4, -3.25], [0, -2.5]]
                  }
                },
                "inactivefire2" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh2/physicalswoosh.png:<frame>",
                    "offset" : [5.0, 1.0],
                    "damageArea" : [[-4, 1], [2.5, 1], [2.5, -2], [-4, -2]]
                  }
                },
                "inactivefire3" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh3/physicalswoosh.png:<frame>",
                    "offset" : [3.5, 0],
                    "damageArea" : [[-4.75, 1.5], [3, 1], [3, -1], [-4.75, -1.5]]
                  }
                },
                "activefire" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh/protectorswoosh.png:<frame>",
                    "offset" : [0, 2.5],
                    "damageArea" : [[-5, 2], [-2.5, 3], [1, 3], [4, 1.75], [5, -0.25], [5, -2.25], [4, -3.25], [0, -2.5]]
                  }
                },
                "activefire2" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh2/protectorswoosh.png:<frame>",
                    "offset" : [5.0, 1.0],
                    "damageArea" : [[-4, 1], [2.5, 1], [2.5, -2], [-4, -2]]
                  }
                },
                "activefire3" : {
                  "properties" : {
                    "image" : "/items/active/weapons/melee/broadsword/swoosh3/protectorswoosh.png:<frame>",
                    "offset" : [3.5, 0],
                    "damageArea" : [[-4.75, 1.5], [3, 1], [3, -1], [-4.75, -1.5]]
                  }
                }
              }
            }
          }
        }
      },
    
      "transformationGroups" : {
        "weapon" : {},
        "swoosh" : {}
      },
    
      "particleEmitters" : {
        "inactivephysicalswoosh" : {
          "active" : false,
          "particles" : []
        },
        "activephysicalswoosh" : {
          "active" : false,
          "transformationGroups" : ["swoosh"],
          "burstCount" : 6,
          "particles" : [
            { "particle" : "protectorblade"},
            { "particle" : "protectorblade2"}
          ]
        },
        "blade" : {
          "active" : false,
          "transformationGroups" : ["weapon"],
          "offsetRegion" : [-0.5, 1.5, 0.5, 4.0],
          "emissionRate" : 10,
          "particles" : [
            { "particle" : "protectorblade"},
            { "particle" : "protectorblade2"}
          ]
        }
      },
    
      "lights" : {
        "glow" : {
          "position" : [0, 2.0],
          "color" : [0, 90, 140],
          "transformationGroups" : ["weapon"]
        }
      },
    
      "sounds" : {
        "inactivefire" : [ "/sfx/melee/swing_broadsword.ogg" ],
        "inactivefire2" : [ "/sfx/melee/swing_shortsword.ogg" ],
        "inactivefire3" : [ "/sfx/melee/swing_spear.ogg" ],
        "activefire" : [ "/sfx/melee/laser_weapon_swing1.ogg", "/sfx/melee/laser_weapon_swing2.ogg", "/sfx/melee/laser_weapon_swing3.ogg" ],
        "activefire2" : [ "/sfx/melee/laser_weapon_swing1.ogg", "/sfx/melee/laser_weapon_swing2.ogg", "/sfx/melee/laser_weapon_swing3.ogg" ],
        "activefire3" : [ "/sfx/melee/laser_weapon_swing1.ogg", "/sfx/melee/laser_weapon_swing2.ogg", "/sfx/melee/laser_weapon_swing3.ogg" ],
        "empower" : [],
        "slash" : ["/sfx/melee/laser_weapon_swing2.ogg"]
      }
    }
    


    Code:
    require "/scripts/util.lua"
    require "/scripts/vec2.lua"
    require "/items/active/weapons/weapon.lua"
    
    function init()
      animator.setGlobalTag("paletteSwaps", config.getParameter("paletteSwaps", ""))
      animator.setGlobalTag("directives", "")
      animator.setGlobalTag("bladeDirectives", "")
    
      self.weapon = Weapon:new()
    
      self.weapon:addTransformationGroup("weapon", {0,0}, util.toRadians(config.getParameter("baseWeaponRotation", 0)))
      self.weapon:addTransformationGroup("swoosh", {0,0}, math.pi/2)
    
      self.primaryAbility = getPrimaryAbility()
      self.weapon:addAbility(self.primaryAbility)
    
      self.altAbility = getAltAbility()
      self.weapon:addAbility(self.altAbility)
    
      self.weapon:init()
    
      self.inactiveBaseDps = config.getParameter("inactiveBaseDps")
      self.activeBaseDps = config.getParameter("activeBaseDps")
    
      self.active = false
      animator.setAnimationState("sword", "inactive")
      self.primaryAbility.animKeyPrefix = "inactive"
      self.primaryAbility.baseDps = self.inactiveBaseDps
      self.primaryAbility:computeDamageAndCooldowns()
    end
    
    function update(dt, fireMode, shiftHeld)
      self.weapon:update(dt, fireMode, shiftHeld)
    
      setActive(self.altAbility.active)
    end
    
    function uninit()
      self.weapon:uninit()
    end
    
    function setActive(active)
      if self.active ~= active then
        self.active = active
        if self.active then
          animator.setAnimationState("sword", "extend")
          self.primaryAbility.animKeyPrefix = "active"
          self.primaryAbility.baseDps = self.activeBaseDps
          self.primaryAbility:computeDamageAndCooldowns()
        else
          animator.setAnimationState("sword", "retract")
          self.primaryAbility.animKeyPrefix = "inactive"
          self.primaryAbility.baseDps = self.inactiveBaseDps
          self.primaryAbility:computeDamageAndCooldowns()
        end
      end
    end
    
     

    Attached Files:

  2. Inf_Wolf14

    Inf_Wolf14 Spaceman Spiff

    Fixed.

    Remedied file sent straight to @OP.
     

Share This Page