Damage Absorption
I'm trying to manipulate the damage absorption towards the armor. I'm going to base it around how Natural Selection Armor system works. (Here's the site about the Armor System in NS http://www.unknownworlds.com/ns/stat...rmorSystem.htm)
I'm going for a 70% damage absorption with a 50% damage negation. This is my code so far... PHP Code:
|
Re: Damage Absorption
Are you asking a question or are you just showing the code?
Code:
|
Re: Damage Absorption
Asking a question and for some help...
That code is just how far I've gotten. It's not manipulating the damage how I want to. Say.... I do 75 damage on a player with 100hp and 100ap. It should calculate 70% of the damage (75*0.7 = 52.5). This is the damage absorbed. The remaining 30% of the damage (75*0.3 = 22.5) should minus the players hp. (100 - 22.5 = 77.5) With the damage absorbed values, it should half it (52.5 / 2 = 26.25) and deduct it from the player's armor. (100 - 26.26 = 73.75) If player A with 100hp and 100ap gets damaged by 75. Player A should be left with 77.5hp and 73.75ap. (I know the Engine will round the values in the end so I don't bother with it within the code) |
Re: Damage Absorption
I think the easiest way is to determine the damage/reduction values for health and armor (based on a % of damage passed to TakeDamage) and set the users health/armor accordingly and then return HAM_SUPERCEDE so the actual damage passed in HamTakeDamage does not affect the player. The damage passed to TakeDamage, as you probably already know, is total damage without factoring armor so altering the value (SetHamParamFloat()) doesn't give you any control over how it is distributed by the engine (inflicted to hp or armor).
Something like this, untested. PHP Code:
|
Re: Damage Absorption
Thanks Bugsy!
Exactly what I was trying to do! Was quickly testing yours and noticed that when you are hit, players don't spill blood or slow down so I just moved some things around and added a few things. The only downside to this is when you are using a 3rd party plugin which displays the damage dealt to the victim. It doesn't display anything until the last hit where the victim drops dead. Anyway around this if that is possible? PHP Code:
|
Re: Damage Absorption
Quote:
If you are concerned with that we will also need to correct the damage value displayed since we are modifying the issued damage. Setting the damage amount to pev_dmg_take in TakeDamage-post will alter what amx_super displays as damage; it will work in TakeDamage pre as well but the value is not always accurate. I can't guarantee it will work for all damage-display plugins but you can experiment. PHP Code:
|
Re: Damage Absorption
Mm... Works for what I use on my server.
Just one quick question before I'm (hopefully) done with this. I've never used pev_dmg_take and nor have I seen it been used. Can you kindly explain to me whats it purposes are? Thanks again, Bugsy! |
| All times are GMT -4. The time now is 05:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.