Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Creating custom weapons - basics: Difference between revisions

From TF2 Classified Wiki
mNo edit summary
 
(8 intermediate revisions by the same user not shown)
Line 8: Line 8:
Adjust the positions of the examples and text to look less messy.
Adjust the positions of the examples and text to look less messy.


If you're going to add information, put it in [[Creating custom weapons#Creating your first weapon|Creating your first weapon]] only if it's '''very''' important, and otherwise put it in [[Creating custom weapons#Advanced weapon creation|Advanced weapon creation]]. Do NOT overwhelm beginners!}}
If you're going to add information, put it in [[Creating custom weapons#Creating your first weapon|Creating your first weapon]] only if it's '''very''' important to creating weapons, and otherwise put it in [[Creating custom weapons - advanced]]. Do NOT overwhelm beginners!


Don't try to fix the wonky indentation in the examples. It's inconsequential and fixing it here will make it look bad in Notepad ++, so it's best to leave it as is. Yeah, I'm annoyed by it too lol}}


'''This guide is currently incomplete, but it should suffice if you just need the basics!


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].
'''This guide is currently incomplete, but it should suffice if you just need the very basics!'''
 
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 help you to start out with creating custom weapons. If it doesn't, consider asking for help in the '''#modding-discussion''' channel in the [https://discord.gg/tf2classified official TF2C Discord].


= Creating a custom item schema =
= Creating a custom item schema =
Line 19: Line 21:


== custom_items_game.txt ==
== custom_items_game.txt ==
To begin, create a file named {{code|custom_items_game.txt}} in your {{code|<SteamUserDir>\Team Fortress 2 Classified\tf2classified\custom\<Mod Name>\scripts\items}} directory. This is the file that contains all 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 your {{code|<SteamUserDir>\Team Fortress 2 Classified\tf2classified\custom\<Mod Name>\scripts\items}} directory. This is the file that contains all the information regarding your custom weapons. Please note that you cannot have multiple {{code|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.
 
It should be noted that the {{code|custom_items_game.txt}} method is the simplest and objectively best option for defining custom weapons, as it automatically inherits data from the newest version of the vanilla {{code|items_game.txt}} file. It is possible to override the vanilla item schema with one that contains custom weapons, but this method is not recommended as the overriding file must be manually updated each patch for parity with the vanilla {{code|items_game.txt}} file. For you and your players' sake, use the {{code|custom_items_game.txt}} method ''only''.


== Setting up parameters ==
== Setting up parameters ==
Line 61: Line 65:


<pre>
<pre>
"<item id>"
"items_game"
{
{
"name" "<internal name>"
"items"
"item_name" "<item name>"
{
"item_type_name" "<item type name>"
"<item id>"
{
"name" "<internal name>"
"item_name" "<item name>"
"item_type_name" "<item type name>"
"item_quality" "<item name colour>"
"item_quality" "<item name colour>"
"item_logname" "<dev console name>"
"item_logname" "<dev console name>"
"item_iconname" "<icon name>"
"item_iconname" "<icon name>"
"item_class" "<item class>"
"item_class" "<item class>"
"item_slot" "<backpack slot>"
"item_slot" "<backpack slot>"
"anim_slot" "<player model and c_model animations>"
"anim_slot" "<player model and c_model animations>"


"bucket" "<inventory slot override>"
"bucket" "<inventory slot override>"
"bucket_position" "<inventory subslot override>"
"bucket_position" "<inventory subslot override>"
"model_player" "<view model>"
"model_player" "<view model>"
"model_world" "<world model>"
"model_world" "<world model>"
"image_inventory" "<backpack icon>"
"image_inventory" "<backpack icon>"
"attach_to_hands" "<view model animation type>"
"attach_to_hands" "<view model animation type>"
 
"used_by_classes"
{
"<class>" "<backpack slot>"
}


"used_by_classes"
"attributes"
{
{
"<class>" "<backpack slot>"
"<attribute name>"
}
{
"attribute_class" "<attribute class>"
"value" "<value>"
}
}
"static_attrs"
{
"<attribute class>" "<value>"
}
"visuals"
{
"<parameter>" "value"
}


"attributes"
"mouse_pressed_sound" "<backpack select sound>"
{
"drop_sound" "<backpack deselect sound>"
"<attribute name>"
{
"attribute_class" "<attribute class>"
"value" "<value>"
}
}
}
}
"static_attrs"
{
"<attribute class>" "<value>"
}
"visuals"
{
"<parameter>" "value"
}
"mouse_pressed_sound" "<backpack select sound>"
"drop_sound" "<backpack deselect sound>"
}
}
</pre>
</pre>
Line 184: Line 194:


<pre>
<pre>
"10000" // Custom Pistol
"items_game"
// You can add comments to your item schema with double slashes!
{
{
"name" "CUSTOM_PISTOL_TEST"
"items"
"item_name" "Custom Pistol"
{
"item_type_name" "#TF_Weapon_Pistol"
"10000" // Custom Pistol
// You can add comments to your item schema with double slashes!
{
"name" "CUSTOM_PISTOL_TEST"
"item_name" "Custom Pistol"
"item_type_name" "#TF_Weapon_Pistol"
"item_logname" "pistol_test"
"item_logname" "pistol_test"
"item_iconname" "pistol"
"item_iconname" "pistol"
"item_class" "tf_weapon_pistol"
"item_class" "tf_weapon_pistol"
"item_slot" "secondary"
"item_slot" "secondary"
"anim_slot" "secondary"
"anim_slot" "secondary"
"model_player" "models/weapons/v_models/v_pistol_scout.mdl"
"model_player" "models/weapons/v_models/v_pistol_scout.mdl"
"model_world" "models/weapons/w_models/w_pistol.mdl"
"model_world" "models/weapons/w_models/w_pistol.mdl"
"image_inventory" "backpack/weapons/w_models/w_pistol"
"image_inventory" "backpack/weapons/w_models/w_pistol"
"attach_to_hands" "1"
"attach_to_hands" "1"
 
"used_by_classes"
{
"scout" "1"
}


"used_by_classes"
"attributes"
{
{
"scout" "1"
"clip size bonus"
}
{
"attribute_class" "mult_clipsize"
"value" "2"
}
"damage penalty"
{
"attribute_class" "mult_dmg"
"value" "0.67"
}
}
"static_attrs"
{
"min_viewmodel_offset" "10 0 -10"
}
"visuals"
{
"sound_single_shot" "Weapon_Winger.Single"
"sound_burst" "Weapon_Winger.SingleCrit"
}


"attributes"
"mouse_pressed_sound" "ui/item_light_gun_pickup.wav"
{
"drop_sound" "ui/item_light_gun_drop.wav"
"clip size bonus"
{
"attribute_class" "mult_clipsize"
"value" "2"
}
"damage penalty"
{
"attribute_class" "mult_dmg"
"value" "0.67"
}
}
}
}
"static_attrs"
{
"min_viewmodel_offset" "10 0 -10"
}
"visuals"
{
"sound_single_shot" "Weapon_Winger.Single"
"sound_burst" "Weapon_Winger.SingleCrit"
}
"mouse_pressed_sound" "ui/item_light_gun_pickup.wav"
"drop_sound" "ui/item_light_gun_drop.wav"
}
}
</pre>
</pre>
Line 247: Line 263:


<pre>
<pre>
"attributes"
"items_game
{
{
"damage bonus"
"items"
{
{
"attribute_class" "mult_dmg"
"<item ID>"
"value" "1.33"
{
}
<...>
"clip size penalty"
"attributes"
{
{
"attribute_class" "mult_clipsize"
"damage bonus"
"value" "0.5"
{
}
"attribute_class" "mult_dmg"
"can headshot"
"value" "1.33"
{
}
"attribute_class" "can_headshot"
"clip size penalty"
"value" "1"
{
"attribute_class" "mult_clipsize"
"value" "0.5"
}
"can headshot"
{
"attribute_class" "can_headshot"
"value" "1"
}
}
<...>
}
}
}
}
}
Line 279: Line 306:


<pre>
<pre>
"40000"
"items_game"
{
{
"name" "can headshot VISIBLE"
<...>
"attribute_class" "can_headshot"
"attributes"
"description_format" "value_is_additive"
{
"stored_as_integer" "1"
"40000"
{
"description_string" "#Attrib_RevolverUseHitLocations"
"name" "can headshot VISIBLE"
"attribute_class" "can_headshot"
"description_format" "value_is_additive"
"stored_as_integer" "1"
 
"description_string" "#Attrib_RevolverUseHitLocations"
}
}
}
}
</pre>
</pre>
Line 306: Line 340:


<pre>
<pre>
"attributes"
"items_game"
{
{
"can headshot VISIBLE"
"items"
{
{
"attribute_class" "can_headshot"
"<item ID>"
"value" "1"
{
}
<...>
"damage bonus"
"attributes"
{
{
"attribute_class" "mult_dmg"
"can headshot VISIBLE"
"value" "1.33"
{
}
"attribute_class" "can_headshot"
"clip size penalty"
"value" "1"
{
}
"attribute_class" "mult_clipsize"
"damage bonus"
"value" "0.5"
{
"attribute_class" "mult_dmg"
"value" "1.33"
}
"clip size penalty"
{
"attribute_class" "mult_clipsize"
"value" "0.5"
}
}
<...>
}
}
}
}
}
Line 334: Line 379:


<pre>
<pre>
"40000"
"items_game"
{
{
"name" "can headshot VISIBLE"
<...>
"attribute_class" "can_headshot"
"attributes"
"description_format" "value_is_additive"
{
"stored_as_integer" "1"
"40000"
{
"description_string" "#Attrib_RevolverUseHitLocations"
"name" "can headshot VISIBLE"
"effect_type" "positive"
"attribute_class" "can_headshot"
"description_format" "value_is_additive"
"stored_as_integer" "1"
"description_string" "#Attrib_RevolverUseHitLocations"
"effect_type" "positive"
}
}
}
}
</pre>
</pre>
Line 357: Line 409:


<pre>
<pre>
"item_logname" "pistol_test"
"items_game"
"item_iconname" "winger"
{
"items"
{
"<item ID>"
{
<...>
"item_logname" "pistol_test"
"item_iconname" "winger"


"item_class" "tf_weapon_pistol"
"item_class" "tf_weapon_pistol"


"item_slot" "secondary"
"item_slot" "secondary"
"anim_slot" "secondary"
"anim_slot" "secondary"


"model_player" "models/workshop/weapons/c_models/c_winger_pistol/c_winger_pistol.mdl"
"model_player" "models/workshop/weapons/c_models/c_winger_pistol/c_winger_pistol.mdl"
"image_inventory" "backpack/workshop/weapons/c_models/c_winger_pistol/c_winger_pistol"
"image_inventory" "backpack/workshop/weapons/c_models/c_winger_pistol/c_winger_pistol"


"attach_to_hands" "1"
"attach_to_hands" "1"


"used_by_classes"
"used_by_classes"
{
{
"scout" "1"
"scout" "1"
"engineer" "1"
"engineer" "1"
}
<...>
}
}
}
}
</pre>
</pre>
Line 390: Line 453:


<pre>
<pre>
"model_player_per_class"
"items_game"
{
{
"engineer" "models/weapons/v_models/v_pistol_engineer.mdl"
"items"
"scout" "models/weapons/v_models/v_pistol_scout.mdl"
{
"<item ID>"
{
<...>
"model_player_per_class"
{
"engineer" "models/weapons/v_models/v_pistol_engineer.mdl"
"scout" "models/weapons/v_models/v_pistol_scout.mdl"
}
<...>
}
}
}
}
</pre>
</pre>
Line 405: Line 479:
=== Making changes ===
=== Making changes ===
If you make changes to the custom item schema, use the command {{code|cl_reload_item_schema}} to show the changes in game. {{code|sv_reload_item_schema}} can also be used to update the custom item schema for the whole server in multiplayer.
If you make changes to the custom item schema, use the command {{code|cl_reload_item_schema}} to show the changes in game. {{code|sv_reload_item_schema}} can also be used to update the custom item schema for the whole server in multiplayer.
= Advanced weapon creation =
== Prefabs ==
=== Creating prefabs ===
TEMPTEXT
=== Using prefabs ===
TEMPTEXT
== Advanced parameters ==
=== Tags ===
You can add "bots_cant_use" "1" which will make bots unable to equip them. Note that bots can still equip items that have "show_in_armory" "0" so make sure you do this too if you're trying to keep bots from equipping hidden weapons.
TODO: Add more info
=== Taunts ===
TEMPTEXT
=== Bucket ===
TEMPTEXT
=== List of visual parameters ===
TEMPTEXT
=== Team-specific visuals ===
TEMPTEXT
=== Animation replacements ===
TEMPTEXT
=== Custom text colours ===
TEMPTEXT
== Custom models and effects ==
=== Custom models ===
TEMPTEXT
=== Custom sounds ===
TEMPTEXT
=== Custom particles ===
TEMPTEXT
== VScript ==
VScript allows you to create weapons with completely custom functionality.


= See also =
= See also =
* [[Creating custom weapons - advanced]]
* [[Creating custom weapons - VScript]]
* [[List of TF2C item attributes]]
* [[List of TF2C item attributes]]
* [[List of TF2C item classes]]
* [[List of TF2C item classes]]