Modding Help LUA Assistance

Discussion in 'Starbound Modding' started by Novan Crusader, Mar 9, 2018.

  1. Novan Crusader

    Novan Crusader Void-Bound Voyager

    To clarify on the topic title, I need help with knowing how to play two sounds for an alt-fire ability on a weapon I am creating for end-game use in a mod I'm working on. I found a buildup sound I'd like to use as the first sound, followed by the actual firing sound for the ability after a certain timing with the buildup.

    Second, I need help with knowing what sort of code/code-line I need to get an animation to play once the weapon is fired, but without a loop.

    To put it, it is a powerful sniper rifle in which the barrel retracts upon being fired through a hydraulic recoil mechanism, like a howitzer for example, to give a sense of limited recoil. The code I have is listed below.

    "itemName" : "sidcsniperrifle",
    "price" : 5960,
    "maxStack" : 1,
    "rarity" : "Legendary",
    "description" : "An extremely powerful sniper rifle designed by the S.I.D.C, and constructed with Novanium.",
    "shortdescription" : "S.I.D.C. Sniper Rifle",
    "tooltipKind" : "gun",
    "category" : "sniperRifle",
    "twoHanded" : true,
    "itemTags" : ["weapon","ranged","sniperrifle","sidc"],
    "level" : 10,

    "inventoryIcon" : "sidcsniperrifle.png",

    "animation" : "/items/active/weapons/ranged/gun.animation",
    "animationParts" : {
    "butt" : "",
    "middle" : "/items/active/weapons/ranged/sidc/sidcsniperrifle.png",
    "barrel" : "",
    "muzzleFlash" : "/items/active/weapons/ranged/sidc/sidcsnipermuzzleflash.png"
    "animationCustom" : {
    "animatedParts" : { "stateTypes" : { "middle" : {
    "default" : "idle",
    "states" : {
    "idle" : {
    "frames" : 7,
    "cycle" : 0.07,
    "mode" : "linear"
    "parts" : { "middlefullbright" : {
    "properties" : {
    "centered" : true,
    "offset" : [0, 0],
    "zLevel" : 1,
    "transformationGroups" : ["weapon"],
    "fullbright" : true
    "partStates" : {
    "middle" : {
    "idle" : {
    "properties" : {
    "image" : "/items/active/weapons/ranged/unrand/spaceplasmarifle/spaceplasmariflefullbright.png:<frame><paletteSwaps>"
    "sounds" : {
    "fire" : ["/sfx/gun/plasma_sniper5.ogg"]
    "altFire" : [ "/sfx/gun/mech_beamdrill_windup.ogg" ] -- First sound, then followed by mech_beamsniper_fire.ogg

    - Note, I wasn't sure on how to handle it, so I used the Plasma Rifle's coding to assist, considering it has an animation that plays on it.

    Edit: I created a gif to present what I'm trying to accomplish upon firing the rifle.
    Last edited: Mar 9, 2018
  2. slowcold

    slowcold Pangalactic Porcupine

    Would it not be quicker and easier to make a unified soundfile containing both the wind up and the fire sounds? You'd then just have to worry about timing the animation so the recoil happens with the fire sound.
  3. Novan Crusader

    Novan Crusader Void-Bound Voyager

    Honestly that slipped my mind, thanks for the suggestion in terms of the sound, but now I'm still unsure of how I'm going to accomplish the animation when firing the gun.
  4. slowcold

    slowcold Pangalactic Porcupine

    Sorry, never done an animation. Bk3k is good with them and he usually checks new threads.

Share This Page