• ScalePlayerDamage and bullet.Callback Problems/Bugs
    9 replies, posted
[B]ScalePlayerDamage[/B] After some vigorous testing and some googling on the matter I have found that [url=http://wiki.garrysmod.com/?title=Gamemode.ScalePlayerDamage]ScalePlayerDamage[/url] 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) [code]ScalePlayerDamage DamageAmount 12 EndAmount 12 ScalePlayerDamage DamageAmount 12 EndAmount 12 EntityTakeDamage DamageAmount 24[/code] It appears to be adding the two damages together to make the final damage of 24 Now when I headshot somebody [code]ScalePlayerDamage DamageAmount 12 EndAmount 36 ScalePlayerDamage DamageAmount 36 EndAmount 108 EntityTakeDamage DamageAmount 120[/code] 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. [B]bullet.Callback[/B] Today while looking at the wiki I found [b][url=http://wiki.garrysmod.com/?title=Bullet]bullet.CallBack[/url][/b], 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 [url=http://www.facepunch.com/showthread.php?t=525763]2 years now[/url]
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: [b]EDIT: [/b]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
[b][url=http://wiki.garrysmod.com/?title=Entity.TakeDamageInfo]Entity.TakeDamageInfo [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] I meant something like that.
Cheers commander, any updates on your fix TehBigA?
Sorry, you need to Log In to post a reply to this thread.