[L4D] How accurately calculate tank damage with SDKHook?
Hi,
I want to get damage deal to tank by player (solo) using SDKHook method. Let's say tank hp is exactly 1000: Code:
sm_cvar z_tank_health 1000 PHP Code:
With OnTakeDamageAlive (+ incap filter), total damage solo == 990 ± 6. How to get exactly 1000 ? Thanks. - PS. Just if somebody don't know, before tank die, incap animation is played, and tank still receiving damage, that's why incap filter is required. |
Re: [L4D] How accurately calculate tank damage with SDKHook?
Try checking if "damage > tank health" in the "last hit" then subtract.
|
Re: [L4D] How accurately calculate tank damage with SDKHook?
Use the player_hurt event may give better results.
Or You can patch out the CTerrorPlayer::OnIncapacitatedAsTank in CTerrorPlayer::AllowDamage and let the tank just die :P |
Re: [L4D] How accurately calculate tank damage with SDKHook?
Thank you, Lux.
Quote:
PHP Code:
Quote:
Quote:
In incap state tank still receiving a lot of "1.0" damage. Last damage value == 5000.0 So, if I remove incap filter, total damage will be like > 7.000 (with the start tank hp == 1000.0). |
Re: [L4D] How accurately calculate tank damage with SDKHook?
---
|
Re: [L4D] How accurately calculate tank damage with SDKHook?
Marttt, nice, I undertood what you suggested.
I did some tests, and now I know how it works. When you do the last shoot (before incap), the damage is > than tank hp elapsed. This is where incap event is fired, but OnTankDamage (or "player_hurt") are not called before incap. It is called after incap. And even more, the damage is passed as full, which is > tank hp elapsed at the last moment of its life. Also, when OnTakeDamage is fired, the float damage is rounding to zero (even if value is 0.9), and those value is get written to "m_iHealth" prop of tank's entity. With the proper calculations we are receiving the correct final value, using SDKHook_OnTakeDamage: PHP Code:
Quote:
|
Re: [L4D] How accurately calculate tank damage with SDKHook?
Just as a final, for somebody else.
SDKHook version: PHP Code:
PHP Code:
|
Re: [L4D] How accurately calculate tank damage with SDKHook?
The SDKHook version should return Plugin_Changed when the damage gets modified so it would also reflect on the scoreboard when transitioning between maps.
|
Re: [L4D] How accurately calculate tank damage with SDKHook?
cravenge, sorry, I don't understand the relationship to my topic. I don't change damage, only measure.
|
Re: [L4D] How accurately calculate tank damage with SDKHook?
Quote:
|
All times are GMT -4. The time now is 13:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.