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
m Improved examples by showing their proper positions in the item schema, and by adding <...> for areas that should have more stuff
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 21: 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 {{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.
To begin, create a file named {{code|custom_items_game.txt}} in the {{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''.
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''.
Line 217: Line 217:
"image_inventory" "backpack/weapons/w_models/w_pistol"
"image_inventory" "backpack/weapons/w_models/w_pistol"
"attach_to_hands" "1"
"attach_to_hands" "2"


"used_by_classes"
"used_by_classes"
Line 269: Line 269:
"<item ID>"
"<item ID>"
{
{
<...>
"attributes"
"attributes"
{
{
Line 287: Line 288:
}
}
}
}
<...>
}
}
}
}
Line 344: Line 346:
"<item ID>"
"<item ID>"
{
{
<...>
"attributes"
"attributes"
{
{
Line 362: Line 365:
}
}
}
}
<...>
}
}
}
}
Line 475: 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.
= Modifying vanilla weapons =
''This section will potentially include a different method for editing vanilla weapons that isn't widely used. In the meantime, please do '''not''' write any current methods here or use this as a guide.''
By including empty copies of stock weapons in your custom item schema, you can prevent them from disappearing when you edit one of them.
Everything added into the empty copies will be combined with the corresponding entries in the vanilla item schema.
Below is an example {{code|custom_items_game.txt}} file that contains empty copies of every item with the {{code|preset=3|baseitem}} parameter.
<pre>
#base "items_game.txt"
"items_game"
{
"items"
{
"0" // Bat
{
}
"1" // Bottle
{
}
"2" // Fire Axe
{
}
"3" // Kukri
{
}
"4" // Knife
{
}
"5" // Fists
{
}
"6" // Shovel
{
}
"7" // Wrench
{
}
"8" // Bonesaw
{
}
"9" // Shotgun (Engineer)
{
}
"10" // Shotgun (Soldier)
{
}
"11" // Shotgun (Heavy)
{
}
"12" // Shotgun (Pyro)
{
}
"13" // Scattergun
{
}
"14" // Sniper Rifle
{
}
"15" // Minigun
{
}
"16" // SMG
{
}
"17" // Syringe Gun
{
}
"18" // Rocket Launcher
{
}
"19" // Grenade Launcher
{
}
"20" // Stickybomb Launcher
{
}
"21" // Flame Thrower
{
}
"22" // Pistol (Engineer)
{
}
"23" // Pistol (Scout)
{
}
"24" // Revolver
{
}
"25" // PDA: Teleporter (Construction PDA)
{
}
"26" // Destruction PDA
{
}
"27" // Disguise Kit
{
}
"28" // Builder (Toolbox)
{
}
"29" // Medi Gun
{
}
"30" // Invis Watch
{
}
"735" // Sapper
{
}
"1132" // Spellbook Magazine (Halloween)
{
}
"1152" // Grappling Hook (Mannpower)
{
}
"1155" // PASS Time Jack (PASS Time)
{
}
"2000" // Umbrella
{
}
}
}
</pre>
= List of useful attributes =
This is going here temporarily before the table entries from [[List of TF2C item attributes]] are added.
43 – scattergun no reload single (set_scattergun_no_reload_single)
128 - provide on active (provide_on_active)
280 – override projectile type (override_projectile_type)
298 – mod ammo per shot (mod_ammo_per_shot)
303 – mod max primary clip override (mod_max_primary_clip_override)
551 – special taunt (special_taunt)
674 – class select override vcd ( class_select_override_vcd)
675 - custom projectile model (custom_projectile_model)
796 – min_viewmodel_offset (min_viewmodel_offset)
2029 - allowed in medieval mode (allowed_in_medieval_mode)
2058 – meter_label (meter_label)
5011 - extra wearable bodygroup toggle active (extra_wearable_bodygroup_toggle_active)
5048 - custom hand viewmodel (custom_hand_viewmodel)
5129 – mod burstfire (mod_burstfire)
5135 – hidden separator (hidden_separator)
5157 – passive reload holstered (passive_reload_holstered)
5194 – hide ammo hud (hide_ammo_hud)
5199 - banned in medieval mode (banned_in_medieval_mode)
5201 - custom disguise sound (custom_disguise_sound)
5228 - mod ammo per reload (mod_ammo_per_reload)
5229 - set reload single (set_reload_single)
5230 - Reload time start (mult_reload_time_start)
5231 - Reload time refill (mult_reload_time_refill)
5249 - mod use custom ammo type (mod_use_custom_ammo_type)
5252 - set sentry bullet (set_sentry_bullet)
5253 - set sentry rocket (set_sentry_rocket)
5254 - weapon exclusive to holiday (weapon_exclusive_to_holiday)
5256 - mod projectiles per shot (mod_projectiles_per_shot)
5263 - mod set banner flag model (mod set banner flag model)
5264 - custom banner sound (custom_banner_sound)
5268 - auto jumping (auto_jumping)
5270 - always draw tracer (mod_always_draw_tracer_effect)
5271 - never draw tracer (mod_never_draw_tracer_effect)
5272 - duck jumping (duck_jumping)
??? - custom_magazine_model


= See also =
= See also =