Adding Empty Reload Animations: Difference between revisions
(Created page with "== Adding empty reloads == Adding empty reloads to all weapons is super easy all you have to do is make the following change inside '''''basecombatweapon_shared.cpp''''' on...") |
Thunder4ik (talk | contribs) m (clean up, added orphan, uncategorised, deadend tags) |
||
Line 1: | Line 1: | ||
{{Multiple issues| | |||
{{Dead end|date=January 2024}} | |||
{{Orphan|date=January 2024}} | |||
}} | |||
== Adding empty reloads == | == Adding empty reloads == | ||
Adding empty reloads to all weapons is super easy | Adding empty reloads to all weapons is super easy | ||
all you have to do is make the following change inside '''''basecombatweapon_shared.cpp''''' on Line '''''2070''''' | all you have to do is make the following change inside '''''basecombatweapon_shared.cpp''''' on Line '''''2070''''' | ||
Line 25: | Line 30: | ||
== Limit ACT_VM_RELOAD_EMTPY To Specific Weapons == | == Limit ACT_VM_RELOAD_EMTPY To Specific Weapons == | ||
if you do not want all of your weapons to have ACT_VM_RELOAD_EMTPY animations you can do the following | if you do not want all of your weapons to have ACT_VM_RELOAD_EMTPY animations you can do the following | ||
Inside of '''''weapon_parse.h''''' on Line '''''100''''' | Inside of '''''weapon_parse.h''''' on Line '''''100''''' | ||
Line 158: | Line 163: | ||
and that should be it | and that should be it | ||
{{note|By Default all weapons have the empty reload set to <code>true</code>!}} | {{note|By Default all weapons have the empty reload set to <code>true</code>!}} | ||
{{Uncategorized|date=January 2024}} |
Revision as of 08:40, 21 January 2024




January 2024

You can help by

January 2024
Adding empty reloads
Adding empty reloads to all weapons is super easy
all you have to do is make the following change inside basecombatweapon_shared.cpp on Line 2070
replace the following line
bool CBaseCombatWeapon::Reload( void )
{
return DefaultReload( GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD );
}
With The Following
bool CBaseCombatWeapon::Reload( void )
{
return DefaultReload( GetMaxClip1(), GetMaxClip2(), Clip1() == 0 ? ACT_VM_RELOAD_EMPTY : ACT_VM_RELOAD );
}
This will give you the ability to call ACT_VM_RELOAD_EMPTY animations on you weapons
Limit ACT_VM_RELOAD_EMTPY To Specific Weapons
if you do not want all of your weapons to have ACT_VM_RELOAD_EMTPY animations you can do the following
Inside of weapon_parse.h on Line 100
you will see the following line
weapon_parse.h
char szAmmo2[MAX_WEAPON_AMMO_NAME]; // "secondary" ammo type
UNDERNEATH THAT LINE ADD THE FOLLOWING
bool bEmptyReload; // Empty Reload
Now go to weapon_parse.cpp
Inside of the FileWeaponInfo_t::FileWeaponInfo_t() Constructor add the following bool and set it to true
bEmptyReload = true
And inside the void FileWeaponInfo_t::Parse( KeyValues *pKeyValuesData, const char *szWeaponName ) Function
add the following to the top of the function
weapon_parse.cpp
bEmptyReload = pKeyValuesData->GetBool("emtpy_reload", true);
now go back to basecombatweapon_shared.cpp
and replace the Reload function with this
bool CBaseCombatWeapon::Reload( void )
{
if (GetWpnData().bEmptyReload == false)
{
return DefaultReload(GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD);
}
else
{
return DefaultReload(GetMaxClip1(), GetMaxClip2(), Clip1() == 0 ? ACT_VM_RELOAD_EMPTY : ACT_VM_RELOAD);
}
}
now you can specify what weapon has or doesn't have the empty reload animation
example weapon.txt file
// Pistol
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"printname" "#HL2_Pistol"
"viewmodel" "models/weapons/v_pistol.mdl"
"playermodel" "models/weapons/w_pistol.mdl"
"anim_prefix" "pistol"
"bucket" "1"
"bucket_position" "0"
"clip_size" "18"
"primary_ammo" "Pistol"
"secondary_ammo" "None"
"weight" "2"
"item_flags" "0"
"damage" "8"
// 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
{
"weapon"
{
"font" "WeaponIcons"
"character" "d"
}
"weapon_s"
{
"font" "WeaponIconsSelected"
"character" "d"
}
"ammo"
{
"font" "WeaponIcons"
"character" "p"
}
"crosshair"
{
"font" "Crosshairs"
"character" "Q"
}
"autoaim"
{
"file" "sprites/crosshairs"
"x" "0"
"y" "48"
"width" "24"
"height" "24"
}
}
}
add the following line to the top of the file to turn off the empty reload for the weapon
"emtpy_reload" "0"
and that should be it

true
!


January 2024