• 0
iCORE

[HELP] Absorb Damage Taken Bonus

Question

hi Everyone can you help me make a bonus like this

Absorb 10% HP From Physical Damage Taken

for example i have 100 hp and im being attack with 50 damage and the 10% if the 50 damage will be absorb as HP.

sorry for my bad english hope you can help me, thanks alot 

Edited by iCORE

Share this post


Link to post
Share on other sites

30 answers to this question

  • 0

Posted (edited)

Spoiler

 

then I also repeat again ... I never seen this kind of bonus
not even in Diablo 2
https://diablo.gamepedia.com/Affixes_(Diablo_II)#Damage_Reduction

if you know a game that has this kind of bonus, I like to see a video how its done

 

https://github.com/AnnieRuru/Release/blob/master/plugins/bHPGainRateWhenHit/bHPGainRateWhenHit_0.2.c
- fix this bonus can only use 1 time

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
bonus bNearAtkDef,`n`;            | Adds `n`% damage reduction against melee physical attacks
bonus bLongAtkDef,`n`;            | Adds `n`% damage reduction against ranged physical attacks


7 hours ago, iCORE said:

hi AnnieRuRu can you help me make a bonus like this

Increases AllStats by 30%

for example i have

STR: 100 + 30% = 30
AGI: 200 + 30% = 60 
VIT: 100 + 30% = 30
DEX: 150 + 30% = 45
INT: 100 + 30% = 30
LUK: 100 +30% = 30

i try using this bonus <" bonus bAllStats (readparam(bAllStats) / 30) "> but it only read as every 30 of my status points. 

sorry for my bad english hope you can help me, thanks alot :)

bonus bStr, readparam(bStr) *3/ 10;
....
bonus bLuk, readparam(bLuk) *3/ 10;

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, AnnieRuru said:
bonus bNearAtkDef,`n`;            | Adds `n`% damage reduction against melee physical attacks
bonus bLongAtkDef,`n`;            | Adds `n`% damage reduction against ranged physical attacks

 


bonus bStr, readparam(bStr) *3/ 10;
....
bonus bLuk, readparam(bLuk) *3/ 10;

thanks annie and how about

regain % of damage taken and receive it as hp

Edited by iCORE

Share this post


Link to post
Share on other sites
  • 0

just use reduce damage taken ...

imagine if the player having 199 attack speed, and trigger the hunter fly card effect every time, that effect kinda spammy

Share this post


Link to post
Share on other sites
  • 0

Posted (edited)

hmm, what i want to ask is how to make a script for damage taken, like when the attacker has 100 damage the receiver will gain the percent of that damage.

Edited by iCORE

Share this post


Link to post
Share on other sites
  • 0

is there some kind of game ... that use this description ?

don't really understand whats the difference in reduce damage taken and absorb damage taken ...
if absorb 10% damage taken, that would equal to reduce 20% taken isn't it ?

btw sorry earlier, it seems bonus bNearAtkDef,`n`; reduce damage taken in value, not percentage

if you couldn't find the bonus you want ...
https://github.com/HerculesWS/Hercules/blob/stable/doc/item_bonus.md
then its probably not there

Share this post


Link to post
Share on other sites
  • 0

I think what he means is recovering attacker's HP by a % of the damage dealt.

Example: absorb 10% of damage as HP
if your attack causes 100 points of damage, you will recover 10 HP (10% of 100)

I think you might be looking for bHPDrainRateRace or bHPDrainRate

Share this post


Link to post
Share on other sites
  • 0

thanks to all :) but will bHPDrainRateRace will work on magic?

Share this post


Link to post
Share on other sites
  • 0
1 minute ago, iCORE said:

thanks to all :) but will bHPDrainRateRace will work on magic?

Hmm I'm not completely sure, but its description says "with weapon attack" so I think not

Share this post


Link to post
Share on other sites
  • 0

if not is it possible to make it work on all attacks?

Share this post


Link to post
Share on other sites
  • 0

Probably yes, but would require source changes to achieve that

Share this post


Link to post
Share on other sites
  • 0

can you help me make it work with all attacks?

Share this post


Link to post
Share on other sites
  • 0

I haven't tested, but try this:

src/map/battle.c search:

		if (wd.flag & BF_WEAPON && src != target && damage > 0) {
			if (battle_config.left_cardfix_to_right)
				battle->drain(sd, target, wd.damage, wd.damage, tstatus->race, is_boss(target));
			else
				battle->drain(sd, target, wd.damage, wd.damage2, tstatus->race, is_boss(target));
		}

change to (first line)

		if (src != target && damage > 0) {
			if (battle_config.left_cardfix_to_right)
				battle->drain(sd, target, wd.damage, wd.damage, tstatus->race, is_boss(target));
			else
				battle->drain(sd, target, wd.damage, wd.damage2, tstatus->race, is_boss(target));
		}

 

Share this post


Link to post
Share on other sites
  • 0

will try as soon i get home thanks alot.

Share this post


Link to post
Share on other sites
  • 0

ive already tested its not correct :( it acts as a lifesteal not damage absorb.

Share this post


Link to post
Share on other sites
  • 0

hmm so I didn't get what exactly you're trying to do too xD

Share this post


Link to post
Share on other sites
  • 0

no worries maybe ill try to experiment some bonuses...

Share this post


Link to post
Share on other sites
  • 0
OnPCStatCalcEvent:
	bonus bNoWeaponDamage, 100;
	end;

totally immune to physical damage

 

so ... bonus bNoWeaponDamage, 10; will reduce 10% physical damage

Share this post


Link to post
Share on other sites
  • 0

Posted (edited)

@AnnieRuru sorry for my bad explanation but ill still try to explain it more clearly.

Example:

Item Description is "Absord 10% damage and heal as HP".

Player A deals 100 damage to Player B therefore Player B will heal 10% of the damage as HP. 

its like bHPDrainRate,'n'; but will trigger when being attacked by someone.

hope i explain it clearly that its not reduce damage like you are saying.

Edited by iCORE

Share this post


Link to post
Share on other sites
  • 0
absorb_health.c: In function ‘pc_damage_pre’:
absorb_health.c:66:9: warning: implicit declaration of function ‘rand’ [-Wimplicit-function-declaration]
   if ( (rand() % 1000) < ssd->hp_gain_rate_chance ) {
         ^
absorb_health.c:66:3: warning: nested extern declaration of ‘rand’ [-Wnested-externs]
   if ( (rand() % 1000) < ssd->hp_gain_rate_chance ) {
   ^
        PLUGIN  absorb_health

@AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

i got healing numbers but no effect at all.

 

im using latest gcc running at centos 7 redhat 64bit

Share this post


Link to post
Share on other sites
  • 0

already tested with

OnPCStatCalcEvent:
	bonus2 bHPGainRateWhenHit, 500, 50;
	bonus2 bHPGainRateWhenHit, 500, 50;
	end;

total up 100% chance to recover 100% hp

this formula is the same as hunter fly card, the chance and the value are just sum up

if doesn't work for you, no idea, it works on my test server

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now