Pick up the crowbar of research scientist Gordon Freeman, who finds himself on an alien-infested Earth being picked to the bone, its resources depleted, its populace dwindling. Freeman is thrust into the unenviable role of rescuing the world from the wrong he unleashed back at Black Mesa. And a lot of people, people he cares about, are counting on him.

Post tutorial Report RSS How to make a client side infinite ammo alyxgun

This teaches u how to make the weapon_alyxgun heve infinite ammunition. However, this doesn't work on other weapons. I used the pistol model for it.

Posted by on - Intermediate Client Side Coding

Requirements:
1. notepad/notepad++
2. Half-Life 2/HL2 Mods
3. A test map


First off open up weapon_alyxgun in scripts. Then type the following

// Alyx Gun

WeaponData
{
	// Weapon data is loaded by both the Game and Client DLLs.
	"printname"	"SEMIAUTOMATIC PISTOL"
	//"viewmodel"				"models/weapons/W_Alyx_Gun.mdl"
	"viewmodel"				"models/weapons/v_pistol.mdl"
	"playermodel"			"models/weapons/W_Alyx_Gun.mdl"	//FIXME: 
	"anim_prefix"			"alyxgun"
	"bucket"				"6"
	"bucket_position"		"4"

	"clip_size"				"-1"
	"clip2_size"			"-1"

	"default_clip"			"1"
	"default_clip2"			"-1"

	"primary_ammo"			"AlyxGun"

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

	// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
	SoundData
	{

		"reload"		"Weapon_Pistol.Reload"
		"reload_npc"	"Weapon_Pistol.NPC_Reload"
		"empty"			"Weapon_Pistol.Empty"
		"single_shot"	"Weapon_Pistol.Single"
		"single_shot_npc"	"Weapon_Pistol.NPC_Single"
		"special1"		"Weapon_Pistol.Special1"
		"special2"		"Weapon_Pistol.Special2"
		"burst"			"Weapon_Pistol.Burst"
	}

	// Weapon Sprite data is loaded by the Client DLL.
	TextureData
	{
		"ammo"
		{
				"file"		"sprites/w_icons1b"
				"x"			"128"
				"y"			"0"
				"width"		"128"
				"height"	"64"
		}
		"weapon_s"
		{	
				"file"		"sprites/w_icons1b"
				"x"			"128"
				"y"			"0"
				"width"		"128"
				"height"	"64"
		}
		"ammo"
		{
				"font"		"WeaponIcons"
				"character"	"p"
		}
		"crosshair"
		{
				"font"		"Crosshairs"
				"character"	"Q"
		}
		"autoaim"
		{
				"file"		"sprites/crosshairs"
				"x"			"0"
				"y"			"48"
				"width"		"24"
				"height"	"24"
		}
	}
}

After that, save the file and test it in-game. Although ahe ammo part says 1 ammo, it actually has infinite. Have fun!


Source:
Missing Information 1.6
Map: mi_buildingblocks.bsp
Script: weapon_alyxgun
Thanks to:
MI Dev group
Valve

Post comment Comments
Jike
Jike - - 177 comments

wow, so much for learning by copy-paste...

Reply Good karma Bad karma+1 vote
Wheatley  Author
Wheatley  - - 44 comments

I Changed it a little. After reading the info, I found out it's actually a glitch/bug/error.

Reply Good karma+1 vote
ChilliusVGM
ChilliusVGM - - 329 comments

or in GMOD use givecurrentammo lol it gives you 9999 ammo!

Reply Good karma Bad karma+2 votes
Boomsicle
Boomsicle - - 58 comments

Doesn't work for other weapons? Are you sure?

Reply Good karma Bad karma+1 vote
Guest
Guest - - 690,491 comments

This comment is currently awaiting admin approval, join now to view.

Guest
Guest - - 690,491 comments

This comment is currently awaiting admin approval, join now to view.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: