ScalePlayerDamage and bullet.Callback Problems/Bugs

ScalePlayerDamage
After some vigorous testing and some googling on the matter I have found that ScalePlayerDamage is changing the damage a player takes to a number different to what it is supposed to be changing it to.

Have some debug prints of when I bodyshot somebody with the HL2 pistol in sandbox (edited to be more readable)


ScalePlayerDamage DamageAmount 12 EndAmount 12
ScalePlayerDamage DamageAmount 12 EndAmount 12
EntityTakeDamage DamageAmount 24

It appears to be adding the two damages together to make the final damage of 24

Now when I headshot somebody


ScalePlayerDamage DamageAmount 12 EndAmount 36
ScalePlayerDamage DamageAmount 36 EndAmount 108
EntityTakeDamage DamageAmount 120

120? It was supposed to be 36.
It appears to be taking the EndDamage of the first ScalePlayerDamage and using it for the second. It then appears to be taking the result of the second ScalePlayerDamage and adding the base damage to it to make the final damage.

In summary
DAMAGE = BASEDAMAGE * HITGROUPSCALE ^ 2 + BASEDAMAGE
in sandbox when you headshot somebody this ends up to be
DAMAGE = 10 * BASEDAMAGE
which is incredibly off the intended 3x damage the headshot is normally supposed to do.

bullet.Callback
Today while looking at the wiki I found bullet.CallBack, this appeared to be the perfect function for scaling damage based on distance like in TF2, unfortunately I was wrong.
bullet.Callback cannot modify the DamageInfo table, which is kind of annoying because this would be the best way to do it. I wish for this to be implemented so I can scale damage based on distance in a none hacky, easy way.

Isnt garry using an hook to do the hitgroeps on the player? like headshots
if so, make sure your hook is called first, then return the damage table so it stops executing diffrent hooks!

I think the hook you might be talking about is ScalePlayerDamage, the one I mentioned in my post numerous times. Also I am not hooking into ScalePlayerDamage, I am using the gamemode “hook”.

This problem has been around for 2 years now

If it cannot modify the DamageInfo, why not let it choose if you have to hurt a player?

This has been wrong for as long as I can remember. It took me hours to figure out a fix:

**EDIT: **Apparently I can’t logon to my server to get the code. (At college, source at home) I’ll post it as soon as I can

I’m not quite understanding what your trying to get at commander.
bullet.Callback can disable damage to a player but this still leaves me with the problem of not being able to scale bullet damage based on distance since I want to change the amount of damage not disable damage completely

What I meant was, that instead passing by scaledamage disable damage for that bullet, and calculate it on your own.

How would I then apply the damage? I found that TakeDamage has some unwanted effects and I also can’t specify damage position, hitgroup and type with TakeDamage

**[Entity.TakeDamageInfo

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.TakeDamageInfo)**

I meant something like that.

Cheers commander, any updates on your fix TehBigA?