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
Tags: added bots_cant_use tag to the list. Maybe make this a table?
No edit summary
Line 22: Line 22:
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.
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]]
<pre>
[[File:example_02_emptyschema.png]] TEMPTEXT
</pre>


=== Explanation ===
=== Explanation ===
Line 43: Line 45:
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.
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]]
<pre>
[[File:example_03_bns.png]] TEMPTEXT
</pre>


=== Explanation ===
=== Explanation ===
Line 62: Line 66:
{{code|preset=3|"item_slot"}}
{{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:
: The loadout slot that the weapon is located in. Below is a list of functional {{code|preset=3|"item_slot"}} values:
:: {{code|primary}}
<pre>
:: {{code|secondary}}
primary
:: {{code|melee}}
secondary
:: {{code|pda}}
melee
:: {{code|pda2}}
pda
:: {{code|building}}
pda2
:: {{code|action}} {{note|Not visible in the loadout menu}}
building
:: {{code|utility}} {{note|Not visible in the loadout menu}}
action
utility
</pre>
{{code|preset=3|"anim_slot"}}
{{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:
: 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}}
<pre>
:: {{code|primary2}}
primary
:: {{code|secondary}}
primary2
:: {{code|secondary2}}
secondary
:: {{code|melee}}
secondary2
:: {{code|melee_allclass}}
melee
:: {{code|pda}}
melee_allclass
:: {{code|pda2}}
pda
:: {{code|building}}
pda2
:: {{code|item1}}
building
:: {{code|item2}}
item1
:: {{code|item3}}
item2
:: {{code|item4}}
item3
:: {{code|passtime_ball}}
item4
:: {{code|force_not_used}}
passtime_ball
force_not_used
</pre>
{{code|preset=3|"model_player"}}
{{code|preset=3|"model_player"}}
: The model used in first person.
: The model used in first person.
Line 111: Line 119:
Below is an example item entry for a custom [[Pistol]] with a clip size bonus, a damage penalty and the [[tf:Winger|Winger]]'s fire sounds. Copy it and give modifying it a go to get a feel for making items. If you're looking for models and soundscripts, try using [https://developer.valvesoftware.com/wiki/Half-Life_Model_Viewer%2B%2B HLMV++] and/or [https://developer.valvesoftware.com/wiki/Hammer%2B%2B Hammer ++], or look at item entries in TF2 and TF2C's item schemas.
Below is an example item entry for a custom [[Pistol]] with a clip size bonus, a damage penalty and the [[tf:Winger|Winger]]'s fire sounds. Copy it and give modifying it a go to get a feel for making items. If you're looking for models and soundscripts, try using [https://developer.valvesoftware.com/wiki/Half-Life_Model_Viewer%2B%2B HLMV++] and/or [https://developer.valvesoftware.com/wiki/Hammer%2B%2B Hammer ++], or look at item entries in TF2 and TF2C's item schemas.


[[File:example_04_custompistol.png]]
<pre>
 
[[File:example_04_custompistol.png]] TEMPTEXT
</pre>


Here's how the description looks in game:
Here's how the description looks in game:
Line 122: Line 131:
As mentioned above, the Custom Pistol has two attributes: a clip size bonus and a damage penalty, which gives it a clip size of 24 and a base damage of 10. It's a bit boring, so how about we spice things up a bit?
As mentioned above, the Custom Pistol has two attributes: a clip size bonus and a damage penalty, which gives it a clip size of 24 and a base damage of 10. It's a bit boring, so how about we spice things up a bit?


[[File:example_07_canheadshot.png]]
<pre>
 
[[File:example_07_canheadshot.png]] TEMPTEXT
</pre>


Now, the Custom Pistol instead has a damage bonus and a clip size penalty, resulting in 20 base damage and a clip size of 6. More importantly though, the {{code|"can headshot"}} attribute has given it the ability to deal crits on headshot. Pretty cool, eh?
Now, the Custom Pistol instead has a damage bonus and a clip size penalty, resulting in 20 base damage and a clip size of 6. More importantly though, the {{code|"can headshot"}} attribute has given it the ability to deal crits on headshot. Pretty cool, eh?
Line 136: Line 146:
Remember the {{code|preset=3|"attributes"}} parameter explained [[Creating custom weapons#Setting up the custom item schema|here]]? Well, it's time to put it to good use!
Remember the {{code|preset=3|"attributes"}} parameter explained [[Creating custom weapons#Setting up the custom item schema|here]]? Well, it's time to put it to good use!


[[File:example_08_headshotvisible.png]]
<pre>
 
[[File:example_08_headshotvisible.png]] TEMPTEXT
</pre>


In your {{code|preset=3|"attributes"}} parameter (the one with the same indentation as {{code|preset=3|"items"}} and {{code|preset=3|"prefabs"}} - I know, it's confusing), copy the above attribute. This is a copy of the {{code|"can headshot"}} attribute that's been simplified for this tutorial.
In your {{code|preset=3|"attributes"}} parameter (the one with the same indentation as {{code|preset=3|"items"}} and {{code|preset=3|"prefabs"}} - I know, it's confusing), copy the above attribute. This is a copy of the {{code|"can headshot"}} attribute that's been simplified for this tutorial.
Line 154: Line 165:
The first problem is the position of the attribute in the description. In order from top to bottom, item descriptions should always list neutral (white) stats first, then positive (blue) stats, and finally negative (red) stats, with informational text like "This weapon will reload when not active" and "Can be defused by the Wrench" being positioned at the very end.
The first problem is the position of the attribute in the description. In order from top to bottom, item descriptions should always list neutral (white) stats first, then positive (blue) stats, and finally negative (red) stats, with informational text like "This weapon will reload when not active" and "Can be defused by the Wrench" being positioned at the very end.


[[File:example_09_headshottop.png]]
<pre>
 
[[File:example_09_headshottop.png]] TEMPTEXT
</pre>


By moving the {{code|"can headshot VISIBLE"}} attribute to the top, it also moves it to the top of the item's description.
By moving the {{code|"can headshot VISIBLE"}} attribute to the top, it also moves it to the top of the item's description.
Line 164: Line 176:
The second problem is the text colour. Crits on headshot is undeniably an upside, so it should be coloured blue to reflect that.
The second problem is the text colour. Crits on headshot is undeniably an upside, so it should be coloured blue to reflect that.


<pre>
[[File:example_10_headshotblue.png]]
[[File:example_10_headshotblue.png]]
 
</pre>


By adding {{code|"effect_type" "positive"}} to the {{code|"can headshot VISIBLE"}} attribute, we can set the colour to the same blue as other positive attributes. If you want an attribute to be displayed as negative, simply replace {{code|"positive"}} with {{code|"negative"}}. The same goes for neutral attributes - replace {{code|"positive"}} with {{code|"neutral"}}.
By adding {{code|"effect_type" "positive"}} to the {{code|"can headshot VISIBLE"}} attribute, we can set the colour to the same blue as other positive attributes. If you want an attribute to be displayed as negative, simply replace {{code|"positive"}} with {{code|"negative"}}. The same goes for neutral attributes - replace {{code|"positive"}} with {{code|"neutral"}}.
Line 177: Line 190:
What's that? You want to change the model too? Well, with the base selection of models in Classified, there's only one that works with {{code|preset=3|"attach_to_hands" "2"}} - the Pistol model that we're currently using. However, what about TF2's c_models?
What's that? You want to change the model too? Well, with the base selection of models in Classified, there's only one that works with {{code|preset=3|"attach_to_hands" "2"}} - the Pistol model that we're currently using. However, what about TF2's c_models?


[[File:example_05_wingermodel.png]]
<pre>
 
[[File:example_05_wingermodel.png]] TEMPTEXT
</pre>


Here, the parameters have been adjusted for c_model animations. With {{code|preset=3|"attach_to_hands"}} set to 1, the Custom Pistol will use the secondary animations from the class' c_arms - in this case, the Scout's pistol animations. This allows for pistol c_models like the [[tf:Winger|Winger]]'s to be used without visual bugs.
Here, the parameters have been adjusted for c_model animations. With {{code|preset=3|"attach_to_hands"}} set to 1, the Custom Pistol will use the secondary animations from the class' c_arms - in this case, the Scout's pistol animations. This allows for pistol c_models like the [[tf:Winger|Winger]]'s to be used without visual bugs.
Line 192: Line 206:
The answer lies with the {{code|preset=3|"model_player_per_class"}} parameter.
The answer lies with the {{code|preset=3|"model_player_per_class"}} parameter.


[[File:example_06_modelperclass.png]]
<pre>
[[File:example_06_modelperclass.png]] TEMPTEXT
</pre>


By adding this to the first version of the Custom Pistol, you can change the v_model used by each class, allowing you to have the weapon on both Scout and Engineer without making them share animations.
By adding this to the first version of the Custom Pistol, you can change the v_model used by each class, allowing you to have the weapon on both Scout and Engineer without making them share animations.