[TF2] Make every weapon headshot
I'm trying to allow all bullet-based weapons in TF2 to do headshots with the same method that sniper rifles, bows and the revolver hitlocation attribute use. Quite a bit of searching and the source code for CTFSniperRifle::GetDamageType and CTFProjectile_Arrow::GetDamageType lead me to believe that OR-ing in the DMG_USE_HITLOCATIONS damagebit would do the trick but of course I was wrong. The damagetype changed but the game still doesn't use hit location damage.
I simply can't figure out how to get this to work. The bits get modified but the weapon won't headshot. Tested with SMG, Pistol and Minigun. PHP Code:
Yes, I am aware that SDKHook_TraceAttack and the head hitgroup exists, however this comes with its own quirks and I'd rather use TF2's built in hitlocation damage. |
Re: [TF2] Make every weapon headshot
Looking at this it appears you'll need to DHook CTFWeaponBase::CanFireCriticalShot. Including everything you still have under a TraceAttack hook.
|
Re: [TF2] Make every weapon headshot
Quote:
The reason I can't use SDKHook_TraceAttack is that I can't modify the damagecustom attribute, and SDKHook_OnTakeDamage has no information about the hitgroup, meaning I can't differentiate between normal crits and my custom headshot crits. |
Re: [TF2] Make every weapon headshot
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:
So in the end, you will need to use a TraceAttack hook and set the update the damagetype as you have it already. |
Re: [TF2] Make every weapon headshot
HTML Code:
public Action Client_TraceAttack (int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup) This works for me. |
Re: [TF2] Make every weapon headshot
Quote:
|
Re: [TF2] Make every weapon headshot
Actually I'm wrong here, TF_CUSTOM_HEADSHOT isn't a flag for damage, it's a flag for kills.
A working plugin would look something like this: HTML Code:
public void OnPluginStart() |
All times are GMT -4. The time now is 05:00. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.