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.
Admin commands
sm_cw3_addattribute <client> <slot> <"attribute name"> <"value"> <"plugin"> - Adds a custom cw3 attribute onto any weapon. Requires cw3-attributes
sm_custom_addattribute <client> <slot> <"attribute name"> <"value"> <"plugin"> - Adds a custom cw2 attribute onto any weapon. Requires cw2attributes
/c reload in chat or sm_c reload in client console (server console will be fixed soon) - Reloads CW3 and all the modules.
Cvars
sm_cw3_enable (1/0, def. 1) Enables the plugin, of course! Set to 0 to remove all active custom weapons.
sm_cw3_onlyinspawn (1/0, def. 1) Only allow /custom to be used inside of a spawn room.
sm_cw3_arena_time (def. 20) Time, in seconds, to allow /custom after spawning in Arena.
sm_cw3_bots (def. 0.15) Percent chance, per slot, that bots will equip a random custom weapon.
sm_cw3_menu (1/0, def. 1) Clients are allowed to say /custom to equip weapons manually. Set to 0 to disable manual weapon selection without disabling the entire plugin.
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.
"attributes"; Requires cw2attributes or cw2legacy module. Each attribute has:
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)
"cw3_attributes"; the bread-n-butter. Requires cw3-attributes module. Each attribute has:
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.
EXAMPLE WEAPON CONFIG
Spoiler
Code:
"AW - Penetrator" // Weapon name.
{
"classes"
{
"sniper" "0" // Class and slot equipping the weapon.
}
"baseclass" "compound_bow" // The base class. This uses the Huntsman as a base.
"baseindex" "56" // Weapon index for base model and sounds.
"nobots" "1" // Whether or not bots can equip it.
"quality" "6" // Quality of the weapon, this one is unique.
"steamids" "STEAM_0:0:17402999" // Steamids of who should have this weapon in Self-Made quality. Also adds the sparkle effect!
"logname" "penetrator" // What prints in the log when someone is killed by this weapon.
"description" "Arrows can bounce up to 2 times\nArrows penetrates all enemies\n \n50% slower move speed when aiming\n25% slower fire rate\n \n \nCredit:\nGeneral Stat Sugguestion\n-Advanced Weaponiser\nCustom Attribute\n-MekuCube\n-Theray\nModel\n-Jukebox" // Description.
"cw3_attributes" // Attribute block
{
"projectiles bounce" // Attribute name.
{
"plugin" "advanced-weaponiser-2-attributes" // Plugin the attribute is from.
"value" "2" // Attribute value.
}
"projectile penetration" // Attribute name.
{
"plugin" "tf2attributes" // Plugin the attribute is from.
"value" "1" // Attribute value.
}
"fire rate penalty" // Attribute name.
{
"plugin" "tf2attributes" // Plugin the attribute is from.
"value" "1.25" // Attribute value.
}
"sniper aiming movespeed decreased" // Attribute name.
{
"plugin" "tf2attributes" // Plugin the attribute is from.
"value" ".5" // Attribute value.
}
"weapon_allow_inspect" // Attribute name.
{
"plugin" "tf2attributes" // Plugin the attribute is from.
"value" "1" // Attribute value.
}
}
"viewmodel" // Custom viewmodel.
{
"modelname" "models/weapons/c_models/c_doublebow/c_doublebow.mdl" // Location of the viewmodel file.
}
"worldmodel" // Custom worldmodel.
{
"modelname" "models/weapons/c_models/c_doublebow/c_doublebow.mdl" // Location of the worldmodel file.
}
}
Q&A
Spoiler
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!)
Download the latest CW3 Starter Kit from this post.
Put cw3.smx into your sourcemod/plugins folder.
Create a cw3 folder in sourcemod/plugins
Inside that folder, create a folder named modules
Inside that folder, place any modules you want to use.
Inside the cw3 folder, create a folder named attributes
Inside that folder, place any attribute plugins that run on cw3.
Inside your sourcemod/configs folder, create a folder called cutsomweapons
Inside that folder, place any weapon configs you have, or create your own!
Place tf2items.randomizer.txt into your sourcemod/gamedata folder.
(cw2attributes and cw2legacy users only) Inside your sourcemod/plugins folder, create a folder called customweaponstf
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.
Beta 1
Initial release.
KNOWN BUGS
Spoiler
sm_c reload does not work in server console, only a clients console.
UPDATED : 07/18/2016 : Version : 1.04/1.04/1.04 Sourcemod Version needed : 1.8
¥ Requests :
I do not take any requests anymore.
¥ A non-explained list of 159 attributes :
- ¥ ORION'S ATTRIBUTES : 85
- All Damage Done Multiplier
- Attack Speed On Kill
- Backstab Damage Modifier With A Stun
- Banner Extender
- Berserker Near Death
- Bleed At CLOSE RANGE
- Bullets Per Shot Bonus Dynamic
- Cannot Be Stunned
- Chance to Bleed
- Chance To Ignite
- Chance to Jarate
- Chance to Mad Milk
- Chance To Oneshot
- Charge Only On Health TRESHOLD DEMOMAN
- Combo
- Critical Hit Vs Invisible Players
- Critical Hit Vs. Airborne Players
- Critical Hit Vs. Burning Players at CLOSE RANGE
- Critical Hit Vs. Players In Water
- Critical Hit Vs. Scared Players
- Damage Bonus If Enemy Health Is Higher Than Threshold
- Damage Bonus If Enemy Health Is Lower Than Threshold
- Damage Bonus If Health Is Higher Than Threshold
- Damage Bonus If Health Is Lower Than Threshold
- Damage Bonus Vs. Airborne Players
- Damage Bonus Vs. Players In Water
- Damage Bonus Vs. Sappers
- Damage Charge Thing
- Damage Class
- Damage Done Is Selfhurt
- Damage Resistance Based On Health Missing
- Damage Resistance While Charging DEMOMAN
- Damage Self Upon Attacking
- Damage Taken Damage Nearby Enemies On Death
- Damage Taken From Backstab Reduced
- Damage Taken From Headshot Reduced
- Damage Taken While Invisible
- Damage When Metal Runs Out
- Disable Übercharge
- Drain Übercharge On Crit
- Drain Übercharge On Hit
- Enemy Health Lifesteal
- Enemy Health To Damage
- Fragmentation Grenade
- Health Lifesteal
- Health To Damage
- Heat Increases Damage Taken
- Heat Increases Fire Rate
- Homing Projectiles
- Hotsauce On Crit
- Hotsauce On Hit
- Ignite At Close Range
- Infinite Afterburn
- Kick-Ban On Kill-Hit
- Kill Will Gib
- Laser Damage Penalty
- Low Berserker Near Death
- Mark Victim Damage
- Maximum Enemy Health To Damage
- Maximum Health To Damage
- Metal Drain
- Metal On Hit
- Metal On Hit Damage
- Metal Per Shot
- Metal To Damage
- Mini-Critical Hit Vs. Burning Players at CLOSE RANGE
- Mini-Critical Hit Vs. Invisible Players
- Miss Decreases Fire Rate
- Missing Enemy Health Lifesteal
- Missing Enemy Health To Damage
- Missing Enemy Health To Damage FLAMETHROWER
- Missing Health To Damage
- Movement Speed To Damage
- Psycho Rampage
- Random Damage
- Remove Bleeding
- Scare On Kill
- Set Weapon Slot
- Spawn Skeleton On Kill
- Spy Condition Remover
- Steal Damage
- Stun On Crit
- Stun On Hit
- Teleport To Victim On Kill
- Übercharge On Hit
- ¥ MORE ADVANCED WEAPONISER 2'S ATTRIBUTES : 41
- Übercharge To Damage
- Enemy Übercharge To Damage
- Speed While Cloaked
- Invisible While Charging DEMOMAN
- Übercharge While Charging DEMOMAN
- Mark Victim
- Mark Victim For Death
- Damage Is Explosive
- Critical Damage Is Explosive
- Übercharge On Kill
- Add Condition On Alt-Fire
- Freely Deploy Übercharge
- Weapon Level Up [dealt]
- Weapon Level Up [received]
- Respawn Where You Died
- Fly While Shooting
- Minimann
- Disable Slot
- Disable Alt-Fire
- Jump Bonus On Hit-Kill
- Bonk Health
- Critical Hit On Health Threshold
- Mini-Crititical Hit While Disguised At CLOSE RANGE
- Crititical Hit While Disguised At CLOSE RANGE
- Non-Critical Hit Damage Multiplier
- Ragemeter Decreases When Not Doing Any Damage
- Speed Boost While On Fire
- Disorientate On Hit
- No Backstab
- Charged Airblast SOUND ONLY
- Meet The Sniper Combo
- Meet The Pyro Combo
- Increased Pushscale
- Disarm Silent
- Miss Causes Delay
- Electroshock
- Critical Hit Vs. Healing Medics
- Democharge On Hit
- Hotsauce Yourself On Miss
- Disable Primary Fire
- Metal Shield
- ¥ DOTA 2'S ATTRIBUTES : 33
- Bash
- Blade Mail
- Block Damage
- Bloodbath
- Bloodstone
- Burning Spear
- Craggy Exterior
- Critical Aura
- Damage Aura
- Desolator
- Dispersion
- Duel
- Enchant Totem
- Enrage
- Evasion
- Evasiveness On Hit
- Fervor
- Fury Swipes
- Inner Vitality
- Jinada
- Kill At High Health Threshold
- Kill At Low Health Threshold
- Last Will
- Lifesteal
- Lifesteal Aura
- Lifesteal On Crit
- Necromastery
- Overpower
- Radiance
- Radiance Evasion
- Return
- Static Field
- True Strike
¥ Changelog :
- 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.
I know the guy above doesn't take requests but someone just make an attribute that makes a hitscan have a very small aoe with no falloff from the explosion itself.
Last edited by shadowpikachu; 07-17-2016 at 04:53.