AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to get damage done by an attacker and... (https://forums.alliedmods.net/showthread.php?t=285998)

Nursik 08-05-2016 08:57

How to get damage done by an attacker and...
 
How to get damage done by an attacker and heal 10% of that? SetEntityHealth(client, damage*0.1) doesn't do that in OnTakeDamage.

WildCard65 08-05-2016 09:02

Re: How to get damage done by an attacker and...
 
Reduce the damage value by 10% in OnTakeDamage?

Nursik 08-05-2016 10:00

Re: How to get damage done by an attacker and...
 
Quote:

Originally Posted by WildCard65 (Post 2442472)
Reduce the damage value by 10% in OnTakeDamage?

no, that's not what i want. I want to heal, to remake the vaccinator's old feature to heal 10% of incoming damage to his patient on proper resist.

WildCard65 08-05-2016 10:02

Re: How to get damage done by an attacker and...
 
try:
PHP Code:

SetEntityHealth(clientGetClientHealth(client) + (damage .1)); 


Nursik 08-05-2016 10:12

Re: How to get damage done by an attacker and...
 
Quote:

Originally Posted by WildCard65 (Post 2442486)
try:
PHP Code:

SetEntityHealth(clientGetClientHealth(client) + (damage .1)); 


let me try.
EDIT: gives tag mismatch warning and doesn't work. :/

Potato Uno 08-05-2016 10:30

Re: How to get damage done by an attacker and...
 
Quote:

Originally Posted by WildCard65 (Post 2442486)
try:
PHP Code:

SetEntityHealth(clientGetClientHealth(client) + (damage .1)); 


I don't think you can add a float and an int like that.

This is probably how you do it:

PHP Code:

SetEntityHealth(clientGetClientHealth(client) + RoundToFloor(damage .1)); 


Totenfluch 08-05-2016 10:41

Re: How to get damage done by an attacker and...
 
ist the client the attacker?

in onTakeDamage the client is the victim..

Nursik 08-05-2016 10:49

Re: How to get damage done by an attacker and...
 
Quote:

Originally Posted by Totenfluch (Post 2442494)
ist the client the attacker?

in onTakeDamage the client is the victim..

the one attacking is attacker (obviously) and the one getting 10% heal is victim2.

Totenfluch 08-05-2016 10:54

Re: How to get damage done by an attacker and...
 
Then this should work
Code:

SetEntityHealth(attacker, GetClientHealth(attacker) + RoundToFloor(damage * .1));

Nursik 08-05-2016 11:07

Re: How to get damage done by an attacker and...
 
Quote:

Originally Posted by Potato Uno (Post 2442490)
I don't think you can add a float and an int like that.

This is probably how you do it:

PHP Code:

SetEntityHealth(clientGetClientHealth(client) + RoundToFloor(damage .1)); 


Thanks, works perfectly now.
EDIT: Ah wait, no, it doesn't. It treats damage as a medic's heal, so i should somehow make that damage be only detected as attacker's, not second victim's.


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

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