• 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 [v1080 Beta] Custom weapons no longer give dosh on zed kills

Insert Name Here

Grizzled Veteran
Oct 3, 2015
205
57
Category: Code

Reproducibility: Always

Summary: In the beta, mod weapons no longer give dosh on zed kills.

Description: This is caused by a new validation function added to KFGame.KFPawn in the beta, ValidateDamageForDamageHistory(). In the function above it, UpdateDamageHistory() (about lines 2807-2868, v1080 SDK), it uses this function (about line 2816) before adding the given damage to the zed's damage history. This damage history is used to distribute XP and dosh upon the zed's death in KFGame.KFGameInfo function DistributeMoneyAndXP() (about line 2410).

When using a custom weapon, however, it fails this validation check, causing the damage to not be added and thus not giving out XP or dosh to the player using this weapon. This is likely intentional for the XP side to prevent leveling exploits (though see P.S. below), but unintentional for the dosh side.

It is likely that, in order to fix this, this function will have to be moved to KFGameInfo.DistributeMoneyAndXP() as a final validator for giving out XP for a damage type, as the XP check is done after the dosh rewards.

Online/Offline: Both

P.S. For the XP side of this, make sure that any XP that would have been given is still routed through KFGame.KFPlayerController function OnPlayerXPAdded(). This is a mod notification function, and is necessary for some mods (e.g. ServerExt) to function properly. This might require KFGameInfo.AddPlayerXP() to do the validations itself.
 
Freebase;n2332700 said:
Issue still wasn't fixed in the official update

Correct. AFAIK this is in the system, but Yoshiro stated that the desired fix was too risky to implement for v1081 (what exactly that means, I don't know). I am working on some suggested SDK fixes to ensure that the validation works properly while still ensuring mod support for both custom zeds and weapons.

For now though, I have a workaround for zeds not giving dosh for custom weapons:

This can be done for both game modes and mutators. For custom KFGameInfo's (e.g. Zedternal, Classic Mode), the relevant function is ReduceDamage(). For custom KFMutator's (e.g. weapon packs, Unofficial Mod) it's NetDamage(). The below code uses NetDamage() because I'm using it for Unofficial Mod. Note that this also fixes zed aggro-switching with custom weapons.

Spoiler!

The contents of the IsFromModWeapon() function will vary depending on whether your mod weapons use custom KFDamageType's. Most weapon pack mods should, but mods that simply override vanilla weapons (e.g. Zedternal, Classic Mode, Unofficial Mod) will have to use more roundabout methods.

For weapons with custom damage types (replace MyPackage with your mod's package name but keep the single quotes):

Spoiler!

For weapons with vanilla damage types (note that this won't work if both the vanilla weapon and your mod weapon are in the Trader list):

Spoiler!

For the latter version, this can be very expensive to check the Trader list for each damage event, so using a mod-specific method of checking if the damage came from a mod weapon is preferred.
 
Upvote 0
So it's still not officialy fixed right? Because it's the bug that i recently noticed on my own, and i asked few modders, and they confirmed this. This is the only thread about this issue, but i'm not a modder, and i dont understand how to implement this fixes into my server. Can you guys explain how to fix this bug? If it possible to. I can edit my custom weapons if needed.
 
Upvote 0