How to create new guns with Quality Armory

Jan 4, 2018
How to create new guns with Quality Armory
  • Introduction:
    QualityArmory allows users to create new weapons or edit existing ones. However, due to the fact this QA uses resoucepacks, the steps for creating these guns may seem complicated. This guide will go step-by-step through the process of making a new gun.

    #1: Create a new gun.yml file
    Before we focus on updating the resoucepack, we must first create the effects for the gun. To do that, we must go into /plugins/QualityArmory/newGuns/ directory. In it, you should see two files: ExampleKnife and ExampleGun. Since we want to add a new gun, copy the ExampleGun file and re-name it to the gun you want (not required, but it helps sort which guns you currently have). Then, you should open the file and make the following changes:

    • Invalid must be set to false. This will mean the gun will now appear in the game.
    • name must be set to the name of the gun, however, it does not have to be the displayname. This is the name that will be used when registering the internal name for the gun.
    • Displayname is the name of the gun that will be visible. You can set this to anything you want. Chatcolors are supported.
    • ID is the durability for the gun. This needs to be set to an open, unused durability value for Diamond Hoes. Find this value by using "/QA getOpenGunSlot"
    Though the rest are all important as well, they should all be self explanatory
    .
    After setting all of these values, save the file and reload the server, or use /QA reload to reload the plugin. When you join the game, you should now be able to see your gun using /qa craft.
    [​IMG]
    However, it should just look like a diamond hoe. To fix this, we need to update the resoucepack.

    #2: Find the Resoucepack URL
    Finding the resoucepack url is actually quite simple; All you need to do in go into the /plugins/QualityArmory/config.yml file. If you scroll down, you should see the resoucepack link next to the "DefaultResoucepack" value. Copy and paste that link into a web-browser and download the resoucepack.


    #3: Create a new model
    The next step is to create the gun that you want. For creating 3D models, I recommend you follow these tutorials by Samasaurus6:

    Using MrCrayFishes model editor, create the model you want. Your end-result should be something like:


    Once you are finished creating your gun, you can export the gun as a Json file.

    Now, if you were to simply add this gun to the game, the rotation and size of the gun may be off. To fix this, you will need to add some display options:
    Code (Text):
        "elements": [
          ...
          ...
          ...
        ],
       "display": {
           "thirdperson_righthand": {
               "rotation":  [ -7, -2, -10 ],
               "translation":  [ 0, 4, -2 ],
               "scale":  [ 0.7, 0.7, 0.7]
           },
           "thirdperson_lefthand": {
               "rotation":  [ -7, 1, 11 ],
               "translation":  [ -15, 5, -2 ],
               "scale":  [ 0.7,0.7, 0.7]
           },
           "firstperson_righthand": {
               "rotation":  [ 0, -2, 0 ],
               "translation":  [ 0, 5, 0 ],
               "scale":  [ 1, 1, 1 ]
           },
           "firstperson_lefthand": {
               "rotation":  [ 0, 0, 0 ],
               "translation":  [ -9, 6, 0 ],
               "scale":  [ 1, 1, 1 ]
           },
           "gui": {
               "rotation":  [ 0, -130, 0 ],
               "translation":  [ 0, 5, 0 ],
               "scale":  [ 1, 1,  1 ]
           },
           "ground": {
               "rotation":  [ 0, 0, -23 ],
               "translation":  [ 3.59, -0.94, 6.05 ],
               "scale":  [ 1, 1, 1 ]
           },
           "fixed": {
               "rotation":  [ -1, 3, -41 ],
               "translation":  [ 12.28, 3.4, 10.39 ],
               "scale":  [ 3.37, 3.37, 3.4 ]
           }
       }
    }
     
    What the above does it (mostly) align the gun so that the handle should be in the player's hand. If something does not look right, you may need to edit the rotation or translation.

    BTW: In case the json file exported does not already include a 'display' option, you Need to make sure there is a comma on the close-bracket above it. Without it, the translations may not take affect (at best. At worse, the gun may not load the texture)

    After all the text is the way it should be, save the file and re-name it to the name of the gun. This makes it easier to sort or find in the resoucepack if you need to update it.

    Finally, once you got the the model, you will need to make some changes to the diamond_hoe.json file in the /assets/minecraft/model/item/ directory inside the resoucepack file. In it, scroll down to the bottom of the file and add the following changes:
    Code (Text):
          ....
          ....
          ....
          ....
           {
              "predicate": {
                 "damaged": 0,
                 "damage": 0.0137
              },
              "model": "item/grenade"
           },
           {
              "predicate": {
                 "damaged": 0,
                 "damage": 0.0143
              },
              "model": "item/GUN"
           },
           {
              "predicate": {
                 "damaged": 0,
                 "damage": 0.0149
              },
              "model": "item/diamond_hoe_org"
           }
       ]
     
    All that happened above is we created a new model value above the diamond_hoe_org texture and below the grenade (which may change if I add more guns in the future). After creating this value, change the "damage" value for the gun to be equal to what "diamond_hoe_org" was originally set to and replace the "Gun" in"item/GUN" with the name of the model file. Finally, add 0.0006 to the damage value (so 0.0143 is now 0.0149).

    And with this, you should now be able to see the gun in-game. Once you join the server, you should now be able to see the texture, even if it gets overriden by the default pack for a moment.[​IMG]

    Now, once you verify that it works, we need to upload the file somewhere.

    #4: Upload the resoucepack
    There are many places which you can host the resoucepack. Depending on where you host it, the steps may be different, so I won't go into specifics. However, if you use dropbox or any other file-hosting site, make sure you get the direct URL to the file (For dropbox, that means making sure there is a =1 at the end of the url instead of =0).

    #5: Replace the url in the config
    Once you got the URL, you need to make the following changes to the config.yml
    You need to set "DefaultResoucepackOverride" to true so, in case I want to add a new gun, your resoucepack will still be used.

    #Done
    Once you have done everything above, you should now see you gun in-game.[​IMG]
  • Loading...
  • Loading...