Difference between revisions of "Changing max ammo in HL2"
(Appended failsafe instructions; took me at least an hour to figure it out -_-.) |
m (Made 30 bold) |
||
Line 10: | Line 10: | ||
Example <code>AddAmmoType()</code> from Half-Life 2: Deathmatch code (shotgun): | Example <code>AddAmmoType()</code> from Half-Life 2: Deathmatch code (shotgun): | ||
− | def.AddAmmoType("Buckshot", DMG_BULLET | DMG_BUCKSHOT, TRACER_LINE, 0, 0, 30, BULLET_IMPULSE(400, 1200), 0 ); | + | def.AddAmmoType("Buckshot", DMG_BULLET | DMG_BUCKSHOT, TRACER_LINE, 0, 0, '''30''', BULLET_IMPULSE(400, 1200), 0 ); |
^^ Change the 30. | ^^ Change the 30. | ||
Though the actual line has lots of tabs in it (to align it neatly with the other <code>AddAmmoType()</code>s and their parameters). | Though the actual line has lots of tabs in it (to align it neatly with the other <code>AddAmmoType()</code>s and their parameters). | ||
[[Category:Programming]] | [[Category:Programming]] |
Revision as of 05:09, 28 May 2007
Many people that make a total conversion mod will want to change the maximum ammunition settings in Half-Life 2. This small tutorial will tell you just how to do that.
- Using GCFScape, open the GCF file called source engine.gcf.
- In this file, browse to
Root/hl2/cfg/
and extract the file called skill.cfg. - Place the extracted file in
Steam/Steamapps/Sourcemods/yourmodname/cfg/
. - In this file, go down to the Weapons part, and edit the lines starting with
sk_max_*
, where*
is the name of the weapon (such as pistol, 357, ar2, etc).
If you follow those steps and they do not work, follow these as well:
- In hl2mp_gamerules.cpp (or equivalent), in the function
*GetAmmoDef()
, find theAddAmmoType()
function for the ammo you want to change, and change the sixth parameter.
Example AddAmmoType()
from Half-Life 2: Deathmatch code (shotgun):
def.AddAmmoType("Buckshot", DMG_BULLET | DMG_BUCKSHOT, TRACER_LINE, 0, 0, 30, BULLET_IMPULSE(400, 1200), 0 ); ^^ Change the 30.
Though the actual line has lots of tabs in it (to align it neatly with the other AddAmmoType()
s and their parameters).