How can I modify player damage?
Posted: Mon Mar 18, 2019 10:12 am
I want to provide a non-technological bonus to player damage in my mod. Something like a 10%, 20%, ... 100% scaling increase to the player's manually fired weapons (shotguns, pistol, semi-machine gun, flamethrower, rockets, melee punching). This bonus should exclude "passive" (player doesn't press a button) damage effects like turrets, landmines, PLDs, etc. I'm indifferent on vehicle damage and grenades. This bonus is also per-player and not shared amongst the team.
There's a few approaches I've seen that I could attempt, but I'm wondering if there's an easier way:
One option seems to be create a variant of every type of weapon and bullet that deals slightly more damage and have the mod silently 'upgrade' all existing weaponry when the bonus is applied, but if I need a variant for everything that's a lot of prototype variants.
Another option would be to hook into the on_entity_damaged event and amplify damage from players there, but this isn't ideal either because this event fires after damage reduction has been calculated. So I'd need to undo the damage dealt, recalculate damage reduction with my bonus, and apply the new damage.
A third option might be create a non-researchable invisible tech similar to the military bonus techs and award that to the player, but I think this would violate the "bonuses aren't shared across the team" constraint if players are playing together.
Are there other options I'm overlooking?
There's a few approaches I've seen that I could attempt, but I'm wondering if there's an easier way:
One option seems to be create a variant of every type of weapon and bullet that deals slightly more damage and have the mod silently 'upgrade' all existing weaponry when the bonus is applied, but if I need a variant for everything that's a lot of prototype variants.
Another option would be to hook into the on_entity_damaged event and amplify damage from players there, but this isn't ideal either because this event fires after damage reduction has been calculated. So I'd need to undo the damage dealt, recalculate damage reduction with my bonus, and apply the new damage.
A third option might be create a non-researchable invisible tech similar to the military bonus techs and award that to the player, but I think this would violate the "bonuses aren't shared across the team" constraint if players are playing together.
Are there other options I'm overlooking?