Replacing the Crowbar with the Stunstick: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Broke down. Previous one is ridulous)
Line 1: Line 1:
This is a very simple tutorial explaining how to replace the crowbar with a stunstick in your single player Half Life 2 mod. The stunstick model exists in HL2 deathmatch, so we are just going to get the textures and model from there and place them in our mod.
Switching the crowbar to use the stunbaton is as simple as opening your scripts/weapon_crowbar.txt. Inside, find these 2 lines:
{{note|This won't replicate the glow effect, but will only put the model in the game.}}
<pre>
"viewmodel" "models/weapons/v_crossbow.mdl"
"playermodel" "models/weapons/w_crossbow.mdl"
</pre>
And change to:
<pre>
"viewmodel" "models/weapons/v_stunbaton.mdl"
"playermodel" "models/weapons/w_stunbaton.mdl"
</pre>
{{note|this will not get you the glow effect, but only the model.}}


===Extracting the model files===
* Create the following directories in your single player mod:
''The stunstick's skin will go here:''
:<code>Steam\SteamApps\SourceMods\YOURMOD\materials\models\weapons\v_stunstick</code>
''The model will go here:''
:<code>Steam\SteamApps\SourceMods\YOURMOD\models\Weapons</code>
* Using [[GCFScape]], open the <code>Steam\Steamapps\half-life 2 deathmatch.gcf</code>.
* Navigate to <code>root\hl2mp\materials\models\weapons\v_stunstick</code> and copy all the files in this directory to the equivalent directory in your mod.
* Then navigate to <code>root\hl2mp\models\Weapons</code> and copy the following files to the <code>Weapons</code> directory in your mod:
:<code>v_stunstick.dx80.vtx</code>
:<code>v_stunstick.dx90.vtx</code>
:<code>v_stunstick.mdl</code>
:<code>v_stunstick.sw.vtx</code>
:<code>v_stunstick.vvd</code>
===Replacing the Crowbar In-game===
* Finally, to actually use this model we need to tell our mod that the stun stick is actually a crowbar.<br/>Rename <code>Steam\SteamApps\SourceMods\YOURMOD\scripts\weapon_stunstick.txt</code> to <code>weapon_crowbar.txt</code> (you might want to back up the original first).
* Now, to make it occupy the same slot in the weapons list open the new <code>weapon_crowbar.txt</code> file and change the <code>"bucket_positon"</code> to 0 instead of 3.
===See it in action===
* Create a new map and drop a <code>weapon_crowbar</code> item in it along with a bunch of crates to smash...
* Run your new map and pick up the stunstick, use it just like you would a regular crowbar.
* Enjoy.


[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 14:49, 16 January 2009

Switching the crowbar to use the stunbaton is as simple as opening your scripts/weapon_crowbar.txt. Inside, find these 2 lines:

	"viewmodel"	"models/weapons/v_crossbow.mdl"
	"playermodel"	"models/weapons/w_crossbow.mdl"

And change to:

	"viewmodel"	"models/weapons/v_stunbaton.mdl"
	"playermodel"	"models/weapons/w_stunbaton.mdl"
Note.pngNote:this will not get you the glow effect, but only the model.