Modding Help Weapons using other classes' abilities

Discussion in 'Starbound Modding' started by uPr0ph3tu, Aug 31, 2019.

  1. uPr0ph3tu

    uPr0ph3tu Intergalactic Tourist

    Hey everyone,

    I've been troubleshooting this for days and can't anymore I feel this is either really something obvious or just not possible.

    I'm trying to make a staff into a primary flamethrower from the ranged, secondary firetraildash from the /melee/broadsword section.

    (I've made a new category called spellbooks that are using the staff lua with 'requires' conditions.


    {
    "itemName" : "MBredmagicspellbook2",
    "level" : 3,
    "price" : 2500,
    "maxStack" : 1,
    "rarity" : "Uncommon",
    "description" : "",
    "shortdescription" : "Red Magic Spellbook lvl2",
    "category" : "MBspellbooks",
    "twoHanded" : true,
    "itemTags" : ["weapon","spellbook"],
    "tooltipKind" : "MBspellbooks",

    "animation" : "/items/active/weapons/staff/staff.animation",
    "animationParts" : {
    "staff" : "MBredmagicspellbook2.png",
    "stone" : "",
    "chargeEffect" : "/items/active/weapons/staff/generated/glow/fire.png",
    "butt" : "",
    "middle" : "",
    "barrel" : "",
    "muzzleFlash" : ""
    },
    "animationCustom" : {

    "sounds" : {
    "fireStart" : [ "/sfx/gun/flamethrower_start.ogg" ],
    "fireLoop" : [ "/sfx/gun/flamethrower_loop.ogg" ],
    "fireEnd" : [ "/sfx/gun/flamethrower_stop.ogg" ]
    },

    "particleEmitters" : {
    "electriccharge" : {
    "offsetRegion" : [-0.5, 1.75, 0.5, 3.25]
    }
    }
    },

    "inventoryIcon" : "MBredmagicspellbook2.png",

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

    "stances" : {
    "idle" : {
    "armRotation" : -90,
    "weaponRotation" : 0,
    "twoHanded" : false,

    "allowRotate" : false,
    "allowFlip" : true
    },
    "charge" : {
    "duration" : 1.3,
    "armRotation" : 20,
    "weaponRotation" : -20,
    "twoHanded" : true,

    "allowRotate" : false,
    "allowFlip" : true
    },
    "charged" : {
    "armRotation" : 20,
    "weaponRotation" : -20,
    "twoHanded" : true,

    "allowRotate" : false,
    "allowFlip" : false
    },
    "discharge" : {
    "duration" : 0.5,
    "armRotation" : 20,
    "weaponRotation" : -20,
    "twoHanded" : true,

    "allowRotate" : false,
    "allowFlip" : false
    },
    "cooldown" : {
    "duration" : 0.5,
    "armRotation" : -45,
    "weaponRotation" : 0,
    "twoHanded" : true,

    "allowRotate" : false,
    "allowFlip" : false
    },
    "windup" : {
    "duration" : 0.05,
    "armRotation" : -20,
    "weaponRotation" : -20,
    "weaponOffset" : [0, 2.25],

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

    "elementalType" : "fire",
    "primaryAbilityType" : "flamethrower",
    "primaryAbility" : {
    "name" : "Flamethrower",
    "scripts" : ["/items/active/weapons/ranged/abilities/flamethrower.lua"],
    "class" : "FlamethrowerAttack",
    "baseDps" : 10,
    "energyUsage" : 30
    },

    "altAbilityType" : "fuelairtrail",
    "altAbility" : {
    "name" : "Flamedash",
    "scripts" : ["/items/active/weapons/ranged/abilities/fuelairtrail/fuelairtrail.lua"]
    },

    "builder" : "/items/buildscripts/buildunrandweapon.lua"
    }




    require "/scripts/util.lua"
    require "/scripts/vec2.lua"
    require "/scripts/interp.lua"
    require "/items/active/weapons/weapon.lua"
    require "/items/active/weapons/ranged/gun.lua"
    require "/items/active/weapons/ranged/gunfire.lua"
    require "/items/active/weapons/ranged/flamethrower/flamethrower.lua"
    require "/items/active/weapons/ranged/abilities/flamethrower/flamethrower.lua"

    function init()
    activeItem.setCursor("/cursors/reticle0.cursor")
    animator.setGlobalTag("paletteSwaps", config.getParameter("paletteSwaps", ""))

    self.weapon = Weapon:new()

    self.weapon:addTransformationGroup("weapon", {0,0}, 0)

    local primaryAbility = getPrimaryAbility()
    self.weapon:addAbility(primaryAbility)

    local secondaryAttack = getAltAbility(self.weapon.elementalType)
    if secondaryAttack then
    self.weapon:addAbility(secondaryAttack)
    end

    self.weapon:init()
    end

    function update(dt, fireMode, shiftHeld)
    self.weapon:update(dt, fireMode, shiftHeld)
    end

    function uninit()
    self.weapon:uninit()
    end



    You'll notice the 'altability' in the activeitem is fuelair, this is just a placeholder until I get the first ability working
     

Share This Page