Magazine style reloads
Hello, this will be a short and extremely simple one! Say you want to make each shot and each reload count? In CS you can reload anytime you feel like. Some bullets will be deducted and that is all. However, in real life, you will not start to load the half-empty mag, you pull out a new one, and throw away the used one. OK you don't throw it away but anyway. This system can be found in BF2, and some other games. So now to the code: Look up the basecombatweapon_shared.cpp and go to the FinishReload procedure. You will mod this part:
if ( UsesClipsForAmmo1() ) { int primary = min( GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); m_iClip1 += primary; pOwner->RemoveAmmo( primary, m_iPrimaryAmmoType); }
to look like this:
if (pOwner) { // If I use primary clips, reload primary if ( UsesClipsForAmmo1() ) { // int primary = min( GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); m_iClip1 = GetMaxClip1(); pOwner->RemoveAmmo( 1, m_iPrimaryAmmoType); }
This tells the game to fully reload the gun and deduct 1 from the iPrimaryAmmoType. From now on, the iPrimaryAmmoType will contain the number of full clips instead of the number of bullets. You will notice, that the game will still grant you 30 or more bullets if you pick up an ammo crate.