Modding Help How do you animate a Minigun's barrel spin?

Discussion in 'Starbound Modding' started by Reilsss, May 14, 2015.

  1. Reilsss

    Reilsss Scruffy Nerf-Herder

    Hi, I want to make a minigun, with a animated barrel.
    Sofar I understand that I need a frames defintion, for my image, with has more then 1 frame.
    My Item needs the frames info, and that I need a leveling function for a ImageSelector.

    I dont really understand how the ImageSelector is supposed to work. I Guess I fail to understand the concept demonstrated with the bow.

    If i use Clamp it does play the animation a little but I like it to repeat as long you press fire.

    My Weapon Item is defined as this:
    Code:
    {
      "itemName" : "kazdra_L4-2_Chaingun",
      "inventoryIcon" : "Icon.png",
      "description" : "The six spinning barrels of this heavy machine gun, allow an ever greater rate of fire, while ensuring overheat problems.",
      "shortdescription" : "Minigun",
      "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
      "maxStack" : 1,
      "level" : 4,
      "rarity" : "Rare",
      "inspectionKind" : "gun",
      "image" : "kazdra_L4-2_Chaingun.png:<frame>",
      "imageFrameSelector" : "chaingunImageSelector",
      "recoilTime" : 0.1,
      "handPosition" : [-5, -2.5],
      "firePosition" : [20, 1],
      "weaponType" : "Assault Rifle",
      "twoHanded" : true,
      "accuracy" : 90,
      "fireTime" : 0.13,
      "classMultiplier" : 0.14,
      "muzzleFlashes" : [ "/animations/muzzleflash/kazdra_L4-2_Muzzle/kazdra_L4-2_Muzzle.animation" ],
      "projectileType" : "kazdra_L4-2_prj",
      "projectile" : {
        "power" : 8.0,
        "color" : [10, 255, 10]
      },
      "muzzleEffect" : {
        "animation" : "/animations/muzzleflash/kazdra_L4-2_Muzzle/kazdra_L4-2_Muzzle.animation",
        "fireSound" : [ { "file" : "/sfx/Guns/kazdra_L4-2_Chaingun.wav" } ]
      }
    }
    My Frames code is this:
    Code:
    {
      "frameGrid" : {
        "size" : [34, 16],
        "dimensions" : [2, 1]
      },
      "aliases" : {
        "idle" : "0"
      }
    }
    
    And the Function Code is:
    Code:
    {
        "chaingunImageSelector" : [ "linear", "wrap", [0, 0], [0.1, 1], [0.2, 0], [0.3, 1], [0.4, 0], [0.5, 1] ]
    }
    
    The Animation is not really playing at all, and I belive its because the ImageSelector code is not rigth. But no idea what it suppost to look like. Also yes the animation is based only on 2 frames i want to loop while the gun fires.

    Has anyone a idea how to do this rigth?
     
  2. Kayuko

    Kayuko Oxygen Tank

    Nvm what I just wrote.
    Not very experienced in animating guns, but I'm somehow pretty sure you do not need the imageframeselector to do that.
    Shouldn't it work with a linked .animation file? You can easily loop animations there.
    The problem itself would rather be, limiting the animation to the fire-function (only animates when fired).
     
  3. Reilsss

    Reilsss Scruffy Nerf-Herder

    Linked Animation file ? Not sure on that, I'm not too experinced and orginally hoped to see a example mod / object, to learn the process from there.

    I guess I wont mind if the thing where animated all the time. (You could argument to have the weapon prespin).
     
  4. Kayuko

    Kayuko Oxygen Tank

    Studying gun animations then, gimme a sec.
    Maybe I can find a way to help you somehow. o:[DOUBLEPOST=1431639117][/DOUBLEPOST]

    {
    "itemName" : "bow",
    "inventoryIcon" : "bowicon.png",
    "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
    "maxStack" : 1,
    "rarity" : "Common",
    "tooltipKind" : "bow",
    "weaponType" : "Bow",
    "description" : "Harvests meat and other goods from monsters.",
    "shortdescription" : "Hunting Bow",
    "image" : "bowfull.png:<frame>",
    "imageFrameSelector" : "bowImageSelector",
    "handPosition" : [-2, 0],
    "firePosition" : [20, 1.5],
    "level" : 1,
    "fireTime" : 0.25,
    "inaccuracy" : 0.01,
    "twoHanded" : true,

    "fireOnRelease" : true,
    "walkWhileFiring" : true,

    "projectileType" : "woodenarrow",
    "powerProjectileType" : "chargedarrow",
    "powerProjectileTime" : [0.9, 1.1],
    "projectile" : {
    "speed" : 60,
    "speedCurve" : "drawTimeMultiplier",
    "power" : 4,
    "powerCurve" : "drawTimeMultiplier",
    "color" : [10, 255, 10]
    },

    "muzzleEffect" : {
    "fireSound" : [ { "file" : "/sfx/gun/bow_loose.wav" } ]
    }
    }


    Bows define their animation through drawing.
    As long as you draw, it keeps animating till it hit a specific point.
    You posted the function, but I couldn't find the file where "bowImageSelector" is defined, do you mind giving me a hint? (I admit, I was too lazy to search)
    I think I've got some ideas to how getting it to work.
     
    Last edited: May 14, 2015
  5. Reilsss

    Reilsss Scruffy Nerf-Herder

    this function files are found inside the "leveling" folder. The one I use is based on the blaster gun item. The File migth have sligth diffrent name but ther not many function files in the leveling folder (at last in my unpacked assets)
     
  6. Kayuko

    Kayuko Oxygen Tank

    Lol, that's never where I'd look for that.
    However, I need to attend something else, I'll check that and also check if the method I got in mind is possible soon.
    Stay tuned! :3

    Okay apparently that's not what this function is for.
    That eliminates one possibility.
    Then there'd still be the muzzle thing I spoke of earlier.
    Set the fireposition to the right position, alter the framefile so that it animates the barrel and match the things so they work together, when you alter the animation of the muzzlefire it'll fake a spin everytime you shoot.

    Keep in mind that this is a rather dirty solution for some reasons:

    The mainframe (default thing while holding the item) and the animation will overlap.
    It will immediately stop once you stop firing, so theres no slowdown in the animation, after you stopped shooting and no speedup when you start shooting.

    Maybe someone more familiar with weaponanimations will come along with another idea, but I just can't think of an holdable item that's animated in any way, sry.
     
    Last edited: May 15, 2015
  7. Reilsss

    Reilsss Scruffy Nerf-Herder

    I want to thank you for giving me ideas and trys, I guess I need to return to this matter once I come back from my jorny. With I'm leaving for today.

    Thank you again for trying to help me. I guess the muzzle fire animation is one possiblity in the end. If nothing else works out. But there should be a more striahgt forward way to do so.
     
  8. The | Suit

    The | Suit Agent S. Forum Moderator

    Quite a few mods already implement this - your best solution is to just look at those already made.
    But from looking at it your frames file is wrong an you really don't need a imageFrameSelector .
     
  9. Reilsss

    Reilsss Scruffy Nerf-Herder

    I shall go and look finding this mods you menton. And try to learn by there example.

    EDIT: Loooked around all for a example mod and didnt find anything, that uses weapon animations like a minigun (change animation when fired).

    Therefor I now presume its not yet possible to do this, and consider to continue my work without that feature. because honestly I have no idea how to achive this properly and there no examples either.
     
    Last edited: May 21, 2015
  10. The | Suit

    The | Suit Agent S. Forum Moderator

    Just talked to meta today - he said don't bother trying to animate it right now. Things are changing in a few weeks.
     

Share This Page