model directories

  • Thread starter Thread starter rockmanexex
  • Start date Start date
R

rockmanexex

Guest
I want to add a custom weapon model to a custom mod Ive written. I just dont know how to get the game to find the right directory for models. I can get models to show up in hammer but when I dont know how to get the program to find my custom weapon model. If there is a tutorial on this could I also get a link to it?
 
I cant think of a tutorial, but i could give a go explaining what to do.

You want to overwrite a weapon model? you'll need both V (view) and W (world) models. View is what you see on the screen, World is what you find in the levels.

You will then need to put these models in a meaningful directory. Try models/weapons or model/my_weapons, it really doesnt matter.

For your models to then be used instead of the default HL2 ones, you will need to edit the scripts.

Lets say for example you want to replace the crowbar with a knife. You would go to your mods script directory, create the text doctument Weapon_crowbar, open it up and it should look like this:

Code:
// Crowbar

WeaponData
{
	// Weapon data is loaded by both the Game and Client DLLs.
	"printname"	"Crowbar"
	"viewmodel"				"models/weapons/v_crowbar.mdl"
	"playermodel"			"models/weapons/w_crowbar.mdl"
	"anim_prefix"			"crowbar"
	"bucket"				"0"
	"bucket_position"		"0"

	"clip_size"				"-1"
	"primary_ammo"			"None"
	"secondary_ammo"		"None"

	"weight"				"0"
	"item_flags"			"0"

	// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
	SoundData
	{
		"single_shot"		"Weapon_Crowbar.Single"
		"melee_hit"			"Weapon_Crowbar.Melee_Hit"
		"melee_hit_world"	"Weapon_Crowbar.Melee_HitWorld"
	}

	// Weapon Sprite data is loaded by the Client DLL.
	TextureData
	{
		"weapon"
		{
				"font"		"WeaponIcons"
				"character"	"c"
		}
		"weapon_s"
		{	
				"font"		"WeaponIconsSelected"
				"character"	"c"
		}
		"ammo"
		{
				"font"		"WeaponIcons"
				"character"	"c"
		}
		"ammo2"
		{
			"file"		"sprites/640hud7"
			"x"			"48"
			"y"			"72"
			"width"		"24"
			"height"	"24"
		}
		"autoaim"
		{
			"file"		"sprites/crosshairs"
			"x"			"0"
			"y"			"48"
			"width"		"24"
			"height"	"24"
		}
	}
}

These scripts usually control things like how much ammo per clip as well as what model to use.

To put a knife model into the game we would just have to change these lines:

Code:
	"printname"	"My Custom Weapon"
	"viewmodel"				"models/my_weapons/v_knife.mdl"
	"playermodel"			"models/my_weapons/w_knife.mdl"


I hope this has helped, i dont know a thing when it comes to creating entirely new weapons (requires delving into the source code). Have fun!
 
cool! Thanks alot. The crowbar was actually the model I wanted to replace too.
 
glad to help.

Source in-particular is a very confusing platform to model for. The amount of compiling puts off most people.

Tell me if it works out!
 
Back
Top