Team Fortress 2

Team Fortress 2

十分な評価がありません
How to create custom weapons
作者: Blue bridge と 1 のコラボレーション
This guide will teach you the best way to create your own custom weapons for Team Fortress 2 and try them out ingame, including allowing other players to use them without downloading client-side mods and making a demonstration video for your weapon.

I have talked to multiple people regarding this topic, including Crafting, Top Kekkeroni, CHData, Karma Charger, WindPower. I hope to put as much information as possible in a central place.
2
   
アワード
お気に入り
お気に入り
お気に入りから削除
Formatting custom weapon file
In addition to creating your own attributes, you can also use already existing attributes. You can use "tf2attributes" as the plugin file to use any attribute that already exists in TF2 (see here for a list. Keep in mind some of the "unused" attributes do not work). There are also Orionr's attributes[forums.alliedmods.net] and Yoner's attributes[forums.alliedmods.net].


Crafting has created a video tutorial on formatting this file as well. See some example weapons[forums.alliedmods.net].
Creating custom attributes
If you are not already experience in SourcePawn, you may have some difficulty creating custom attributes.

custom attributes can be read using the functions TF2CustAttr_GetString, TF2CustAttr_GetInt, and TF2CustAttr_GetFloat from tf_custom_attributes.inc ,i.e. TF2CustAttr_GetInt(WeaponIndex, "attribute name") with the weapon's text file containing something like this


"attribute name"
{
"plugin" "custom-attribute-adapter/plugin_name"
"value" "1"
}

Generally 0 will be returned if trying to pull an int from a string value, or if the weapon doesn't contain the attribute.

Here is an example[pastebin.com] of a custom attribute that prevents a weapon's primary fire from being used.
Custom models
Custom models can either be modelled yourself using a program such as Blender, or taken from another place such as GameBanana. Sometimes, models may not be visible to other players -- Valve has done this intentionally to hinder community modding instead of buying from the Mann Co. Store.

Custom models can be put as "viewmodel" or "world_model" - but you will need to use this plugin[forums.alliedmods.net] to ensure the model files are downloaded.
28 件のコメント
Puddle (She/Her) 9月1日 17時05分 
btw I made a kind of different tutorial about the same thing https://tf2maps.net/threads/what-ive-learned-on-how-to-make-custom-weapons.52961/
Xavier Dharmawan 3月1日 9時29分 
Is this works on team fortress 2 Classic?
KitChaos 1月31日 4時50分 
ahaaaaa thats where I went wrong, I don't seem to have any JSON files in the directory. I was just pointing out the path in downloads.ini (assuming tf was root) and that wasn't working where should I put/find such a json file?
Blue bridge  [作成者] 1月31日 0時32分 
You can put them in any path you want-- you just need to set it in the JSON to point to the path you put them in.
KitChaos 1月30日 10時48分 
Is there a more in-depth tutorial I can find on how to assign weapon models? or can you give me some advice such as on file placement?
thanks
(hopefully last thing)
KitChaos 1月30日 5時12分 
thank you so much for all the help, this guide is really useful!
KitChaos 1月30日 4時52分 
ah, my bad, I did not have custom weapons 3 installed, I will get that in
sorry!
KitChaos 1月30日 4時49分 
Could you give me the syntax rq? Like if I was to give myself the afterburner weapon from the test weapons, how would I do that? as I don't seem to see a /c command anywhere
Blue bridge  [作成者] 1月29日 20時30分 
With the /c command!
KitChaos 1月29日 18時40分 
How can I actually give myself the weapon to use in game? for my local server