Raised This Month: $51 Target: $400
 12% 

HP damage sound bug fix


Post New Thread Reply   
 
Thread Tools Display Modes
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-25-2012 , 14:57   Re: HP damage sound bug fix
Reply With Quote #11

Quote:
Originally Posted by echo_cs View Post
By By alliedmods I will Return One day

My Real age is 13

And I learned Pawn & C++ And Im Arabic And I have stady English 3 hear only
You really need to calm down.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 02-25-2012 , 15:05   Re: HP damage sound bug fix
Reply With Quote #12

echo_cs is just a kid.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-25-2012 , 18:32   Re: HP damage sound bug fix
Reply With Quote #13

That's not really a bug and there is nothing wrong with the sound.

This damage is specific when you fall and you do damage between 0.0 and 1.0.
The fall damage is calculated like that :

pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED; // 500
Fall Damage= pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;


with constants like :

#define PLAYER_FATAL_FALL_SPEED 980
#define PLAYER_MAX_SAFE_FALL_SPEED 500
#define DAMAGE_FOR_FALL_SPEED 100 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED )


Therefore you will get a real float value, like 0.598252.

You get pain because you have damage > 0.

And you don't get damage because when CBaseMonster::TakeDamage (where damage is applied) is called after, the damage is cast into an integer in the header.

@OT, I'm not sure this bug would appear with weapon, if so, you don't take in count the weapons ratio, but considering weapon damage starts from a hardcoding base value, I don't think it will happen after be passed into TraceAttack and TakeDamage.
__________________

Last edited by Arkshine; 02-25-2012 at 19:08.
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-26-2012 , 03:12   Re: HP damage sound bug fix
Reply With Quote #14

@Arkshine, It can appear, because I remember something like shooting a player with Glock pistol at a big distance and hitting him causing small damage.

I don't understand what you mean by hardcoding base value and by the weapon ratio.
Are you saying that there are other constants that are used to multiply the damage when TakeDamage function is called?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2012 , 05:24   Re: HP damage sound bug fix
Reply With Quote #15

All the default weapon have a default value, for example, for ak47 is 36.

When you fire, the default damage is modified in 3 functions : CBaseEntity::FireBullets3() -> CBasePlayer::TraceAttack() -> CBasePlayer::TakeDamage()

In CBaseEntity::FireBullets3(), damage is altered considering the current distance, the range modifier (0.98 for ak47) and the damage modifier by texture hit. You can see better in an old attempt to decompile the function here (not complete but give you an idea) : http://pastebin.com/BUkhnfm2

Then CBasePlayer::TraceAttack() is called. Damage is again altered depending the hitgroup. What you have done. The function can be found here : https://forums.alliedmods.net/showpo...19&postcount=6.

And the end, CBasePlayer::TakeDamage(), damage altered depending the weapon used. You can see better with this attempt to decompile the function (far from be complete, like 55% but give you again an idea) : http://pastebin.com/tcqjiwj2

So, you will need more code to get the real damage.
__________________
Arkshine is offline
FR0NTLINE
AlliedModders Donor
Join Date: Apr 2006
Location: Riverside Cali
Old 05-17-2012 , 10:18   Re: HP damage sound bug fix
Reply With Quote #16

echo cs is 13 and learning how to make plugins SWEET!!!! Future Plugin Makers in the Making I love it!
__________________
FR0NTLINE is offline
Send a message via AIM to FR0NTLINE Send a message via MSN to FR0NTLINE Send a message via Yahoo to FR0NTLINE
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 02:14.


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