Modding Discussion Animated Guns

Discussion in 'Starbound Modding' started by Zancuno, Apr 22, 2016.

  1. Zancuno

    Zancuno Existential Complex

    So.... working with the Lucario mod. I went to updating the Aura Sphere to .activeitem. Although I also decided to try something I saw someone else working on. I saw that you can animate weapons. Although this is usually done with swords. Although I somehow happened to get it to work with guns. Although I ran into an issue which I hope we can discuss.

    This is the animated aura sphere as it currently is

    It looks fine right? Looks like it's working correctly.

    In all seriousness it is not how it appears. Let me show you what it was like previous



    That is how it was previous.

    Now let me explain what is happening and what I did to make it appear to be working correctly.

    It honestly took me a long time and several errors to get the animation.

    I went through many errors and things like this.

    Here is the magical staff of aura spheres held together by.. who knows
    [​IMG]
    That is before I got the animation to even work in the slightest.

    You see it apparently takes creating a custom animation file, frames file, and foreign code to the activeitem file.

    This would have been a ton easier if it was just a .gun file.

    Well I changed the "off" stance on the animation file to that of "idle", set my frames count up, edited my image a bit, and had to input orientation code into the .activeitem file.

    Welp after many hardships and editing I got that second gif the broken version to work and had some laughs.

    Tinkering with the code more I realized something.

    Somehow the animation is not set on the item in hand. Somehow the animation takes place on the muzzle flash frame.

    I have no idea if this is because the muzzle flash is the only animated piece but it caused issues. If you take just one thing off my coding it asks in the starbound.txt file to make muzzle flash frames. If you mess with the offset, frames or orientation seems to be the only time it happens. This isn't necessary and in doing so I know it would probably error. So for now my code is stuck as it is. This means me having to let it stay on the muzzle flash so no errors appear on the starbound.txt file.

    Edit: even when muzzleflash.frames is included, still gives errors.

    So this is what I had to do to make it appear to be working correctly​
    • make an addition frame blank in the image​
    • make the sphere part of the gun's offset as small as possible (can't be 0)​
    • set the muzzle flash's offset just a bit higher than the sphere part​
    • edit frames file to set blank frame as default​
    So in actuality the aura sphere is invisible and the animation is trapped on the muzzle flash. Whenever I shoot the aura sphere, the flash goes off inside the sphere. This is good for the aura sphere being what it is but for any gun this is terrifying.

    I'm going to leave a copy of my aura sphere's codings. I wonder if we can figure this out to then make a guide for animated guns.

    If you can help with the muzzle flash issue and get it to animate on item. I'm sure a lot of modders are going to want to experiment. Also this will help me so I can clean up the code.

    Edit: by now I think the problem lies in the animation file.​
     

    Attached Files:

    Last edited: Apr 22, 2016
  2. C0bra5

    C0bra5 Oxygen Tank

    you might want to change the tooltip kind to something other modders can use, i remember helping you adding the item description back one day on active items, but i don't think everyone has this extension.
     
  3. C0bra5

    C0bra5 Oxygen Tank

    note: this is basically what i have been trying to do for the last week... I OWE YOU A DEATH HUG
     
  4. C0bra5

    C0bra5 Oxygen Tank

    F YEAAAAAAAAAAAAAAAAAAAAAAA
    [​IMG]
     
    AsmodeanMage likes this.
  5. C0bra5

    C0bra5 Oxygen Tank

    the archive since i know someone will ask how the hell i did that
     

    Attached Files:

  6. lazarus78

    lazarus78 The Waste of Time

    Thiere is a "gun" called "Gnome Gun" that has an animation for the weapon itself.

    https://twitter.com/StarboundGame/status/722422090155036672

    Relevant code for the animation
    Code:
    "animatedParts" : {
            "stateTypes" : {
                "gnome" : {
                    "default" : "squirm",
                    "states" : {
                        "idle" : {
                            "properties" : {
                                "lightsOff" : ["red", "green", "blue"]
                            }
                        },
                        "squirm" : {
                            "frames" : 8,
                            "cycle" : 1.0,
                            "mode" : "loop",
                            "properties" : {
                                "lightsOff" : ["red", "green", "blue"]
                            }
                        },
                        "fire" : {
                            "frames" : 4,
                            "cycle" : 0.25,
                            "mode" : "loop",
                            "properties" : {
                                "lightsOn" : ["red", "green", "blue"]
                            }
                        }
                    }
                },
    ...
    
     
  7. Zancuno

    Zancuno Existential Complex

    Noted x.x and still thank you for that
     
  8. Zancuno

    Zancuno Existential Complex

    huh that points out a few things missing from the animation file... although I'm also worried about the parts coding since on mine, the animation if affecting both the item in hand and the muzzle flash... almost as if it recognizes them as one piece.. Also that gnome gun looks fun. (reminds me a bit of those lawn gnomes from zOMG back in time on Gaia Online, except now you abuse them)
     
  9. Zancuno

    Zancuno Existential Complex

    Uh not only the chest spike is an issue but I am on fire as well. I wouldn't suggest it. :rofl:
     
  10. C0bra5

    C0bra5 Oxygen Tank

    That's why it's called a death hug :rofl:
     
  11. Zancuno

    Zancuno Existential Complex

    I have a feeling.... and if it's right... this will solve the issue... I'm going to try linking the muzzle flash picture to the fire animation and see what it does.
     
  12. Zancuno

    Zancuno Existential Complex

    ah nope.... why... is the muzzle flash doing the switch?... can't understand it... If I could look at the full code of the gnome gun it would help x.x
     
  13. lazarus78

    lazarus78 The Waste of Time

    here you go.
     

    Attached Files:

  14. Zancuno

    Zancuno Existential Complex

    I have no idea how you got that.... but ummm.. Thank you
     
  15. lazarus78

    lazarus78 The Waste of Time

    I have the assets from 4/20 unpacked. The gnome gun was just added then.
     
  16. C0bra5

    C0bra5 Oxygen Tank

    i remember finding a gnome gun in game a long time ago, i guess they updated it...
     
  17. lazarus78

    lazarus78 The Waste of Time

    Yeah the one that shot rainbows in an arc. I remember that one too.
     
  18. Zancuno

    Zancuno Existential Complex

    You know that gnome gun just pointed out exactly what was wrong. Looking at the file a bit. The gnome has two categories for animation. They are separated as gnome and firing. I'm cleaning up the code a bit and if this works right. A template will be easy to make. The issue with the animation being on the muzzle flash was actually because without separating the animations into two (didn't think till I saw the animation file for the gnome) it actually was stacking on the muzzle flash because it saw the sphere as part of the firing animation.

    it just feels like it was so obvious... and I missed it..
     
  19. Zancuno

    Zancuno Existential Complex

    looks like some special frames are in order... looks like just for the item animation you need an idle frame, the animation, and a frame of when shot. I'm having to re-work everything. Every time I play the game, a single shot crashes the game :rofl:
     
  20. Zancuno

    Zancuno Existential Complex

    well I've got something that works. I'll have to edit this post later but it's animated gun templates but of this category:
    No muzzle flash
    Basic frames, nothing special
    For single piece guns

    It'll take you replacing the <insert>'s with your own stuff but I hope it helps. Lets see if I can get some templates for things like with muzzle flash, multi parts, idle/animation/fire frames.
     

    Attached Files:

    AsmodeanMage likes this.

Share This Page