Tutorial How to modified a vanilla weapons into a cool weapons by using a /spawnitem command

Discussion in 'Starbound Modding' started by MeKa6600, Apr 13, 2017.

  1. MeKa6600

    MeKa6600 Scruffy Nerf-Herder

    The Ultimate Guide to Making Custom Items Using /spawnitem in Starbound 1.0

    Credit right down here! (Go support him on Reddit , RIGHT NOW!)
    https://www.reddit.com/r/starbound/...e_a_tutorial_on_how_to_use_spawnitem_to_make/

    WARNING: DO NOT USE THESE COMMANDS WITH IMPORTANT CHARACTERS. You might corrupt them!

    Around a year ago, a reddit user by the name of Yokoca made a guide(?) on how to use /spawnitem.

    However, as of Cheerful Giraffe (1.0) (why are the version names so dumb), it no longer works.

    So I decided to make an up-to-date guide using my own research!

    Before we start, I highly recommend that you unpack the game’s files. This will help a lot with making custom items.

    Just google “How to unpack Starbound“ for several tutorials on how to do this.

    Once you’ve done that, move the unpacked assets elsewhere if you don’t want the game to take several minutes to load.

    And once you’ve done that and made yourself an admin (/admin), it’s time to begin making cool (and probably also overpowered) items!

    (Note: This guide uses a lot of JSON. I recommend that you use JSONLint to help with troubleshooting. Also, Tumblr messes with the commands, so I put them all in this pastebin link.)

    Let’s start by just spawning a random weapon. I chose the pistol:



    Pastebin Command 1



    You can change this to any weapon you want, but I recommend the generated weapons.

    The “common“ at the beginning only works on generated weapons. The available options are “common“, “uncommon“ and “rare“.

    Pressing enter will spawn the weapon at your cursor.

    But this thing is way too bland. Let’s mess with it!

    At the end of the command, add * 1 ‘{}’*. (without the asterisks, include all the spaces)



    Pastebin Command 2



    Let’s start with the simple stuff.

    All weapons spawned without parameters (the curly brackets) are all at Level 1.

    This is the level of the weapons you find on Low threat level planets. You know, the planets you start on?

    Yeah, we need to fix this. Now.

    Inside the parameters, add *”level”:(Number between 1 to 10)*.

    I chose Level 10:



    Pastebin Command 3



    You can also set a seed. This will make the command spawn the same weapon every time.



    After “level”, Add *,“seed”:(Random number)*.

    I chose 0:



    Pastebin Command 4



    You can also change the weapon’s name and “displayed rarity".

    After “seed“, add *,”shortdescription”:”(Name)”,”rarity”:”(Common, Uncommon, Rare, Legendary or Essential)”*.

    I chose “The Experiment“ for the name, and “Legendary“ for the rarity:



    Pastebin Command 5

    [​IMG]


    To change the weapon’s elemental type, add *”elementalType“:”(Type)”*.

    You can use “fire“, “ice“, “electric“ and “poison“.

    I chose “fire“:



    Command 24

    [​IMG]


    But this was just the simple stuff. Let’s get crazy.

    First of, we’re gonna clear the old parameters (optional) and add *”primaryAbility”:{}*.

    To change the weapon’s cooldown, damage, energy consumption, projectile count and inaccuracy, add “fireTime“, “baseDps“, “energyUsage“, “projectileCount“ and “inaccuracy“ inside “primaryAbility”’s parameters respectively:



    Command 6

    [​IMG]
    [​IMG]


    “fireTime“, “baseDps“ and “energyUsage” all have Multiplier counterparts. Just add “Factor“ to the end of them (e.g. “fireTimeFactor”).

    Now that I’ve taught you how to change weapon stats, let’s learn how to change weapon sounds.

    This is why I told you to unpack the game earlier.

    First, go here:



    Steam\steamapps\common\Starbound\assets\unpacked\sfx



    Once you’ve done that, pick a sound. I’ve picked “grenade1.ogg“ in the “gun“ folder.

    Once you’ve done that, in the main parameters, add *“animationCustom”:{“sounds”:{“fire”:[“(Sound location)”]}}*.

    The sound location of “grenade1.ogg“ is */sfx/gun/grenade1.ogg*.

    Here’s the full command (I’ve cleared the old parameters again, by the way. I’ve also set the seed to 0):



    Command 7



    Have you ever thought to yourself, “Man, bullets are boring“?

    Well, you’re in luck, because you can make guns shoot things other projectiles too!

    This is where the fun really starts.

    First, navigate to the “projectiles“ folder in the game’s unpacked assets.

    Next, pick a projectile. Go into its folder and get its name. I chose “grenade“.

    (Note: Projectiles that require specific data (Projectiles that summon Monsters, Magnorbs, etc.) crash the game when shot from a gun.)

    Once you’ve done that, in “primaryAbility“’s parameters, add *“projectileType”:“(Projectile Name)”*:



    Command 8

    [​IMG]


    Combining all of the commands I’ve taught you so far can make something like this.



    Command 9

    [​IMG]
    [​IMG]


    And this.



    Command 10

    [​IMG]


    And this!



    Command 11

    [​IMG]
    [​IMG]


    The last one uses “animationParts“ to change the gun’s appearance when held.

    It goes in the main parameters. It works similar to “sounds” in “animationCustom“:



    Command 12



    For the entire tutorial, I’ve been neglecting swords.

    Time to fix that!

    Swords work similarly to Guns, except they don’t use “energyUsage“, “projectileCount“ and “inaccuracy“.

    “animationParts“ also uses “handle“ and “blade“ instead of “butt“, “middle“ and “barrel“.

    Here’s a (pretty big) example of a custom shortsword:



    Command 13

    [​IMG]
    [​IMG]


    I’ve also been neglecting Special Abilities.

    Let’s fix that too!

    Remember when we changed a gun’s stats and made it shoot something other than bullets?

    You can do that with a lot of the Special Abilities as well!

    But first, we need to specify what Special Ability we want on our gun (we’re starting with those first).

    (Note: Don’t put Special Abilities on one-handed weapons. It has some weird behaviour.)

    I went ahead and set up the simple stuff:



    Command 14



    Now that that’s done, let’s set its special ability!

    First, go to “items”, then “active”, then “weapons” in the game’s unpacked assets.

    Then go to either “melee” or “ranged”, depending on which ability you want to add to your weapon.

    (Note: Adding a melee ability on a ranged weapon and vice-versa crashes the game.)

    Then go to “abilities”.

    Then choose the ability you want! I’ve chosen “rocketburst“.

    Once you’ve done that, in the main parameters, add *”altAbilityType”:”(Ability Name)”,”altAbility”:{}*.



    Command 15

    [​IMG]
    [​IMG]


    Now that we’ve learnt how to set a weapon’s special ability, let’s change the ability itself!

    Earlier, I said that you can change an ability’s stats and projectile type.

    Let’s do that now!

    Some variables work on some abilities, some don’t.

    Some abilities have extra variables. For example, “rocketburst“ has “burstCount“ and “burstTime“.

    Let’s change those extra variables!

    Instead of putting the variables in “primaryAbility“’s parameters, put them in “altAbility“’s parameters instead.

    I’ve made Rocket Burst shoot twice as many rockets, twice as fast:



    Command 16

    [​IMG]


    And now we’re gonna slap “projectileType” onto the weapon as well.



    I’ve chosen “iceplasmarocket“:



    Command 17

    [​IMG]


    Much better.

    To change the sound the ability makes, use “animationCustom“, but instead of putting “fire“ in “sounds“, put “altFire“ instead.

    This is different for some abilities.

    Now that we’ve done guns, let’s do swords!

    I made a broadsword with “travelingslash“ as its ability:



    Command 18

    [​IMG]


    This ability has “cooldownTime“. It starts after the animation ends.

    Let’s set it to 0!



    Command 19

    [​IMG]


    This is much more fun.

    But not as fun as changing the projectile as well!

    I chose “energyarrow“:



    Command 20

    [​IMG]


    You don’t even have to make these special abilities. You can make them primary. Just change “alt" in “altAbilityType“ and “altAbility“ to “primary“.

    …Though, on most abilities, this has some weird behaviour.

    You can even change unique weapons like the Miniknog Launcher:



    Command 21

    [​IMG]


    (Discovered how to do this one when iv2b on the starbound reddit asked me how to slow down projectiles!)

    Sometimes, you want to change the speed or knockback of your projectile.

    This is where “projectileParameters“ comes in.

    In “???Ability“, add *“projectileParameters”:{}*.

    The variables that you can use that I know of are “speed“, “power“ and “knockback“:



    Command 22

    [​IMG]


    Don’t you hate it when you make, for example, a rocket launcher that’s supposed to shoot 10 times a second, but only shoots 3 times a second?

    Don’t worry, we can get rid of that!

    In “???Ability“’s parameters, add *”stances”:{”cooldown“:{”duration“:(Fire Rate)}}*:



    Command 23

    [​IMG]


    Oh yeah, Staves. Those exist.

    Staves are pretty interesting too!

    Let’s make a wand instead because 2 abilities is too much!

    For the ability, I chose “plasmabarrage“.

    Do not use elemental abilities. They’ll crash the game no matter what.



    Command 25

    [​IMG]


    Pretty cool, pretty cool. But let’s make it more unique.

    “plasmabarrage“ has 3 extra variables: “projectileDistance“, “projectileDelayFirst“ and “projectileDelayEach“.

    Let’s use them!



    Command 26

    [​IMG]


    And of course, we can’t forget “projectileType“:



    Command 27

    [​IMG]
     
    The Avelon likes this.
  2. gakusangi

    gakusangi Space Hobo

    The issue I have with this is that there's no showing of the actual code, allowing us to see how it's written together nor were any value comparisons (such as the damage, rate of fire and energy usage) before and after the editing, which makes it hard to see how things adjust. It's nice that the parameters are named and it's not too hard to see where we're supposed to be adding them, but all this really did was point out the things you can edit while not really showing how very clearly. For example, I'm just adjusting damage values with trial and error and assuming (based on the information here) where I'm supposed to place the Factors to the base values and how they're supposed to look together for the code to function. I'm still nowhere near understanding how these values interact with each other to properly stat things out. Also, does any weapon actually USE inaccuracy? It seems like a rather extreme parameter when I tested it out.
     
  3. MeKa6600

    MeKa6600 Scruffy Nerf-Herder

    Fear not!,The example and explanation are here
    https://www.reddit.com/r/starbound/...r_overriding_the_rng/?st=j4pjf7f1&sh=dc9bbf16
    (Credit: Photoloss for making custom stuff and this guide)
     
  4. llisus_4023

    llisus_4023 Orbital Explorer

    So, what should I do if I wanna make the weapon to spawn a monster?
     
  5. captainrumbarrels

    captainrumbarrels Phantasmal Quasar

    @llisus_4023

    I was wondering the same thing. I'm making an experimental drone launcher that launches drones that have a set life span.

    Found this reddit thread (https://www.reddit.com/r/starbound/comments/5f96yv/make_a_monster_spawn_from_a_projectile/)

    Also checkout the lua library. People should reference this more as well as the 'read the docs' index. Just surprised This is "common knowledge" but it isn't commonly mentioned.
    I prefer the starbound wiki library but its essentially the same.
    https://starbounder.org/Modding:Lua/Tables

    Hope this helps.
     
    Drakarus likes this.
  6. EliOatmeal

    EliOatmeal Intergalactic Tourist

    Actually, putting a ranged special on a melee weapon and vice-verse doesn't always cause issues. I tried to put barrier (usually a special that only spears have) on a sniper rifle and it worked flawlessly. But when I tried to put rocket burst on a sword it wouldn't even spawn the item.
     
  7. PrinceTBug

    PrinceTBug Scruffy Nerf-Herder

    any given ability depends on another separate lua file, or sometimes more than one. furthermore, some items such as guns have more animation parts that swords don't, meaning that abilities that reference those parts simply don't work. in some cases you can modify the items JSON to make these work but it's pretty finicky

    (I know this is an old post, but figured this was useful enough info to be shared anyway)
     
  8. Stefan95

    Stefan95 Big Damn Hero

    Hello! Sorry to ask, but can someone give a command(just like you type it in the game) with all(or even with only a few) of these parameters? I'm trying to find a way to make a sword with no cooldown on the special ability(for example Flip Slash).
     

Share This Page