Tutorial MOD-TUTORIAL 3: How to make your own Gun (OUTDATED)

Discussion in 'Starbound Modding' started by Ghoul159, Dec 8, 2013.

Thread Status:
Not open for further replies.
  1. AuraMasterNeal

    AuraMasterNeal Void-Bound Voyager

    Ok, i've been working using this tutorial, and the gun is working fine, no crashes or anything, but whatever I try it seems to always use only 1 energy point, making something intended to be obtained in T1 really OP, as you regen energy faster than it uses it.

    aurapulsel.gun

    Code:
    {
      "itemName" : "aurapulsel",
      "inventoryIcon" : "aurapulselicon.png",
      "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
      "maxStack" : 1,
      "level" : 4,
      "rarity" : "Rare",
      "inspectionKind" : "gun",
      "image" : "aurapulsel.png",
      "recoilTime" : 0.1,
      "handPosition" : [-5.5, -3],
      "firePosition" : [12, 3],
      "description" : "My New Gun!",
      "shortdescription" : "Lesser Aura Pulse",
      "classMultiplier" : 0.4,
    
      "fireTime" : 0.5,
      "twoHanded" : false,
    
      "projectileType" : "aurapulse",
      "projectile" : {
        "power" : 15,
        "color" : [10, 100, 255]
      },
    
      "muzzleEffect" : {
        "animation" : "/animations/aurapulse/aurapulse.animation",
        "fireSound" : [ { "file" : "/sfx/aurapower/t1_pulse.wav" } ]
      }
    }
    

    aurapulse.projectile

    Code:
    {
      "projectileName" : "aurapulse",
      "physics" : "laser",
      "bounces" : 0,
      "level" : 3,
      "damageKindImage" : "icon.png",
      "frames" : "aurapulse.png",
      "animationCycle" : 0.5,
      "frameNumber" : 4,
      "energyCostPerDamagePoint" : 8,
      "power" : 50,
      "supportsProcessing" : true,
      "actionOnReap" : [
        {
          "action" : "config",
          "file" : "/projectiles/explosions/plasmabulletexplosion/plasmabulletexplosion.config"
        }
      ],
      "lightColor" : [0, 100, 255],
      "damageKind" : "plasma"
    }
    

    EDIT: And random interesting thing I discovered that I want to point out. If you put a non-existent recipe in the player.config, the game doesn't crash. Don't know how this could be useful, but it is there...
     
    Last edited: Jan 7, 2014
  2. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    the "classMultiplier" lowers the energy cost have you tried to raise it?
    hmm interesting...
     
  3. CakeBandit

    CakeBandit Intergalactic Tourist

    Howdy, I'm working with a buddy and we're getting a myserious error message we don't understand. We aren't following your guide, but maybe you've seen this one anyway.

    Code:
    Error: Could not instantiate item '[DuckNukem, 1, {}]'. VariantException: No such key in Variant::get("projectile")
    We're also seeing a handful of this:

    Code:
    Debug: Correcting path from /items/guns/ducknukem/ducknukem.gun to /items/guns/DuckNukem/DuckNukem.gun
    But we're seeing that for things like Feroziumbar.recipe so we're ignoring it. Anyone got any ideas?
     
  4. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    hmm no i don't think i know that error when do you get it?
    yea the second thing tells you just that starbound changes the path to lower cases but it still works
     
  5. AuraMasterNeal

    AuraMasterNeal Void-Bound Voyager

    i think i've messed with it, but i'll try again. To the test char!

    EDIT: I raised it all the way to 2.2, still regens the energy faster than it's used.
    EDIT 2: Even at 8.2, it does the same thing, makes the last energy bar flash like it was used up and immediately regened.
    EDIT 3: Raised it all the way to 9000.1, still doesn't use more than one point of energy.
    EDIT 4: I even raised the energyCostPerDamagePoint to 50, with the classMultiplier still set to 9000.1, still only uses one point of energy.
    EDIT 5: So I looked around at the other guns, none of them seemed to have energyCostPerDamagePoint or classMultiplier on them. None of them seemed to have anything that would indicate an energy usage either, yet they do use energy.
     
    Last edited: Jan 7, 2014
  6. GARGOZETH

    GARGOZETH Orbital Explorer

    Yes. I used the exact same merge code that you used in your mod, except I changed the item to merge from "MyNewGun" to the name of my gun, Musket.
    Would not having a .modinfo file prevent it from working?
     
    Last edited: Jan 7, 2014
  7. CakeBandit

    CakeBandit Intergalactic Tourist

    That's really good to know.

    The other thing was apparently my coding being wrong and not having base variables for my projectiles, Silly me.
     
  8. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    depends if you create your mod in the starbound/assets folder then no if you add it to your mods/MODNAME folder then yes :)
     
  9. Newominus

    Newominus Scruffy Nerf-Herder

    Try reducing its level
     
    Ghoul159 likes this.
  10. AuraMasterNeal

    AuraMasterNeal Void-Bound Voyager

    I just realized what was happening, i need to recraft it for the energy cost to update. Sorry xD
     
    Ghoul159 likes this.
  11. RockRaid

    RockRaid Scruffy Nerf-Herder

    Thx for the help Ghoul, my gun is now fully functional :D Now there is one more thing: Making a sniper rifle is easy, just take some huge projectiles, low RoF, high damage and such, but does anyone know the proper template for a rocket launcher and a shotgun?
    I'll try my best to scout the assets, but some blueprints would be nice. Happy modding!
     
    Ghoul159 likes this.
  12. PurelyArbitrary

    PurelyArbitrary Scruffy Nerf-Herder

    I want to launch a projectile from the head of my character without him moving his arms like he is holding a gun. Is this possible? If yes, how?
     
  13. IceTF

    IceTF Void-Bound Voyager

    Is it possible to make the animation frames rotate via the projectile or frame files?
     
  14. Thundercraft

    Thundercraft Phantasmal Quasar

    Could someone please explain to me how the values for "handPosition" are calculated. They seem very non-intuitive, since these are often negative values. Does it calculate hand position starting with a position at the center of the image (such as from X:10 and Y:3 on an image 19 pixels wide and 5 pixels tall)? Or does it use something other than image dimensions or pixel position? I'm completely baffled...

    I think I can figure out "firePosition". The second (Y?) value seems to match the pixel position. But the first (X?) value does not always line up with the X pixel of the end of the barrel...
     
  15. RockRaid

    RockRaid Scruffy Nerf-Herder


    Soooo.... this one bothered me too, so I took my time to figure it out. Here is everything I know about "handposition" and "fireposition":

    1. The "handPosition" value tetermines where the center of your character's hand is placed.

    This is your hand:
    ======
    0000==
    000X0=
    0000==
    000===
    ======
    Where = is air, 0 is solid pixel and X marks the treasure the center of your hand.

    The value [0/0] is always the center of you gun.png .If it has dimensions like 24*24 (dunno the word for that lol), [0/0] is instead one to the right an one to the top. like this you can determine where your char's hand is, when "handposition" is [0/0].
    Now you can just start pixel counting. One to the left means the X value is -1, and vice versa. One down means Y is -1 and vice versa.

    For the fire position, it's just the same. The coordinates say where the center of your animation will be, taking the center of your gun.png as a reference point.

    I hope that helped you and all others! happy modding!
     
    Ghoul159 likes this.
  16. RockRaid

    RockRaid Scruffy Nerf-Herder

    I don't think so, but it is fairly easy to turn the frame with a picture editor like Paint.net, and then replace the other parts of the frame.png with it.
     
    Ghoul159 likes this.
  17. RockRaid

    RockRaid Scruffy Nerf-Herder

    Currently not, as the holding animation from your char is bound to the .gun file format. Maybe later, when you are able to create own file classes, but for now, no sorry. But cool idea though! I can imagine my Glitch firing a beam of Plasma from his glowing red eyes :D
     
    Ghoul159 likes this.
  18. IceTF

    IceTF Void-Bound Voyager

    Aye, it was just for the sake of saving space, considering the frames were rather long.
     
  19. ArmoredBound

    ArmoredBound Void-Bound Voyager

    Could you help me with this bug? i did the tutorial, finished mod, but when i tried to go in starbound there was some error that was like: JsonParsingException: Error parsing json: bad object, should be ':' at 3:14, i checked all the files and they were all fine, could you maybe download the file and see if theres anything wrong? oh and heres a link: http://community.playstarbound.com/index.php?resources/lasor-guns.1012/
     
  20. RockRaid

    RockRaid Scruffy Nerf-Herder

    Hm I got that one too a while ago. Try changing the .modinfo file, it may be missing some things.
    Try this one:
    {
    "name" : "Iceguns",
    "version" : "Beta v. Angry Koala",
    "path" : ".",
    "dependencies" : [ ],
    "metadata" : {
    "name" : "Iceguns",
    "description" : "Iceguns",
    "author" : "ArmoredBound",
    "version" : "1.0"
    }
    }

    That's just an example, you can change the name etc. at will ;)

    I hope this fixes the issue, happy modding
     
    Ghoul159 likes this.
Thread Status:
Not open for further replies.

Share This Page