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. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    My other tutorials:

    Tutorial 1: How to make your own Tool
    http://community.playstarbound.com/index.php?threads/mod-tutorial-1-how-to-make-your-own-tool.40643/

    Tutorial 2: How to create your own Crafting Table:
    http://community.playstarbound.com/...-2-how-to-make-your-own-crafting-table.44992/

    Tutorial 4: How to make your own Armor
    http://community.playstarbound.com/...-tutorial-4-how-to-make-your-own-armor.46928/

    Tutorial 5: How to use "Ghouls Modmaker"
    http://community.playstarbound.com/...ow-to-use-ghouls-modmaker.60643/#post-1616672


    Tutorial 3: How to make your own Gun (at the end there is a example file)

    3.1
    Setup your own mod folder with whatever mod name you like (it don't have to be like the weapon you create)
    in the Starbound\mods folder:
    [​IMG]

    into the new created mod-folder you have to create a "MyNewGunMod.modinfo" file just rename a ".txt" to it...

    and write the following:
    [​IMG]


    you should create the following subfolders:
    "recipes" , "sfx", "projectiles\MyNewGunProjectile\", "items\guns\MyNewGun\" and
    "animations\muzzleflash\gunmuzzleflash\"
    (at the end there is an example with images...)

    to keep your "MyNewGunMod" folder clean and have a good overview even with many new mod items


    3.2 [basic fIles]
    The fastest way as always is to copy the important files into your mod folder and to rename them
    copy and rename from:
    "\Starbound\assets\items\guns\test\" to"MyNewGun\items\guns\MyNewGun\"

    revolver.png -> MyNewGun.png
    revolver.gun -> MyNewGun.gun
    revolvericon.png -> MyNewGunicon.png

    and from(if you want to make it craftable):
    "Starbound\assets\recipes\weapons\other\" (just to get the formating right)

    huntingknife.recipe -> MyNewGun.recipe

    now open the recipe
    [​IMG]
    "input" : (all items you need to craft this item)[
    { "item" : "money", "count" : 10 } (money in this case are the pixels :) )
    ],
    "output" : (what item you get out of this recipe){ "item" : "MyNewGun", "count" : 1 },
    "groups" : (the "anvil" says you can craft it only with an anvil but we will change it to "craftingtable" because it's faster for this tutorial. "weapons" and "all" are further categorys for this recipe)[ "anvil", "weapons", "all" ]

    No we create a merge file for our player.config so that we don't have to edit the original:
    Create a new "player.config" file in your MyNewGunMod folder...

    So edit the new player.config and write the following in it:
    [​IMG]
    now our recipe is already learned with tier1... if you add more items don't foreget the , like this:
    { "item" : "MyNewGun" },
    { "item" : "MyNewGun2" }

    3.3 [sound and muzzleflash]
    Furthermore we copy and rename these items(i placed these in subfolders to keep my mod organized):

    "/sfx/gun/pistol2.wav" -> "Starbound/mods/MyNewGunMod/sfx/MyNewGunSound.wav"

    Of course you can make your own "MyNewGunSound.wav" if you want to

    "/animations/muzzleflash/bulletmuzzle3/bulletmuzzle3.animation" -> "Starbound/mods/MyNewGunMod/animations/muzzleflash/gunmuzzleflash/MyNewGunMF.animation"

    "/animations/muzzleflash/bulletmuzzle3/bulletmuzzle3.png" -> "Starbound/mods/MyNewGunMod/animations/muzzleflash/gunmuzzleflash/MyNewGunMF.png"

    "/animations/muzzleflash/bulletmuzzle3/bulletmuzzle3.frames" -> "Starbound/mods/MyNewGunMod/animations/muzzleflash/gunmuzzleflash/MyNewGunMF.frames"

    Open the "MyNewGunMF.png" and you'll see 3 frames edit these or draw as many frames as you like on your own
    (important you have to know how the scale is of these frames are and everyone must have the same size)

    now we edit the "MyNewGunMF.frames"
    [​IMG]
    {
    "frameGrid" : (the complete image contains the following){
    "size" : (one frame got the dimension x15, y15)[15, 15],
    "dimensions" : (it says there are 6 different frames WHICH IS WRONG maybe a typo in this example so change it to how many frames you got for X and Y )[3, 1]
    }
    }

    we continue with editing the "MyNewGunMF.animation":
    [​IMG]
    {
    "frames" : (the name of the new muzzleflash)"MyNewGunMF.png",
    "variants" : (we got only 1 variant of the flash so we take)1,
    "frameNumber" : (how many frames we got)3,
    "animationCycle" : (i think the speed the animation cycles)0.03,
    "offset" : (the offset of the flash)[-3, 0]
    }

    3.4 [back to the basic files]
    Edit the "MyNewGun.png"(the gun image in your hand) and "MyNewGunicon.png"(the icon in the inventory) as you please

    now open the MyNewGun.gun
    [​IMG]
    "itemName" : (the name of the gun)"MyNewGun",
    "inventoryIcon" : (the name of our edited icon image)"MyNewGunicon.png",
    "description" : (important! you wont see this at the crafting table but otherwise i get errors i thonk :) )"My New Gun!",
    "shortdescription" : (important! this should be included else the weapon will have no name at your crafting table)"MyNewGun",
    "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
    "maxStack" : (how high you can stack this weapon)1,
    "level" : (what level this item is i think it almost multiplies the damage(may changed after hotfix))2,
    "rarity" : (of course the rarity of the item)"Rare",
    "inspectionKind" : (i think this is the description for the magnifer glass)"gun",
    "image" : (this is our new image for the weapon)"MyNewGun.png",
    "recoilTime" : (how fast the recoil animation is i think)0.1,
    "handPosition" : (where the hand grabs the weapon)[-5.5, -3],
    "firePosition" : (where the shot comes out from)[12, 3],
    "classMultiplier" : (this let's you additionaly turn down the energy cost for strong weapons)0.4,

    "fireTime" : (how fast your weapon fires)0.5,
    "twoHanded" : (is this a two handed weapon?)false,

    "projectileType" : (this is our new projectile we'll make in the next step call it how you want to call the projectile in the next step)"MyNewGunProjectile",
    "projectile" : (these are stats you can specifiy for this weapon with this projectile. the speed and color are examples look at other weapons for other examples){
    "power" : (this is the actual damage displayed and a energy per shot multiplier!)25,
    "speed" : (projectile speed)60,
    "color" : (projectile color overlay)[10, 255, 10]
    },

    "muzzleEffect" : {
    "animation" : (the muzzle flash effect we made)"/animations/muzzleflash/gunmuzzleflash/MyNewGunMuzzleFlashImage.animation",
    "fireSound" : (the fire sound effect we made)[ { "file" : "/sfx/MyNewGunSound.wav" } ]

    3.5 [projectile]
    now we have come to the projectile. We alredy called it "MyNewGunProjectile" in the "MyNewGun.gun".
    next up we copy and rename our example files from "Starbound\assets\projectiles\guns\bullets\bullet-1" into the "MyNewGunMod\projectiles\MyNewGunProjectile\ folder.

    bullet-1.frames -> MyNewGunProjectile.frames
    bullet-1.png -> MyNewGunProjectile.png
    bullet-1.projectile -> MyNewGunProjectile.projectile
    icon.png -> MyNewGunProjectileicon.png

    edit the "MyNewGunProjectileicon.png"(which is the displayed damage type) and "MyNewGunProjectile.png"(which is the projectile you shot) as you please

    now open the "MyNewGunProjectile.frames"
    [​IMG]
    this frames file is exactly like the others and we just have 1 frame so wen can leave the dimensions to 1, 1

    open the "MyNewGunProjectile.projectile"
    [​IMG]
    "projectileName" : (the name of our projectile)"MyNewGunProjectile",
    "frames" : (our new png for the shot)"MyNewGunProjectile.png",
    "animationCycle" : (how fast plays the animation)0.25,
    "level" : (this level of the weapon replaced the armor penetration)3,
    "energyCostPerDamagePoint" : (self-explainatory)15,
    "frameNumber" : (self-explainatory)1,
    "damageKindImage" : (will be shown in the inspector under the weapon)"MyNewGunProjectileicon.png",
    "pointLight" : (does this projectile emit light)false,
    "actionOnReap" : [
    {
    "action" : (this is the configuration what happens on impact you can look at the file and others in the folder for some good examples. If you want to make a custom one just copy this file to your mod folder rename it and edit in what you want)"config",
    "file" : "/projectiles/explosions/bulletexplosion/bulletexplosion.config"
    }
    ],
    "power" : (i think the amount of damage for random guns)5.0,
    "damageKind" : (self-explainatory)"default"

    most of these only count for random generated or other guns... because you set the power for example already in the "MyNewGun.gun"

    3.6
    Let's test our new gun(i just made a few red pixels to make it quick) :)
    [​IMG]

    this is what our modfolder looks like at the end(if we finished all steps):
    [​IMG]

    and the complete folder structure:

    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]


    UPDATED EXAMPLE FILE:
    https://www.dropbox.com/s/avad4ogu87jh8uw/MyNewGunMod.zip


    PS:
    Sorry for the typos and if you have problems or if i made a mistake post it ;).
    I used notepad++ to view and edit the text files but you can of course edit them with any other text editor.
     
    Last edited: Jan 12, 2014
  2. SaintPanda

    SaintPanda Scruffy Nerf-Herder

    Do I need a new character to make the gun?
    Also, I made it as a "plain" recipe, and it doesn't show up....
    What did I do wrong?
     
    Last edited: Dec 9, 2013
  3. Logan Marks

    Logan Marks Void-Bound Voyager

    I got this to work yesterday. But I also can't get a new piece of content to show up in the crafting window.

    I've added it to the default blueprints as well.
     
  4. Logan Marks

    Logan Marks Void-Bound Voyager

    Actually my recipe had an extra comma so I assume that's why it didn't show up.

    Something odd I've figured out is that if you create a projectile with a large speed, (200 or so), the aim is way off center. Anyone know why?
     
  5. Ashment

    Ashment Orbital Explorer

    Is there a way too change the fire point of the gun? Would appreciate a response. Thanks!
     
  6. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    no you should not need to make a new character for the gun...
    did you add it to the player.config?

    Hmm that is really odd maybe it's a rounding issue inside the source code at least it sounds like it...


    yes like in the tutorial i think the "firePosition" inside the "MyNewGun.gun" is the fire point if you meant this...
     
  7. SaintPanda

    SaintPanda Scruffy Nerf-Herder

    Well......I just put it in the player.config, and it showed up. I crafted it, but the crafting/inventory icons did not show up. It was invisible in my hand, and when I tried to fire it, it closed out Starbound with no error message.
    Now what?
     
  8. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    do you have no typos in the "MyNewGun.gun"?:
    "inventoryIcon" : (the name of our edited icon image)"MyNewGunicon.png", <- sorry here was a typo i forgot the "icon"
    "image" : (this is our new image for the weapon)"MyNewGun.png", <- and dont forget the commas

    are both of your "MyNewGun.png" and "MyNewGunicon.png" in the same folder?
    otherwise you have to write the path in the "MyNewGun.gun" i think
     
    Last edited: Dec 9, 2013
  9. SaintPanda

    SaintPanda Scruffy Nerf-Herder

    Code:
    {
      "itemName" : "USCMHandgun",
      "inventoryIcon" : "USCMHandgunicon.png",
      "description" : "The best handgun around!",
      "shortdescription" : "USCM Handgun",
      "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
      "maxStack" : 1,
      "level" : 15,
      "rarity" : "Rare",
      "inspectionKind" : "gun",
      "image" : "USCMHandgun.png",
      "recoilTime" : 0.1,
      "handPosition" : [-5.5, -3],
      "firePosition" : [12, 3],
     
      "fireTime" : 0.5,
      "twoHanded" : false,
     
      "projectileType" : "USCMHandgunProjectile",
      "projectile" : {
      "speed" : 60,
        "color" : [10, 255, 10]
      },
     
      "muzzleEffect" : {
        "animation" : "/MyNewGun/USCMHandgunMF.animation:",
        "fireSound" : [ { "file" : "/MyNewGun/Projectile/USCMHandgunSound.wav" } ]
      }
    }
    
    There's my USCMHandgun.gun
    I have my USCMHandgun.png and USCMHandgunicon.png in the same folder. Also, the only subfolder I made was Projectle, because I just heaped it all into the same folder originally, and there were problems with moving it.
     
  10. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    you called the item in the recipe "USCMHandgun"?
    and your modfolder is called "MyNewGun" as you typed in the "muzzleEffect"?
     
  11. Anonymous

    Anonymous Forum Bot

    Can you make a video i don't understand srry.
     
  12. Matterialize

    Matterialize Scruffy Nerf-Herder

    Does anyone know how to affect projectile speed on a randomly generated gun? I had hoped the projectile speed variable listed here would work, but it seems that it only works on 'unique' guns like this that aren't randomly generated.
     
  13. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    i'll think about it

    you can add the speed parameter to the .projectile too...
    for example:

    "speed" : 180,
     
    Last edited: Dec 9, 2013
    Matterialize likes this.
  14. Matterialize

    Matterialize Scruffy Nerf-Herder

    That did it! Thank you!

    I noticed an interesting bug, though - when projectile speed gets too high, it does not always fly directly toward the cursor. Shooting directly horizontally, vertically and at 45 degree angles works fine. But if you aim in between those angles, the projectile becomes more and more displaced from where the cursor aims, based on how fast the projectile moves. At higher speeds, around 100 or so, it's a noticeable displacement but still manageable. At 200 there's a huge gap. At lower speeds like 25, the gun seems to shoot accurately at all angles. This is probably only an issue if you're trying to hit things far away from you at 2x zoom, but still.

    A bit of a bummer, because my gun is a laser pistol and I wanted the projectile to move pretty quickly. I think I'll have to put up with a slower laser for now.
     
  15. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    Nice no problem.
    Yea others noted that too... but i don't know a fix for that... :(
    have you tried to turn up the "accuracy" parameter in ".generatedgun" ?
     
  16. SaintPanda

    SaintPanda Scruffy Nerf-Herder

    Yes and Yes.
     
  17. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    hmm i just compared all my test files with these in my post they are the same...
    the problem is that both images are not showing up and it crashes if you shoot right?

    could you please check your naming of the images and inside of the files again?
    and recraft the item (you don't have to make a new character)

    if nothing else helps you can send me the files and folders and i'll look over it... (if you want)
    hmm or i could just upload my example... wait a minute :)

    Edit: Ok uploaded it...
     
    Last edited: Dec 9, 2013
  18. SaintPanda

    SaintPanda Scruffy Nerf-Herder

    I tried crating again, didn't work, still invisible and crashing. Also, I didn't find any typos.
    How do I send you the files?
     
  19. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    i just uploaded my tutorial gun (red overpainted and with custom sound) within the first post... ;)
    as example... if this won't help you could upload it at any filehoster you like and pm me the download link...
     
  20. necKros

    necKros Space Hobo

    Thanks, iteresting breakdown!
     
Thread Status:
Not open for further replies.

Share This Page