Wanting new weapons in TF2? Valve not doing it? Take matters into your own hands with Custom Weapons 3! Based on the Custom Weapons 2 plugin by MasterOfTheXP, Custom Weapons 3 has a brand new menu system and the ability for servers to make shields and wearables!

Unlike Custom Weapons 2, however, Custom Weapons 3 uses a module-based system."What is that supposed to mean?"
Well, what that means is that if you want to contribute to Custom Weapons 3, a lot of the plugin is exposed via forwards in the .inc file. It also means that if a server owner finds a module that causes lag, it can be removed or replaced by a more optimized module.

"How do I know what to insta..."
Shhhh... I was about to get to that. In the attachments of this post, you will see something called "CW3 Starter Kit.zip". If you're setting up a server, the starter kit has everything you need to get it going, just copy the plugins folder into your servers sourcemod/plugins folder. There are a few modules in the scripting folder, but the default modules do mostly the same job. cw2legacy is only to be used if you have issues getting your CW2 server working with the split CW2 modules.

COMMANDS AND CVARS

Spoiler

Any player can equip a custom weapon by typing /c, /cus, /custom, !c, !cus, or !custom in the chat.

sm_cw3_sethealth (1/0, def. 1) When a custom weapon is equipped, the user's health will be set to their maximum.

sm_cw3_onlyteam (def. 0) If non-zero, custom weapons can only be equipped by one team; 2 = RED, 3 = BLU.

WHAT EACH OFFICIAL MODULE DOES

Spoiler

cw2attributes

This provides backwards compatibility with Custom Weapons 2 attribute plugins. This will spam errors if an attribute is applied to a wearable or shield.

To add an attribute, put a block in your weapon config titled "attributes". Inside there, put blocks with the names of the attributes you want to apply, one attribute per block. Inside those blocks, insert two keys titled "plugin" and "value". The value for "plugin" is the name of the plugin the attribute is from. The value for "value" is the value of the attribute.

cw2legacy

This plugin basically replicates Custom Weapons 2's functionality. This can be used to guarantee compatibility with an old Custom Weapons 2 server.

cw2model-application

Allows custom models to be added to a weapon.

Due to Valve making a change a few years ago, your weapon will be invisible to other players. There is no way to fix this. If you know a workaround, DO NOT POST IT HERE.

For a custom viewmodel, insert a block into your weapon config titled "viewmodel". Inside that block, put a key titled "modelname". The value of "modelname" is the location of the model to display.

For a custom worldmodel, insert a block into your weapon config titled "worldmodel". Inside that block, put a key titled "modelname". The value of "modelname" is the location of the model to display. This will be invisible to other players. There is no fix.

cw2sounds

Allows custom sounds to be played for various weapon events.

To use this, make a block titled "sound" and inside that block, put a block titled "player" for every sound you want to replace. Inside each of those blocks, put a "find" and "replace" key. The value for "find" is the sound you want to replace, and the value for "replace" is the sound to play instead.

cw3-attributes

This allows vanilla and new attributes to be applied to weapons.

To use attributes from plugins build on cw3-attributes, put a block titled "cw3_attributes" in your weapon config.

You can put "while active" "1" in an attribute block to tell an attribute plugin to make the attribute only work while the weapon is out. Bear in mind that this is not law, an attribute plugin can ignore this if they wish.

Other than that, the parameters are the same as cw2attributes.

cw3model-application

This does essentially the same thing as the cw2model-application module, but saves one entity per worldmodel. If you have server crashes due to a lot of edicts, give this a shot!

WEAPON CONFIG PARAMETER LIST/HOW TO MAKE A WEAPON CONFIG

Spoiler

Creating a new custom weapon is plain easy. Simply duplicate a custom weapon's config file, and fill out its info with your own.

The weapon's name goes right at the top, in "quotes".

"classes" is the array of player classes the weapon should be available for; the number next to each class is the weapon slot (0 = Primary, 1 = Secondary, 2 = Melee)

"baseclass" is the classname of the weapon, without "tf_weapon_". For a shield put "wearable_demoshield", and for a wearable (such as boots or a backpack) put "wearable".

"baseindex" is the item index of the base weapon, see above classname link. If unsure, stick within the 0-30s.

If it uses ammo (i.e. most non-melee weapons) it should have "mag" and "ammo" keys with the intended starting ammo.

"logname" will be displayed in client consoles when a kill is made with the weapon. Not currently implemented.

"killicon", also not implemented yet, will be able to change the weapon's icon in the kill feed.

"description" is the stat list that players will see when selecting the weapon. \n = Newline. "\n \n" will skip an entire line.

"nobots", if set to 1, will prevent bots from randomly equipping this weapon.

"flag" or "flags" will restrict the weapon to only be usable by users with the provided admin flag(s).

"replace"; Requires cw2legacy module, will be split into its own module fairly soon. This is a list or item indexes, each separated by a space, which will be replaced by this weapon.

"sound"; Requires cw2legacy or cw2sounds module. Each sound has:

A "player" array, which is used to find and replace sounds. You need one "player" array for every sound you want to replace. Each "player" array has:

"find" is the path to the sound that you want to replace.

"replace" is the path to the sound you want to replace the "find" key with.

Do note that currently, you cannot replace sounds on miniguns and sniper rifles. A module will be made fairly soon to remedy this for miniguns.

An identifier, to set what attribute it is. This will either be a case-sensitive name (Custom Weapons, TF2Attributes) or an attribute index (TF2Items).

"plugin": Who will provide the attribute's functionality?

For official Valve attributes, you'll usually want to use TF2Attributes, so put "tf2attributes". A select few attributes require "tf2attributes.int" instead.

If TF2Attributes doesn't work for said attribute (so far I've only seen "alt-fire is vampire" not work with TF2Att) then try "tf2items" instead, with the identifier being the number beside the attribute's name. (e.g. "move speed penalty" should instead be "54")

Or, of course, a custom attribute! In which case, "plugin" should be set to the name of the attributes plugin, minus ".smx".

And of course, a value. Most attributes are multipliers; with "damage bonus/penalty", "2.0" is double (+100%), and "0.5" is halved (-50%). With time-based attributes such as "Reload time increased/decreased", "0.5" is half time (good), whereas "2.0" makes it take twice as long (bad). And some attributes are simply "1.0 = on, 0.0 = off".

If you're unsure about values, check out a weapon that already has that attribute (Ctrl+F the official weapon's name in tf/scripts/items_game.txt, or just look at the custom weapon's config)

An identifier, to set what attribute it is. This will either be a case-sensitive name (Custom Weapons, TF2Attributes) or an attribute index (TF2Items).

"plugin": Who will provide the attribute's functionality?

For official Valve attributes, you'll usually want to use TF2Attributes, so put "tf2attributes". A select few attributes require "tf2attributes.int" instead.

If TF2Attributes doesn't work for said attribute (so far I've only seen "alt-fire is vampire" not work with TF2Att) then try "tf2items" instead, with the identifier being the number beside the attribute's name. (e.g. "move speed penalty" should instead be "54")

Or, of course, a custom attribute! In which case, "plugin" should be set to the name of the attributes plugin, minus ".smx". The Starter Kit includes "aw2attrib" and "rays-attributes".

"while active": If this is 1, cw3-attributes will tell the attribute plugin that this attribute should only work while the weapon is out. Do note, that this is a recommendation, and some attributes may intentionally ignore this.

And of course, a value. Most attributes are multipliers; with "damage bonus/penalty", "2.0" is double (+100%), and "0.5" is halved (-50%). With time-based attributes such as "Reload time increased/decreased", "0.5" is half time (good), whereas "2.0" makes it take twice as long (bad). And some attributes are simply "1.0 = on, 0.0 = off".

If you're unsure about values, check out a weapon that already has that attribute (Ctrl+F the official weapon's name in tf/scripts/items_game.txt, or just look at the custom weapon's config)

"viewmodel" and "worldmodel"; Requires either the cw2model-application, cw3model-application or cw2legacy module. For either key, you will need:

A "modelname" key, which holds the path to the model you with to use. I would HIGHLY recommend you use a c_model for both view and worldmodels, or just for viewmodels if you have to.

If you need to use a v_model for the viewmodel for some reason, you need to do a bit more work to get the model just right, and it only shows correctly at the FoV you used to set it up, and you can't have it set for multiple FoVs. Here's what you need to do:

First things first, in the "viewmodel" block, add a line with "attachment" "1" on it.

Next, create two lines, one with "pos" "" on it and one with "ang" "" on it.

"pos" is the position of the viewmodel, while "ang" is its rotation. Both of these require three parameters in the quotes, each separated by a space.

Adjust these values until your viewmodel lines up properly. It's just a matter of trial and error.

If you don't want to do the above, try to track down a c_model version of the model you are using. If you're getting your model from the Steam Workshop, it should already be a c_model.

I'm an attribute developer, how does this affect me?
Well, there are a few changes to how attributes are applied. First off, in CW2, attributes were indexed mostly by weapon entity index. This is no longer the case. Attributes should now be indexed by client id and slot. It's not really as bad as it seems at first, my AW2 attributes plugin took about an hour or two to port.

I'm a server owner, how does this affect me?
If you've used CW2, it shouldn't affect you at all! Just use the cw2legacy or all the cw2 builds and your server will just have the fancy new menu.

SIMPLE INSTALLATION
First things first, make sure your server has tf2items and tf2attributes installed. You will also need tf2items.randomizer.txt from this post. (currently outdated! use the attachment in this post!)

Download the CW3 Starter Kit from this post.

Extract the plugins folder from the .zip file you download into your sourcemod folder.

You're done! All you have to do now is download or create some custom weapons! (They go into sourcemod/configs/customweapons btw)

MANUAL INSTALLATION
First things first, make sure your server has tf2items installed. For either of the attribute modules, make sure you also have tf2attributes installed. You will also need tf2items.randomizer.txt from this post. (currently outdated! use the attachment in this post!)

Inside that folder, place any attribute plugins that are built on the CW2 base.

You're done! All you have to do now is download or create some custom weapons!

ABOUT INVISIBLE WEAPONS
If weapon models are invisible to other people on your server, that is not a bug. Valve disabled visible weapons a few years ago. DO NOT POST A FIX HERE! IT IS BANNED ON ALLIEDMODS!

(FREE) DLC
You need weapons and modules to use CW3, so why not grab some of these?

Fixed a few array out of bounds errors that were missed in rays-attributes and basic-attributes.

Added updated tf2items.randomizer.txt gamedata to downloads.

CHANGELOG

Spoiler

Beta 2

Fixed version numbers in all official modules, some still were labeled as "indev" as they weren't changed from their original version.

Fixed most (if not, all) "array index out of bounds" errors in basic-attributes and aw2attrib. Sorry about this one taking so long. LIFE TOOK OVER D:

Added "CW3_ControlCW3" native to cw3. Takes a bool as a parameter. This allows a plugin to take total control of CW3 (requested by a user, not sure if they want to be named at this time).
If a plugin takes control, the commands to bring up the custom weapon menu will not function, and bots will not equip custom weapons. It will be up to the plugin to give weapons to players and bots.

Minor change to some attributes in aw2attrib, mostly involving damage taken modifiers. It now uses SDKHooks to apply the damage modifier instead of default TF2 attributes.

- Not sure if I'm gonna do a REAL changelog, it's pretty heavy I think, but here's the biggest change I guess :
- - Ported to CW3.
- - - This means that the CW2 one is no longer supported anymore. (and no, you can't take it over)
- - Added new attributes !
- - Changed how attributes work !
- - Fixed bugs !
- - Added more stuff into the include file !
- - I don't know.

¥ Known Bugs :

[img=http://trixmoto.net/files/none.jpg][/img]

¥ Source Code :

The source code isn't in the .zip file, everything is on my Github : https://github.com/OrionTCB/customweaponstf
The compiled version on the github might not be the latest, just download the file from AM to be sure.

just give a [spoiler]'d [code] for an example weapon config, it's much easier than trying to get the average layman to come to the same conclusion that they're using keyvalue config syntax in a very specific way.

I would've kept the convar names the same, that way nobody really needs to update their configs ;p

quick, remind people you've already been running CW3 for a while now lolo!!

This can make people weapon switch without needing to do anything special to fix the viewmodels. Setting m_hActiveWeapon directly won't fire OnWeaponSwitch, which the core plugin uses to change whether or not viewmodels are visible or not.