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

    ArmoredBound Void-Bound Voyager

    Thanks so much! it works! hope it doesn't crash on me.
    EDIT: fixed the first bug, new bug. the new bug says it failed to load projectile. D:
    EDIT: fixed the bug, now it works fine, just repeated the level code in projectile.
     
    Last edited: Jan 10, 2014
  2. RockRaid

    RockRaid Scruffy Nerf-Herder

    Aha!
    This is your projectile code:
    {
    "projectileName" : "Icegunshot",
    "physics" : "laser",
    "bounces" : 0,
    "level" : 3, This one is properly
    "damageKindImage" : "Icegunshoticon.png",
    "frames" : "Icegunshot.png",
    "animationCycle" : 0.25,
    "level" : 6 Twice a level =/= twice the awesome :D
    "energyCostPerDamagePoint" : 1, Don't forget commas!
    "frameNumber" : 4,
    "power" : 50,
    "supportsProcessing" : true,
    "actionOnReap" : [
    {
    "action" : "config",
    "file" : "/projectiles/explosions/plasmabulletexplosion/plasmabulletexplosion.config"
    }
    ],
    "lightColor" : [0, 73, 0],
    "damageKind" : "plasma"
    }

    I tried it, should work now.
    EDIT: Oh, I see you got it on your own :coffee:
     
  3. ArmoredBound

    ArmoredBound Void-Bound Voyager

    Now that the mod is almost ready to be uploaded as a working mod.... how the heck do i make a crafting recipe without player.config, i tried smelting a crafting table to create a torn recipe sheet, the crafting table wont smelt.
    EDIT: got that working, now i can craft everything, but the ice gun/whatever it is is a perfectly generic item, single player and multiplayer. dont know how to fix it, i will update download link so that someone can look at it again. i haven't found anything wrong. probably because i just started coding X3
     
    Last edited: Jan 10, 2014
  4. RockRaid

    RockRaid Scruffy Nerf-Herder

    You said you haven't found anything wrong, however the game usually creates perfectly generic items when there is some issue with the code. I will download it again and see what I find. :up:
     
    Ghoul159 likes this.
  5. ArmoredBound

    ArmoredBound Void-Bound Voyager

    Thanks! because i couldn't find anything that is bad code. :D
     
  6. GARGOZETH

    GARGOZETH Orbital Explorer

    Could someone PLEASE help me. I keep getting this error :

    Error: Exception caught in Thread Async root loader: VariantException: Improper conversion to VariantMap from null

    does anyone know what it could mean?
     
  7. ArmoredBound

    ArmoredBound Void-Bound Voyager

    ummm i just added some coding to the projectiles file in attempt to make it work. now it doesn't even show up on the crafting....... yeah............ someone help please. o_O
     
  8. RockRaid

    RockRaid Scruffy Nerf-Herder

    Sry for the long wait, I've been busy during the weekend.
    This is what I found:

    {
    "itemName" : "icegun",
    "inventoryIcon" : "Icegunsicon.png",
    "description" : "Weakest of the Lasors.",
    "shortdescription" : "Green Lasor Mk1", you forgot some commas here and there
    "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
    "maxStack" : 1,
    "level" : 15,
    "rarity" : "Rare",
    "inspectionKind" : "gun",
    "image" : "Iceguns.png",
    "recoilTime" : 0.1,
    "handPosition" : [-5.5, -3],
    "firePosition" : [12, 3],
    "classMultiplier" : 0.1,

    "fireTime" : 6.5,
    "twoHanded" : false,

    "projectileType" : "Icegunshot",
    "projectile" : {
    "power" : 25,
    "speed" : 60,

    "color" : [10, 255, 10]
    },

    "muzzleEffect" : {
    "animation" : "/icegun/muzzleflash/IcegunsMF.animation",
    "fireSound" : [ { "file" : "/icegun/sfx/IcegunsSound.wav" } ]
    }
    }

    My advise? Get Notepad++. It's a free tool which makes editing code files MUCH easier. Check it out:
    http://notepad-plus-plus.org/
    Try again, I hope you get your mod working soon :up:
    EDIT: The projectile of your first version was fine (after we found the error), if you lost it, take the code from one of my older posts.
     
  9. ArmoredBound

    ArmoredBound Void-Bound Voyager

    Thanks! and i do use notepad++.
     
  10. ArmoredBound

    ArmoredBound Void-Bound Voyager

    Woohoo! i can craft it now! it has a texture, but.... when i try and shoot the game crashes... oh and i tried and made a new crafting table, its invisible. i dont know why, i will put a link to my new mod with the half working gun and the invisible crafting table: http://community.playstarbound.com/index.php?resources/starbounders-extra.1032/
     
  11. RockRaid

    RockRaid Scruffy Nerf-Herder

    First of all: YAY it works!
    To the crash: This is what commonly happens when the game cannot load the projectile or the muzzle flash animation. Check the log again pls. Regarding your crafting table, there is little I know about that one :(
    I will check your mod again to figure out the first problem, but
    Ghoul, i know you read this, help me out with this one!
    Let's see what I find.
     
  12. RockRaid

    RockRaid Scruffy Nerf-Herder

    Ok the error SEEMS quite simple: You renamed your mod folder to "BoundExtra", but did not change the file paths in the .gun file. Example here:
    {
    "itemName" : "icegun",
    "inventoryIcon" : "Icegunsicon.png",
    "description" : "Weakest of the Lasors.",
    "shortdescription" : "Green Lasor Mk1",
    "dropCollision" : [-8.0, -3.0, 8.0, 3.0],
    "maxStack" : 1,
    "level" : 15,
    "rarity" : "Rare",
    "inspectionKind" : "gun",
    "image" : "Iceguns.png",
    "recoilTime" : 0.1,
    "handPosition" : [-5.5, -3],
    "firePosition" : [12, 3],
    "classMultiplier" : 0.1,

    "fireTime" : 6.5,
    "twoHanded" : false,

    "projectileType" : "Icegunshot",
    "projectile" : {
    "power" : 25,
    "speed" : 60,

    "color" : [10, 255, 10]
    },

    "muzzleEffect" : {
    "animation" : "/icegun/muzzleflash/IcegunsMF.animation", This should be "/BoundExtra/muzzleflash/IcegunsMF.animation",
    "fireSound" : [ { "file" : "/icegun/sfx/IcegunsSound.wav" } ] Thos should be [ {"file" : "/BoundExtra/sfx/IcegunsSound.wav" } ]
    }
    }

    BTW: I noticed serveral things:
    1:Iceguns.png and Icegunsicon.png are exactly the same; Remove one and change the .gun file. You can take iceguns.png for both.
    2: Your IcegunsSound.wav is just one of the plasma gun sounds copied and renamed, right? Unless you don't have custom sounds, that's unnecessairy. You can just take one from the vanilla assets. When it's a custom sound, GOMENASAI :eek:
    3: When you have "inspectionkind" : "gun", the value "description" is unimportant, since it is never used ingame.
    Just some nitpicking, you don't have to fix those :rolleyes:
     
    Ghoul159 likes this.
  13. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    well i came a bit too late :) i think in your last post you fixed it for him...
    btw thank you for your help!! ;)
     
  14. Asatrix

    Asatrix Guest

    Okay I have a mod idea been poking around the forums and the assets. For an item that uses hunting drops what would the damage type be? on some weapons it lists plasma or other damage types, but on others, such as a rocket launcher its still listed as default, which all bows are currently listed as...very confusing. What would be required to set a weapon to a hunting type? Bear in mind I'm am still learning. But I think big a lot. This could go very far if I figure it out.
     
  15. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    i'm pretty shure it's the damage type bow in the .projectile... but i have never tried it... :)
     
  16. Asatrix

    Asatrix Guest

    Yes actually just looked at Maikochan's Hunting Rifles. On the nose there.
     
  17. ArmoredBound

    ArmoredBound Void-Bound Voyager

    it most likely fixed the gun, but i have been having trouble not being able to craft it, think you can check it one more time?
     
  18. RockRaid

    RockRaid Scruffy Nerf-Herder

    I just checked it and I was able to craft the gun... First I made the recipe sheet, then your custom crafting table and then your laser gun. It was all working fine, except the crafting table missing an image. This one however is fixed easily. You messed up the coordinates;
    The frame should be [37,32], you made it [32,37].
    BTW: Cool pixelwork on that crafting table, did you make it yourself? :iswydt:
    Like I said it works fine for me, is only the gun missing or can't you craft the recipe sheet or the table either?
     
  19. RockRaid

    RockRaid Scruffy Nerf-Herder

    There's another thing I would like to adress, not only to ArmoredBound, referring the Fire Time. It's quite simple.
    Ingame, the rate of fire is measured in shots per second. When you have a gun with a RoF of 12.5, then the gun will fire 12.5 times in one second. In the code however, it's different;
    When you set "fireTime" to 4 for example, the gun won't have a RoF of 4. Instead, it will be 0.25.
    The ingame RoF will always be 1/[codeRoF], or [codeRoF]^(-1)

    In our example, we want a RoF of, say 5.
    Now grab a calculator and type in
    1/5 =0.2

    Set "fireTime" to 0.2. Done!
     
  20. ArmoredBound

    ArmoredBound Void-Bound Voyager

    oh, i forgot to make the recipe sheet......... for the like 10th time :rofl:
     
Thread Status:
Not open for further replies.

Share This Page