Skip to Content
Basic Features

Basic Features

Open the gun file in Visual Studio Code. You can also open it in Notepad or something equivalent, but the code will be much harder to read. Visual Studio Code also shows when you make syntax errors, so it’s easier to catch mistakes. Mistakes like a missing ” or , or typos.

We’ll start with a basic explainer:

Everything a gun can do, like what ammo it accepts, what the name of the item is, how much damage it can do, is contained inside brackets {}.

So we’ll start with basic {}:

{ }

This code does nothing, but you can put stuff inside the container:

{ "name": "packname_gunname" }

Now, the item has a name, but there’s not enough, and it might also break if you load it in the game. So to add more, we put a , and add a new line:

{ "name": "packname_gunname", "type": "Gun" }

With this additonal line, the game will register this item as a gun (and not an attachment or ammo).

TIP: Always be mindful of commas ,

From here, we can add more. Let’s add the ammo capacity, compatible ammo, and damage:

{ "name": "packname_gunname", "type": "Gun", "maxAmmoCapacity": 30, "compatibleAmmo": [ "ammocreative", "ammo556" ], "damage": 5 }

Here, you can see that some lines will have containers of their own. "compatibleAmmo" has a container [], inside which is a list of ammo items the gun can take.

Now in reality, there’s no need to remember which lines do or don’t have containers, how to properly write lines, etc.—which is why all of these examples can be copy-pasted directly for your convenience.

Other than that, these examples don’t have nearly enough what we want in our gun (animations, firemode, sound, etc.) so let’s give you a full complete useful example.

There are a lot of things a gun can do, and we’ll walk through all of them.

Example JSON of a complete gun is shown below.

You may copy-paste the following code into your own file. If you copy-pasted your file from an existing pack, you’ll see similar code:

{ "name": "packname_gunname", "type": "Gun", "maxAmmoCapacity": 30, "compatibleAmmo": [ "ammocreative", "ammo556" ], "damage": 5, "fireSound": "gunsoundfilename", "fireModes": [ "AUTOMATIC" ], "rpm": 700, "gunRecoilInitialAmplitude": 0.2, "shakeRecoilAmplitude": 0.35, "shakeRecoilSpeed": 2, "viewRecoilAmplitude": 1.2, "compatibleAttachmentGroups": [ "ar_muzzle", "ar_sightsandscopes", "underbarrel" ], "compatibleAttachments": [ "cantedrail" ], "defaultAttachments": [ "cantedrail" ], "features": [ ], "phasedReloads": [ ], "effects": [ ], "inspectAnimations": [ ], "idleAnimations": [ ], "drawAnimations": [ ], "fireAnimations": [ ] }
  • "name": "packname_gunname" is the name of the item. It should match the name of the file as well. If they’re different, the pack will break. Always keep the names consistent across the model, the texture, the animation, and the gun item.
  • "type": "Gun" is the type of item. There are other types, like ammo or attachment.
  • "maxAmmoCapacity" is the number of bullets/rounds the gun has.
  • "compatibleAmmo" lists the compatible ammo the gun can accept.
  • "damage" is the damage the gun does per shot.
  • "fireSound" is the sound of the gun.
  • "fireModes" is the basic firemode mechanic for the gun. It can be SINGLE, AUTOMATIC, or BURST. It can have one or two or all three of these firemodes.
  • "rpm" is the rounds-per-minute of the gun, or how fast the gun shoots. Assault rifles can have, for example, 600 RPM or 800 RPM.
  • "drawCooldownDuration" is the speed of the draw animation, in milliseconds.
  • "gunRecoilInitialAmplitude" is the amplitude of the recoil animation of the gun on the z axis, or how far back it goes, when firing.
  • "shakeRecoilAmplitude" is the amplitude of the screenshake when firing.
  • "shakeRecoilSpeed" is the speed of the screenshake.
  • "viewRecoilAmplitude" is the amplitude of the camera view recoil, or how high the player’s screen jumps up when firing.
  • "compatibleAttachmentGroups" is a list of attachment groups the gun can attach.
  • "compatibleAttachments" is a list of attachments the gun can attach. It is not the same as attachment groups.
  • "features" is a list of features that allow the gun to do cool things. Other pages will cover what these features are, listed as Features: Firemodes, Features: Part Visibility, etc..
  • "phasedReloads" is the list of reload animations the gun has. You can put as many as you want.
  • "effects" is the list of effects the gun has. Usually a tracer effect is added here. Perhaps also muzzle flash, and some other things.
  • "fireAnimations" is a list of firing animations. Useful for weapons like snipers where, in every firing animation, the character cycles a round. It can also be used for any other weapon where you might want a diverse set of animations.
  • "inspectAnimations" is a list of inspect animations. You can put as many as you want.
  • "idleAnimations" is a list of idle animations. You can put as many as you want. Useful for guns where the idle can change, like a pistol where the slide locks back.
  • "drawAnimations" is a list of draw animations. Having this will override the earlier "drawCooldownDuration" line. "drawAnimations" is useful for having multiple draw animations.

You may change these values however you like, like the name, the damage, the recoil, etc.. Other pages will cover more complex features like attachments and firemodes.

You can get away with copying the above code and then being finished with the gun.

For simpler guns, you can get away with simpler code like this:

{ "name": "packname_gunname", "type": "Gun", "maxAmmoCapacity": 30, "compatibleAmmo": [ "ammocreative", "ammo556" ], "damage": 5, "fireSound": "gunsoundfilename", "fireModes": [ "AUTOMATIC" ], "rpm": 700, "gunRecoilInitialAmplitude": 0.2, "shakeRecoilAmplitude": 0.35, "shakeRecoilSpeed": 2, "viewRecoilAmplitude": 1.2, "phasedReloads": [ ], "effects": [ ], "drawAnimations": [ ] }

In this example, some lines were stripped for a more barebones weapon. For example, this gun will not be able to accept attachments.

Shotgun

If you want to design a shotgun, which can shoot multiple pellets, you need pelletCount and pelletSpread.

{ "name": "ba_eyeofhorus", "type": "Gun", "maxAmmoCapacity": 8, "maxAmmoPerReloadIteration": 1, "compatibleAmmo": [ "ammocreative", "ammo12gauge" ], "pelletCount": 30, "pelletSpread": 0.1, "damage": 2, "rpm": 350, "fireModes": [ "SINGLE" ], "fireSound": "ba_eyeofhorus", "aimingZoom": 0.25, "gunRecoilInitialAmplitude": 0.35, "shakeRecoilAmplitude": 2, "shakeRecoilSpeed": 2, "viewRecoilAmplitude": 7, "compatibleAttachmentGroups": [ ], "compatibleAttachments": [ ], "features": [ ], "phasedReloads": [ ], "inspectAnimations": [ ], "idleAnimations": [ ], "drawAnimations": [ ] }

pelletCount is the number of pellets.

pelletSpread is the inaccuracy of pellets. 0.1 here seems really small—it’s actually a lot. Feel free to experiment with different values.

By default, all guns have a level of inaccuracy. Shotguns will have a bit more. When the player aims their gun, the inaccuracy will reduce by a substantial amount—hence increasing accuracy.

Disable Aiming

For specific guns, you might want to disable aiming. You can add an extra line:

"aimingEnabled": false

In a gun file, it’d look like this:

{ "name": "ba_eyeofhorus", "type": "Gun", "maxAmmoCapacity": 8, "maxAmmoPerReloadIteration": 1, "compatibleAmmo": [ "ammocreative", "ammo12gauge" ], "pelletCount": 30, "pelletSpread": 0.1, "damage": 2, "rpm": 350, "fireModes": [ "SINGLE" ], "fireSound": "ba_eyeofhorus", "aimingZoom": 0.25, "gunRecoilInitialAmplitude": 0.35, "shakeRecoilAmplitude": 2, "shakeRecoilSpeed": 2, "viewRecoilAmplitude": 7, "aimingEnabled": false, "compatibleAttachmentGroups": [ ], "compatibleAttachments": [ ], "features": [ ], "phasedReloads": [ ], "inspectAnimations": [ ], "idleAnimations": [ ], "drawAnimations": [ ] }

Infinite Ammo

Sometimes, you might want a gun with infinite ammo. For example, a melee weapon or maybe an energy weapon.

"maxAmmoCapacity": "infinite"

In the gun json file, it’d look like this:

{ "name": "meleeweapon", "type": "Gun", "maxAmmoCapacity": "infinite" "compatibleAmmo": [ "ammocreative", ], "damage": 2, "rpm": 350, "fireModes": [ "SINGLE" ], "fireSound": "meleeweaponswing", "shakeRecoilAmplitude": 2, "shakeRecoilSpeed": 2, "viewRecoilAmplitude": 7, "aimingEnabled": false, "compatibleAttachmentGroups": [ ], "compatibleAttachments": [ ], "features": [ ], "phasedReloads": [ ], "inspectAnimations": [ ], "idleAnimations": [ ], "drawAnimations": [ ] }

Bullet Travel Distance

Maybe you’re creating a melee weapon, and you don’t want the weapon (since it’s technically a gun) to be able to hit someone from 50 blocks away.

"maxShootingDistance": (insert number)
{ "name": "meleeweapon", "type": "Gun", "maxAmmoCapacity": "infinite" "compatibleAmmo": [ "ammocreative", ], "damage": 2, "rpm": 350, "fireModes": [ "SINGLE" ], "fireSound": "meleeweaponswing", "shakeRecoilAmplitude": 2, "shakeRecoilSpeed": 2, "viewRecoilAmplitude": 7, "aimingEnabled": false, "maxShootingDistance": 3.5, "compatibleAttachmentGroups": [ ], "compatibleAttachments": [ ], "features": [ ], "phasedReloads": [ ], "inspectAnimations": [ ], "idleAnimations": [ ], "drawAnimations": [ ] }
Last updated on