Creating custom weapons: Difference between revisions
From TF2 Classified Wiki
More actions
mNo edit summary |
mNo edit summary |
||
| (10 intermediate revisions by the same user 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 = | ||
| Line 13: | Line 12: | ||
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 == | == Setting up the custom item schema == | ||
Shown below are the | 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]] | [[File:example_02_emptyschema.png]] | ||
| Line 21: | Line 20: | ||
: 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. | : 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"}} | {{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"}} | {{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"}} | {{code|preset=3|"prefabs"}} | ||
: | : The parameter that contains prefabs, which will be explained later. | ||
{{code|preset=3|"attributes"}} | {{code|preset=3|"attributes"}} | ||
: | : The parameter that contains attributes, which will also be explained later. | ||
= Creating your first weapon = | = Creating your first weapon = | ||
== The | == The basics == | ||
To function, item entries must be placed under the {{code|preset=3|"items"}} parameter, with the exact indentation shown in the upcoming template. | |||
Shown below is a template item entry that contains the essential parameters for most custom weapons. Values in {{code|<>}} brackets are placeholder values that should be replaced by suitable ones. | |||
[[File:example_03_bns.png]] | |||
=== Explanation === | |||
{{code|"<item id>"}} | |||
: The unique ID used by the weapon. Be careful: if shared with another item entry, the custom item schema will fail to load. Try to use high values (ideally >= 10000) to prevent clashes with vanilla item entries. | |||
{{code|preset=3|"name"}} | |||
: The unique internal identifier used by the weapon. Like {{code|"<item id>"}}, the custom item schema will fail to load if it's shared with another entry. | |||
{{code|preset=3|"item_name"}} | |||
: The displayed name of the item, which can either be plaintext or a localised string (e.g. #TF_Weapon_Pistol). If you want to add "''The''" to the beginning of the name, add the {{code|preset=3|"propername"}} parameter to the item entry and set the value to 1. | |||
{{code|preset=3|"item_type_name"}} | |||
: The item's type, which is displayed under the name in the description. | |||
{{code|preset=3|"item_logname"}} | |||
: The name used by the weapon when reported in the developer console. | |||
{{code|preset=3|"item_iconname"}} | |||
: The name of the weapon's main killicon. If an invalid icon is pointed to, then the default skull icon will be used instead. Supports SVG icons in {{code|resource\svgs\deathnotice}} and VTF icons defined in {{code|scripts\mod_textures.txt}} and {{code|scripts\mod_textures_tf2c.txt}}. | |||
{{code|preset=3|"item_class"}} | |||
: The item class to be used as a base for your weapon. A list of available item classes can be found [[List of TF2C item classes|here]]. | |||
{{code|preset=3|"item_slot"}} | |||
: The loadout slot that the weapon is located in. Below is a list of functional {{code|preset=3|"item_slot"}} values: | |||
:: {{code|primary}} | |||
:: {{code|secondary}} | |||
:: {{code|melee}} | |||
:: {{code|pda}} | |||
:: {{code|pda2}} | |||
:: {{code|building}} | |||
:: {{code|action}} {{note|Not visible in the loadout menu}} | |||
:: {{code|utility}} {{note|Not visible in the loadout menu}} | |||
{{code|preset=3|"anim_slot"}} | |||
: The third-person and (if applicable) c_model animations to use. If absent, the item will use the default animations for its class. Below is a list of functional {{code|preset=3|"anim_slot"}} values: | |||
:: {{code|primary}} | |||
:: {{code|primary2}} | |||
:: {{code|secondary}} | |||
:: {{code|secondary2}} | |||
:: {{code|melee}} | |||
:: {{code|melee_allclass}} | |||
:: {{code|pda}} | |||
:: {{code|pda2}} | |||
:: {{code|building}} | |||
:: {{code|item1}} | |||
:: {{code|item2}} | |||
:: {{code|item3}} | |||
:: {{code|item4}} | |||
:: {{code|passtime_ball}} | |||
:: {{code|force_not_used}} | |||
{{code|preset=3|"model_player"}} | |||
: The model used in first person. | |||
{{code|preset=3|"model_world"}} | |||
: The model used in third person. If this parameter is absent from the item entry, the game will automatically use the model defined in the {{code|preset=3|"model_player"}} parameter. | |||
{{code|preset=3|"image_inventory"}} | |||
: The icon used in the loadout menu and bucket. | |||
{{code|preset=3|"attach_to_hands"}} | |||
: This parameter controls what model's animations are used. If set to 1, the class' c_arms will be used for the animations. If set to 2, the item model's animations will be used instead. | |||
{{code|preset=3|"used_by_classes"}} | |||
: This controls which classes can use the item. {{code|<backpack slot>}} can be set to 1 to use the loadout slot defined under {{code|preset=3|"item_slot"}}, or can be set to a specific loadout slot. | |||
{{code|preset=3|"attributes"}} | |||
: The list of attributes that modify the weapon's behaviour. You can add as many attributes as you'd like, just as long as the attribute class isn't repeated. Some attributes can be condensed into a single line if you wish (e.g. <attribute name> "<value>"), which is helpful for meta-attributes like {{code|"hidden separator"}} and {{code|"provide on active"}} that are repeated often. | |||
{{code|preset=3|"static_attrs"}} | |||
: A variant of {{code|preset=3|"attributes"}} that should '''only''' be used for attributes like {{code|"min_viewmodel_offset"}}. | |||
== Adding attributes == | == Adding attributes == | ||
TEMPTEXT | TEMPTEXT | ||