Tutorial Animated Weapons

Discussion in 'Starbound Modding' started by Phlosioneer, Dec 9, 2013.

  1. Phlosioneer

    Phlosioneer Pangalactic Porcupine

    Firstly, if you want to make a weapon, go to this tutorial: http://community.playstarbound.com/index.php?threads/mod-tutorial-3-how-to-make-your-own-gun.42937/

    This tutorial assumes you have already made the desired weapon, and now you want to animate it.

    WARNING: This tutorial is not fully complete; some things are left to the reader to figure out. These will be pointed out explicitly.

    First, so that we're all on the same page, here's the file I'm starting with. It was created in the tutorial linked above.

    Now, in order to animate the gun, we need an animation. There are three types of animations: linear, extrapolated, and wrapping. linear animations work like the bow: the animation will happen once, and that's it. Wrapping animations work like a loop: the animation will keep repeating over and over. I don't know what extrapolated animations do.

    Animations are just a series of copies of an image in the same png file. For an example, look at the bow's animation:
    Starbound requires a file to specify the number of frames and dimensions of each frame. This file should have the same name as the image, but with a *.frames file ending. For this example, our frames file would be named "revolver.frames". See the link at the top of this post for the format of the frames file; it's exactly the same format as any other starbound frames file.

    Next, we need to modify our file. Here's the changes we'll make:
    • Change "image" from "revolver.png" to "revolver.png:<frame>". DO NOT actually change the image file's name; it can stay revolver.png.
    • Add "imageFrameSelector" : "yourFrameSelector",
    Now we need to go to the ../leveling/ folder. Here, we need to make a new text file called <weapon_name>.lvlfunction. So, since our gun file is "revolver.gun", we make a new file called "revolver.lvlfunction". As usual, start with an open curly bracket, and end the file with a closing curly bracket. Here, we do the following:
    • Add "yourFrameSelector" : [ "linear", "clamp", [0,0], ...etc.
    Here is where you tell starbound how you want your animation to play out. The first parameter is the interpolation; the options are "halfStep", "linear", or "cubic". If you don't know what this means, just use "linear". The second parameter is the animation type. The options are "clamp", "extrapolate", or "wrap". These are the same choices I talked about earlier; use whichever one you want.

    And now you're done! There's a ton of fancy things you can do with lvlfunctions, like tying a projectile's strength to the amount of time you charge it. In fact, this is how bows work in the game; if you want to experiment, just go into the files and mess around with the bow.

    DISCLAIMER: I have not personally tried this stuff (yet - college finals and al :/). I've painstakingly pieced this information together from several hours pouring over disassembled Starbound code & data, and cross-referencing this with the assets folder. Please reply with any additions or corrections, and I'll fix this post as soon as I can.
  2. narhiril

    narhiril Tentacle Wrangler

    Unfortunately, this doesn't seem to do jack for melee weapons.

    Looks like my animated sword might not be possible right now. T_T

    Last edited: Jan 7, 2014
  3. The | Suit

    The | Suit Agent S. Forum Moderator

    So technically its a Theoretical Paper :p
    Phlosioneer likes this.
  4. Wurmheart

    Wurmheart Subatomic Cosmonaut

    so that won't work for random generated weapons either will it?

    Since you need to use a directories folder, split your image in parts and it doesn't use a .frames file from what i know.
  5. Kingpendragon

    Kingpendragon Big Damn Hero

    Wait, this doesn't work for melee? Damn, I even have the sprites for my buzzsaw-axe ready.
  6. narhiril

    narhiril Tentacle Wrangler

    It works for tools, but not for melee weapons. I was incredibly bummed out to learn this, too. I'm hoping this is something that just hasn't been finished yet.

    I've posted a suggestion about it here.
    Last edited: Jan 10, 2014
  7. Ex_Tiger

    Ex_Tiger Void-Bound Voyager

    Great tutorial, helped me alot.
    Works perfectly for gunanimations. (like spinning parts while shooting).

    Phlosioneer likes this.
  8. Phlosioneer

    Phlosioneer Pangalactic Porcupine

    Glad to hear it. I've been far to busy to mod / test yet. :/
  9. StrikerTheHedgefox

    StrikerTheHedgefox Void-Bound Voyager

    How do the numbers in brackets after the animation types work? They make no bloody goddamn sense whatsoever... I'm trying to make a gun have a slide animation that is synchronized with firing, but I'm ripping my hair out. Really wish Chucklefish would set up an official modding documentation Wiki.

Share This Page