• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

PC If magazine capacity exceeds 255, reduced ammo when changing weapon

Status
Not open for further replies.

duk6046

Grizzled Veteran
Jul 15, 2009
144
8
Category: Code

Reproducibility: Always

Summary: If a magazine capacity exceeds 255, ammo disappear when swap weapons. (ex: Minigun)

Description: Still not solved issue. this is probably the last report.

These two codes are suspicious byte NewAmmoCount and byte NewSecondaryAmmoCount in KFWeapon.uc

reliable client function ClientForceAmmoUpdate(byte NewAmmoCount, int NewSpareAmmoCount, optional bool bAmmoSync)
{
if ( Role < ROLE_Authority )
{
if ( bAmmoSync )
{
// detect sync errors
`log(self@GetFuncName()@"ServerAmmo Primary:"$NewAmmoCount@"ClientAmmo Primary:"$AmmoCount[0]@"ServerSpareAmmo Primary:"$NewSpareAmmoCount@"ClientSpareAmmo Primary:"$SpareAmmoCount[0], bDebug);
if ( NewAmmoCount != AmmoCount[0] )
{
`log(self@GetFuncName()@"Primary Ammo mismatch Server:"$NewAmmoCount@"Client:"$AmmoCount[0]);
}
if ( NewSpareAmmoCount != SpareAmmoCount[0] )
{
`log(self@GetFuncName()@"Primary SpareAmmo mismatch Server:"$NewSpareAmmoCount@"Client:"$SpareAmmoCount[0]);
}

AmmoCount[0] = Min(NewAmmoCount, AmmoCount[0]);
SpareAmmoCount[0] = Min(NewSpareAmmoCount, SpareAmmoCount[0]);
}
else
{
AmmoCount[0] = NewAmmoCount;
SpareAmmoCount[0] = NewSpareAmmoCount;
}
NotifyHUDofWeapon(Pawn(Owner));
}
}

/** Force client to match server secondary ammo counts */
reliable client function ClientForceSecondaryAmmoUpdate(byte NewSecondaryAmmoCount)
{
if ( Role < ROLE_Authority )
{
// detect sync errors
`log(self@GetFuncName()@"ServerAmmo Secondary:"$NewSecondaryAmmoCount@"ClientAmmo Secondary:"$AmmoCount[1], bDebug);
if ( NewSecondaryAmmoCount != AmmoCount[1] )
{
`log(self@GetFuncName()@"Secondary Ammo mismatch Server:"$NewSecondaryAmmoCount@"Client:"$AmmoCount[1]);
}
AmmoCount[1] = NewSecondaryAmmoCount;
NotifyHUDofWeapon(Pawn(Owner));
}
}
 
Last edited:
I personally experienced that with HMTech-401 and SCAR on commando. They definitely exceed 255, can't say for minigun, as it's a DLC.
@Kittenmittens as he said, the minigun can never exceed 225. The weapons you specifically mentioned cannot exceed 255, but if you are using mods that will increase the capacity of the magazine, such as RPG, then it will pass.
 
Upvote 0
This does not look like an issue that affects normal gameplay. In normal gameplay the minigun on commando gets up to 225 ammo at once which does not break the limit.
I don't think developer doesn't know this. but why did other values change to int from byte in the past? and didn't you officially announce that KF2 is a game that supports mode? If it's for prevent hack, I agree.
 
Last edited:
Upvote 0
Here's a video demonstrating the problem. TWI ate 2 rounds from FN FAL on second 8 right in front of our eyes. This probably happens with weapons that have ammo capacity <255, unlike what OP says.

This definitely affects normal gameplay. Moreover, this happens in EVERY game I play as a sharpshooter or commando.

This is different than what the bug is for this thread. It's helpful to make a new thread for different bugs. This helps with visiblity, tracking, and gathering input from players for the same bug OP reports. :) I will pass this along. Can you confirm that you are not using any mods or modifications to vanilla gameplay? Is this happening on solo or online or both?
Edit : Just read the description on the video. It is not vanilla gameplay. We expect issues when spawn cycles and such are adjusted. The game is set up with certain limits because of performance issues and bugs that happen as results from pushing them. Unfortunately, this gameplay is not really supported. As I previously said, QA tests vanilla gameplay.
 
Upvote 0
Status
Not open for further replies.