View Single Post
Scag
AlliedModders Donor
Join Date: May 2017
Location: Crashing Hale
Old 01-02-2020 , 16:56   Re: [TF2] Make every weapon headshot
Reply With Quote #4

If you glanced at the link I posted you would be able to see that Valve code would have done all of the heavy lifting for you.

Even if you aren't that adept at reading C++ code, you can decipher that:
  • It's a TraceAttack function
  • CanFireCriticalShot is only fired if both the hitgroup == 1 (HITGROUP_HEAD) and damagetype & DMG_USE_HITLOCATIONS
  • If all of that stuff is true, it would both add the DMG_CRIT to the damagetype and set the custom to TF_CUSTOM_HEADSHOT

So in the end, you will need to use a TraceAttack hook and set the update the damagetype as you have it already.
__________________
Over-engineering is underrated.

GitHub
BTC
ETH

Retired
Scag is offline