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

    Eathed Pangalactic Porcupine

    From what I've seen, level also changes the energy.
    I don't think that's true. I just created a character without the recipes added. I then closed the game and added the recipes. After joining again they still weren't there. I think you learn the tier1 recipes when you first load your character and then you never learn them again.

    Turns out this wasn't true, thanks for helping figure it out, Westeller.
     
    Last edited: Dec 21, 2013
  2. Facethelight

    Facethelight Existential Complex

    since it seems you're a grandmaster at this, any idea why a custom muzzleflash wouldn't appear? thats my final issue before i finish this mod
     
  3. Eathed

    Eathed Pangalactic Porcupine

    Are you getting any errors in your log, or is the flash just invisible?
     
  4. G4M5T3R

    G4M5T3R Cosmic Narwhal

    Just tested this to confirm for myself before posting. This does not work. If you have progressed beyond a tier1 and try adding a new item to tier1 current save will not get the recipe.
    The same goes for "plain" recipes. They will not be added to existing saves.
     
    Last edited: Dec 21, 2013
  5. Facethelight

    Facethelight Existential Complex

    Error: Could not load /heavymachinegun/muzzleflash/heavymuzzle.png:0 asset, attempting to use default.
     
  6. Westeller

    Westeller Space Penguin Leader

    Are we talking about the same tier1?

    Code:
    
    {
      "defaultHumanoidIdentity" : {
      "gender" : "Male",
      "hairType" : "male2",
      "color" : [51, 117, 237, 255]
      },
    
      "species" : [ "human", "glitch", "hylotl", "apex", "avian", "floran"],
    
      "humanoidTiming" : {
      // Idle, Walk, Run, Jump, Fall, Swim, SwimIdle, Duck, Sit, Lay
      "stateCycle" : [1.0, 0.75, 0.75, 0.25, 0.25, 0.50, 0.50, 1.0, 1.0, 1.0],
      "stateFrames" : [1, 8, 8, 4, 4, 7, 2, 1, 1, 1],
    
      // EmoteIdle, Blabbering, Shouting, Happy, Sad, NEUTRAL, Laugh, Annoyed, Oh, OOOH, Blink, Wink Eat Sleep
      //  , normal  , caps  , :)  , :'(, :|  , :D  ,  , :o, :O  ,  , ;)
      "emoteCycle" : [1.0, 0.3, 0.3, 0.3, 1.0, 0.3, 0.5, 1.0, 1.0, 1.0, 1.0, 0.5, 0.3, 1.0],
      "emoteFrames" : [1, 2, 2, 2, 5, 2, 2, 2, 2, 3, 3, 5, 2, 2]
      },
    
      "defaultItems" : [],
    
      "tierBlueprintsUnlockedMessage" : "New blueprints have been unlocked.",
      "blueprintOnPickupMessage" : "New blueprint available.",
      "defaultBlueprints" : {
      "tier1" : [
        //Mod items
        { "item" : "distillery" },
        { "item" : "forceshield-chip" },
        { "item" : "kirstensummerknitcap" },
        { "item" : "kirstenwingedwizardhat" },
        { "item" : "multispawner" },
        { "item" : "ubspawner" },
        //End mod items
      { "item" : "mininglantern" },
      { "item" : "copperarmorhead" },
      { "item" : "copperarmorchest" },
      { "item" : "copperarmorpants" },
      { "item" : "darkwoodmaterial" },
      { "item" : "yarnspinner" },
      { "item" : "campfire" },
    
    . . . . .
    
    As you can see from this excerpt of my player.config, I do this quite often. I can assure you that recipes added in this spot are given to existing characters. If you are adding recipes to the player.config file like so and not having them appear at the crafting station defined in the the .recipe file, then the recipe or the object it refers to is broken.
     
  7. G4M5T3R

    G4M5T3R Cosmic Narwhal

    Hmm, all I got for that is double check your paths and the names of the files being used. What are the next couple lines of your log? After trying to use default.
     
  8. Eathed

    Eathed Pangalactic Porcupine

    Is everything named right? Someone had a problem earlier where the frames, png, and animation had different names. Beyond that, check your formatting and make sure you didn't forget a comma or something. If you still cant figure it out and are willing to upload your mod, I could take a peek at it.
     
  9. Eathed

    Eathed Pangalactic Porcupine

    That's where I added my recipes and it didn't update on any of my existing characters. Everything works fine after making a new one.
     
  10. G4M5T3R

    G4M5T3R Cosmic Narwhal

    I apologize, and recant my earlier posting. A stupid error on my part when using an existing item for testing. You are 100% right.
     
  11. Westeller

    Westeller Space Penguin Leader

    That's extremely odd. You can use the recipes on new characters but not pre-existing ones, without making any changes between trying different characters? If you'd pass me your player.config, and possibly the recipes (entire mod if custom object), I'd like to look through them for differences between my files and yours.
     
  12. Facethelight

    Facethelight Existential Complex

    fixed, turns out i had the wrong dimensions on the file :rofl:
     
    Ghoul159 and G4M5T3R like this.
  13. michealv

    michealv Industrial Terraformer

    Trial and error, you'll get better and faster at it.
     
  14. M4X_L10N

    M4X_L10N The Court

    G4M5T3R looked at it, fixed it and siad it was working for him, but i still get the same slow asset error unfortunately = /
     
  15. michealv

    michealv Industrial Terraformer

    Could someone please look at my projectile bullet, and coding below, and explain how the game calculates "Size".

    My understanding of it was its based on an X x Y offset, i.e the bullet is 16x16 if you count the transparent space.

    I don't understand why in this, it has 11pixels wide x 3pixels high, in the game it works perfectly, but if i set it to 16x 16, it doesn't display the bullet.

    It's illogical to me and I must be missing something basic!

    {
    "frameGrid" : {
    "size" : [11, 3],
    "dimensions" : [1, 1],

    "names" : [
    [ "0" ]
    ]
    }
    }

    Solved it, i'm a dumbass :p, looking at the bullet icon not the bullet image, doh
     

    Attached Files:

  16. M4X_L10N

    M4X_L10N The Court

    Anyone have a good list of things that are required in animations, frames, etc? What are the limits on each value? For instance is bullet limit 15x15? What about armors. Would relaly really appreciate this info.
     
  17. Westeller

    Westeller Space Penguin Leader

    There are no limits that I'm aware of.
    You could make a bullet that's 3000 x 3000. Just expect things to get wonky when you try to spawn it in-game.

    The are two ways I know of to make a .frames file. The first, and most common, is like this:

    Code:
    {
      "frameGrid" : {
      "size" : [16, 8],
      "dimensions" : [1, 9],
      "names" : [
      [ "default" ],
      [ "red" ],
      [ "blue" ],
      [ "green" ],
      [ "yellow" ],
      [ "orange" ],
      [ "pink" ],
      [ "black" ],
      [ "white" ]
      ]
      }
    }
    
    This simply tells the game that there are 9 individual 16 x 8 frames in the image, on 1 horizontal line, and names them. The game will generally look for the frame named "default" first when trying to display an image. If you can't tell, the "size" value is what tells it the dimensions of each frame on the image, and the "dimensions" value is what tells it how many rows there are and how many frames are on each row.

    The second, usually used by the game for things like body parts and armor, looks like this:

    Code:
    {
      "image" : "head.png",
      "frameList" : {
      "normal" : [43, 0, 86, 43],
      "climb" : [43, 172, 86, 215]
      }
    }
    
    This method lists the individual coordinates for each frame on the spritesheet.
    The coordinates are defined from the top left corner of the spritesheet.
    "normal" in this list is a box. 43 pixels to the right to 86 pixels to the right, and 0 pixels down to 43 pixels down. A 43 x 43 frame.

    ------43---0---86
    --------|----------|-
    ------43--43--86

    Animating a stationary object can be as simple as telling it to cycle frames on a grid, like so:

    Code:
      "inventoryIcon" : "fountainicon.png",
      "orientations" : [
      {
      "image" : "fountain1.png:<color>.<frame>",
      "imagePosition" : [-32, 0],
      "frames" : 3,
      "animationCycle" : 0.4,
    
      "spaceScan" : 0.1,
      "anchors" : [ "bottom" ]
      }
      ],
    
    ....but the game will allow you to create .animation files, to allow for multiple different animations on a single object. Selecting between animations, though, usually requires .lua scripting. I recommend looking up the ironbeacon for an example of how .object, .png, .frames, .animation and .lua can all work together.
     
    Last edited: Dec 21, 2013
  18. HydreNoire

    HydreNoire Void-Bound Voyager

    Howdy! First of all, thanks a billion for introducing us to the joys of gun crafting. I was wondering, do grenade launchers work differently? I used your template as a starting point. Changed the player.config, went to game, was able to craft and use it without problem. I then decided to change the projectiles of the gun to one of the /projectiles/guns/grenades folder. So I replaced the files in the projectile folder of your mod with the ones I wanted (I used the Splitter), renamed them the way they were supposed to and launched the game eager to try my brand new weapon of mass destruction (or at least I assumed it would be). But alas, there was no way to craft it, once I went back to the crafting table, in place of the gun I have a perfectly generic item, which we all know is the placeholder for buggy/unstable items. I tried to change a couple of things (making it two handed, changing the weapontype to "grenade launcher"...) but nothing helped!
    What am I doing wrong ? Are grenade launchers working differently than guns? Should I replace/modify something else than the projectile folder?
     
    Last edited: Dec 21, 2013
  19. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    hey G4M5T3R , Eathed and Westeller thank you for your help! :)

    i'm currently working on a java solution for some modding things in starbound... (not 100% shure how that turns out...)
    i know somebody is doing a great tool with c# but i want to make it available for mac and linux too ;)

    that plus the chistmas holidays are time consuming... this won't let me apear here as much as i usualy do... :oops:


    hi thanks :), hmm i think grenade launcher use the "physics" : "grenade", parameter too try that maybe :) and keep in mind if you take things out of the random generated folder there are random values like "rateOfFire" : [0.3, 1], which i would convert to "rateOfFire" : 1,... (i have never tried to use random values on unique guns... some may not work)
     
    bruriel likes this.
  20. Jnr_KentuckyFriedSpy

    Jnr_KentuckyFriedSpy Void-Bound Voyager

    Untitled.png I followed the instructions very carefully but when I go to a crafting table I find the recipe but it is named Perfectly Generic Item, with the icon of a green block. I know it's my gun recipe because when I change the values of the recipe so does that item for instance the first time I looked at the Perfectly Generic Item Recipe it needed 200 pixel and 25 iron bars which my gun also needed then when I changed the pixel amount to 1 so did the Perfectly Generic Item's pixel amount changed.
     
    Last edited: Dec 22, 2013
Thread Status:
Not open for further replies.

Share This Page