Creating custom weapons: Difference between revisions
mNo edit summary |
No edit summary |
||
| (28 intermediate revisions by 2 users not shown) | |||
| Line 5: | Line 5: | ||
'''This guide is currently incomplete, so please look for a better one while this is being worked on! | '''This guide is currently incomplete, so please look for a better one while this is being worked on! | ||
If you're here, chances are you're looking to create your own weapons for ''TF2 Classified''. Whether for use against bots or other players, this guide should hopefully cover the majority of your questions regarding custom weapon creation. If it doesn't, ask for help in the #modding-discussion channel in the [https://discord.gg/tf2classified official TF2C Discord]. | |||
If you're here, chances are you're looking to create your own weapons for ''TF2 Classified''. Whether for use against bots or other players, this guide should hopefully cover the majority of your questions regarding custom weapon creation. If it doesn't, ask | |||
= Getting Started = | = Getting Started = | ||
Before going over how to create custom weapons, we first need a functional custom item schema to put them into. The item schema is basically a big list that you append all of your weapons into, and is arguably the single most important file for that reason. It uses [https://developer.valvesoftware.com/wiki/VDF VDF], which is the standard format for storing game-related metadata in Source. If you don't know '''VDF''', don't worry - it won't take long to understand the syntax. | |||
== Creating the custom item schema == | |||
To begin, create a file named {{code|custom_items_game.txt}} in the {{code|<SteamUserDir>\Team Fortress 2 Classified\tf2classified\custom\<Mod Name>\scripts}} directory. This is the file that will contain all of the information regarding your custom weapons. Please note that you cannot have multiple ''custom_items_game.txt'' files loaded simultaneously, so any other mod folders that contain them should be placed in {{code|tf2classified\custom\disabled}} to allow the new custom item schema to load. | To begin, create a file named {{code|custom_items_game.txt}} in the {{code|<SteamUserDir>\Team Fortress 2 Classified\tf2classified\custom\<Mod Name>\scripts}} directory. This is the file that will contain all of the information regarding your custom weapons. Please note that you cannot have multiple ''custom_items_game.txt'' files loaded simultaneously, so any other mod folders that contain them should be placed in {{code|tf2classified\custom\disabled}} to allow the new custom item schema to load. | ||
== Setting up the custom item schema == | |||
Shown below are the main parameters that should ideally be included in every single item schema. Copy this exactly into your {{code|custom_items_game.txt}} file. | |||
[[File:example_02_emptyschema.png]] | |||
=== Explanation === | |||
{{code|preset=3|base "items_game.txt"}} | |||
: This line is responsible for merging the data from the custom item schema into TF2C's main item schema. Without this, none of TF2C's items, prefabs or attributes will load, which isn't very ideal. | |||
{{code|preset=3|"items_game"}} | |||
: The parameter that contains everything unique to the item schema. Whilst not particularly interesting, it's vital for the item schema to run. | |||
{{code|preset=3|"items"}} | |||
: The parameter that contains items. They must be defined here in order for them to appear in game. | |||
{{code|preset=3|"prefabs"}} | |||
: The parameter that contains prefabs, which will be explained later. | |||
{{code|preset=3|"attributes"}} | |||
: The parameter that contains attributes, which will also be explained later. | |||
= Creating your first weapon = | |||
== The basics == | |||
Shown below is a template item entry that contains the essential parameters for most custom weapons. Please not it won't work if you copy everything literally. Anything in {{code|<>}} brackets should be replaced by a suitable value. | |||
== Adding attributes == | |||
TEMPTEXT | |||
== Changing the model(s) and sounds == | |||
TEMPTEXT | |||
== Testing the weapon == | |||
TEMPTEXT | |||
= Advanced weapon creation = | |||
== Creating custom models, effects and sounds == | |||
TEMPTEXT | |||
== Making custom attributes == | |||
TEMPTEXT | |||
== VScript == | |||
TEMPTEXT Link to a separate VScript page | |||
= See also = | |||
* [[List of TF2C item attributes]] | |||
* [[List of TF2C item classes]] | |||
* [[List of TF2C conditions]] | |||
[[Category:Guides]] | |||
= Misc info to be added to the finished sections (TEMP!)= | |||
* It should be noted that custom weapons don't currently show up in the loadout on the main menu. To view them, you need to load into a map first.{{note|rei note! if using a items_game instead of a custom_items_game they will load on the main menu. however this means you are more prone to schema breakage between game versions and you gotta constantly update your copy anytime they update the item schema}} | |||
* It's a good idea to go over the basic parameters that most weapons should have. Failing to include these can either break the weapon in some way or completely prevent the whole pack from loading. | |||
* Duplicate {{code|name}} parameters in a single weapon entry will prevent the custom item schema from loading. Same goes for duplicate entry IDs. | |||
* Duplicating certain parameters, {{code|attributes}} for example, does work, but it's advised not to do this to keep your weapon entries tidy. | |||
* Prefab info | |||
** Prefabs work as templates. Load order is important; Prefab at the top means you want to overwrite the prefab, Prefab at the bottom means you want prefab to overwrite you | |||
** List based parameters (like visuals and static attrs) will get merged. Single value parameters (like bucket or attach to hands) will get overwritten. | |||
** Prefabs cannot have spaces in the name. This is because spaces are used as a delimiter to apply multiple prefabs. (eg, {{code|prefab "prefab1 prefab2"}} will make the weapon inherit the parameters from both {{code|prefab1}} and {{code|prefab2}}) | |||
* {{code|item_name}}, {{code|item_type_name}}, {{code|item_description}} and {{code|description_string}} support localized strings. | |||
* {{code|item_name_color}} and {{code|custom_color}} allow weapon names and attributes respectively to be coloured with RGB values. | |||
* {{code|custom_level_sounds.txt}} can be used to create custom soundscripts for weapons. Please correct this if there's a better way of doing this! | |||
* Localization strings in {{code|tf2c_english.txt}} | |||
* {{code|baseitem}} sets an item as the default in its slot. Rather finicky, so avoid using. | |||
* Attribute info | |||
** Weapon attributes are set in the {{code|attributes}} and rarely {{code|static_attrs}} parameters. | |||
** Attributes are defined in the attributes section of the schema using a similar system to item entries. | |||
** Though attributes with custom code aren't possible without VScript (correct this if wrong), variants of existing attributes can be created by making a new attribute with the same attribute class. {{note|rei note! certain attributes HATE being customized and will ONLY work if the attribute is specifically the original one by name?? certain parts of the code specifically check for attribute name and not attribute class}} | |||
** Quite a few weapon attributes have interesting behavior if set to additive mode | |||
= Important note! = | |||
Aside from parameter or model/sound/etc names, please don't allow people to directly copy and paste things from here into their schemas. It's important that people actually take the time to understand how the schema works rather than just copying and pasting things and having no clue of what individual bits do. | |||
Revision as of 16:59, 24 June 2026
| This article is a stub. You can help TF2 Classified Wiki by expanding it. |
| A todo list has been written for this article.
The specific instructions are: Add literally any information that is useful. I'll trim the fat and clean up the remaining stuff afterwards. |
This guide is currently incomplete, so please look for a better one while this is being worked on!
If you're here, chances are you're looking to create your own weapons for TF2 Classified. Whether for use against bots or other players, this guide should hopefully cover the majority of your questions regarding custom weapon creation. If it doesn't, ask for help in the #modding-discussion channel in the official TF2C Discord.
Getting Started
Before going over how to create custom weapons, we first need a functional custom item schema to put them into. The item schema is basically a big list that you append all of your weapons into, and is arguably the single most important file for that reason. It uses VDF, which is the standard format for storing game-related metadata in Source. If you don't know VDF, don't worry - it won't take long to understand the syntax.
Creating the custom item schema
To begin, create a file named custom_items_game.txt in the <SteamUserDir>\Team Fortress 2 Classified\tf2classified\custom\<Mod Name>\scripts directory. This is the file that will contain all of the information regarding your custom weapons. Please note that you cannot have multiple custom_items_game.txt files loaded simultaneously, so any other mod folders that contain them should be placed in tf2classified\custom\disabled to allow the new custom item schema to load.
Setting up the custom item schema
Shown below are the main parameters that should ideally be included in every single item schema. Copy this exactly into your custom_items_game.txt file.
Explanation
base "items_game.txt"
- This line is responsible for merging the data from the custom item schema into TF2C's main item schema. Without this, none of TF2C's items, prefabs or attributes will load, which isn't very ideal.
"items_game"
- The parameter that contains everything unique to the item schema. Whilst not particularly interesting, it's vital for the item schema to run.
"items"
- The parameter that contains items. They must be defined here in order for them to appear in game.
"prefabs"
- The parameter that contains prefabs, which will be explained later.
"attributes"
- The parameter that contains attributes, which will also be explained later.
Creating your first weapon
The basics
Shown below is a template item entry that contains the essential parameters for most custom weapons. Please not it won't work if you copy everything literally. Anything in <> brackets should be replaced by a suitable value.
Adding attributes
TEMPTEXT
Changing the model(s) and sounds
TEMPTEXT
Testing the weapon
TEMPTEXT
Advanced weapon creation
Creating custom models, effects and sounds
TEMPTEXT
Making custom attributes
TEMPTEXT
VScript
TEMPTEXT Link to a separate VScript page
See also
Misc info to be added to the finished sections (TEMP!)
- It should be noted that custom weapons don't currently show up in the loadout on the main menu. To view them, you need to load into a map first.[note]
- It's a good idea to go over the basic parameters that most weapons should have. Failing to include these can either break the weapon in some way or completely prevent the whole pack from loading.
- Duplicate name parameters in a single weapon entry will prevent the custom item schema from loading. Same goes for duplicate entry IDs.
- Duplicating certain parameters, attributes for example, does work, but it's advised not to do this to keep your weapon entries tidy.
- Prefab info
- Prefabs work as templates. Load order is important; Prefab at the top means you want to overwrite the prefab, Prefab at the bottom means you want prefab to overwrite you
- List based parameters (like visuals and static attrs) will get merged. Single value parameters (like bucket or attach to hands) will get overwritten.
- Prefabs cannot have spaces in the name. This is because spaces are used as a delimiter to apply multiple prefabs. (eg, prefab "prefab1 prefab2" will make the weapon inherit the parameters from both prefab1 and prefab2)
- item_name, item_type_name, item_description and description_string support localized strings.
- item_name_color and custom_color allow weapon names and attributes respectively to be coloured with RGB values.
- custom_level_sounds.txt can be used to create custom soundscripts for weapons. Please correct this if there's a better way of doing this!
- Localization strings in tf2c_english.txt
- baseitem sets an item as the default in its slot. Rather finicky, so avoid using.
- Attribute info
- Weapon attributes are set in the attributes and rarely static_attrs parameters.
- Attributes are defined in the attributes section of the schema using a similar system to item entries.
- Though attributes with custom code aren't possible without VScript (correct this if wrong), variants of existing attributes can be created by making a new attribute with the same attribute class. [note]
- Quite a few weapon attributes have interesting behavior if set to additive mode
Important note!
Aside from parameter or model/sound/etc names, please don't allow people to directly copy and paste things from here into their schemas. It's important that people actually take the time to understand how the schema works rather than just copying and pasting things and having no clue of what individual bits do.
