Raised This Month: $ Target: $400
 0% 

Required Code for Ham_TakeDamage to get proper Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
souvikdas95
Senior Member
Join Date: Mar 2012
Old 07-23-2014 , 14:25   Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #1

Just like in Damage event, I want to use Ham_TakeDamage to get the damage done to the victim. However I have some problem with getting the correct damage. It's something related to offsets as it has been described here : https://forums.alliedmods.net/showpo...8&postcount=71

However, as a function, it's not giving the correct damage. I want to use it instead of Damage event as it's a little quicker than that. As Tested, it's 0.00845 seconds or 8ms faster which is quite a big difference.

So, please if any one could make the function similar to the Damage event function, It would be really grateful
souvikdas95 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-23-2014 , 14:28   Re: Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #2

Well, the fourth parameter of Ham_TakeDamage is the taken damage, but floated. You can use floatround() to get it as an integer, did you try it?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
souvikdas95
Senior Member
Join Date: Mar 2012
Old 07-23-2014 , 14:29   Re: Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #3

yes but it's giving OFF-CHART values than actual inflicted damage
Sometimes, it gives correct damage. Sometimes different damage.
eg. If I damage myself with an HE GRENADE, it gives correct damage... but den some does a HEADSHOT to me, and it gives double the damage...

Last edited by souvikdas95; 07-23-2014 at 14:32.
souvikdas95 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-23-2014 , 14:34   Re: Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #4

Double, you mean like if it is HS with AK (the damage is 140), it shows 280? That's strange...
Well, if so, I guess I will stand next to you, trying to understand how to get most properly the damage taken.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-23-2014 , 15:56   Re: Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #5

To get the real damage done (after calculation armor, weapon power, etc), you need to hook TakeDamage as post, and retrieve value of pev_dmg_take, which is used by Damage event after.

Please search before posting, already asked/answered many times, and stop with your weird request/assumptions each time. :/

Quote:
which is quite a big difference
Quite trivial.
__________________
Arkshine is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 07-23-2014 , 16:17   Re: Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #6

@Arkshine - I searched. But I couldn't find the exact thing. Anyways, so you mean I should get the entity's value of pev_dmg_take inside TakeDamage Post Function and ignore Float:damage parameter?

PHP Code:
    static iDamage;
    
iDamage floatround entity_get_float victimEV_FL_dmg_take ), floatround_floor ); 

Last edited by souvikdas95; 07-23-2014 at 16:32.
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-23-2014 , 17:58   Re: Required Code for Ham_TakeDamage to get proper Damage
Reply With Quote #7

Look at HLSDK, even if not CS code, this is the same kind of code, meaning, a base damage is passed, then, there are modifiers which will reduce (or increase) base damage (armor value, weapon ratio, teamate). After all that, final damage is set in pev_dmg_take.
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode