What I've learned on how to make custom weapons

Puddle

L1: Registered
Jan 5, 2023
15
0

Introduction:​

In this quick guide I will go through what I have learned about how to make custom weapons, this is barely scratching the surface and I might do more guides in the future but for now I still don't know much.

Requirements:​

This guide will be for making custom weapons using the custom weapons 3 sourcemod plugin for this to work you will need:
From custom weapons 3 you also need to make sure you install tf2items.randomizer.txt from the same page because it contains game data needed for this to work

Setup:​

I will now walk you through how to setup your attribute structure but if you want to skip this you will find a template at the end of the attributes section.

first we will give our item a name, I would suggest naming the file the same as the weapon and all it needs to be is a .txt file. now we will setup the name of the item in the attribute structure we do this like this:

1725224892219.png


Now we need to give it some data telling it some basic information on what kind of item it is, we will start by defining what class(es) its for:

1725225140854.png


In this you can put as many classes as you want in it and the number at the end is what slot it will go in, here are the slot indexes:
0 - primary
1 - secondary
3 - melee
4 - pda (for spy and engi)
if you can't find what items go in what slot you can always check Item indexes

now we need to setup some more data witch will give the item some basic functions without any added stats for now:

1725225477227.png


both of these can be found at Item indexes and just make sure that when you add the baseclass it should only be the last word or you will not be able to pull the weapon out,

1725225570103.png


now we need to add some more weapon info, this part will make it take too long going through each one separately so I will just explain them at the end:

1725225682930.png


nobots basically just tells the game weather bots should be able to spawn with them
quality is the item quality:
0 - Stock
1 - Genuine
2 - (unused)
3 - Vintage
4 - (unused)
5 - Unusual
6 - Unique
7 - Community
8 - Valve
9 - Self-made
10 - Customized
11 - Strange
12 - (unused)
13 - Haunted
14 - Collector's
15 - Decorated

logname is just what will show up in the console when people get kills with it

For the description its pretty straight forward the only thing you need to know is that \n is a newline you can't just hit enter

1725226363917.png


this does have a character limit but you most likely won't reach it

Attributes:​

Now we will go onto the fun part, adding buffs and debuffs to change how your weapon plays, first we need to setup the basic structure to hold them:

1725226537479.png


now we can populate this with our stats, the first stat most weapons have is weapon_allow_inspect and so we will now add this:

1725226621950.png


things to keep in mind is that the attribute name HAS to be the right name or else it will not get recognized, all attributes officially in the game can be found at Item attributes the ones that say they are unused sometimes don't work and some of them don't say it in the description but sometimes only work for some weapons, for example the mark self for death only works for melee weapons. all official attributes you will put the tf2attributes as the plugin and for all attributes that say "additive" whatever you put in the value is what gets added/removed but for any that say "percentage" you need to give a value where 1 is default and 0.5 is 50% and 1.5 is 150%:

1725227621884.png


the final unpopulated structure will look something like this:

""
{
"classes"
{
"" ""
}
"baseclass" ""
"baseindex" ""
"nobots" ""
"quality" ""
"logname" ""
"description" ""
"attributes"
{
""
{
"plugin" ""
"value" ""
}
}
}

Testing:​

Now to test your weapon you will need to put your finished .txt file into the customweapons folder in your server, if you don't have this folder just make one called "customweapons" at "tf/addons/sourcemod/configs/customweapons" then reboot your server and when in, in chat type /c and then select your weapon. if you do not have a server and want to test it on mine or need some further help with making items feel free to dm me on discord

Notes:​

I have also made a single zip file with all the addons (for linux ONLY) so that you don't need to mess with file structures in the attached files and there is also a folder of example items (not made by me)
 

Attachments

  • CW3_and_requirements.zip
    435.6 KB · Views: 24
  • customweapons.zip
    5.1 KB · Views: 25