Raised This Month: $ Target: $400
 0% 

How to get damage done by an attacker and...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 08-05-2016 , 08:57   How to get damage done by an attacker and...
Reply With Quote #1

How to get damage done by an attacker and heal 10% of that? SetEntityHealth(client, damage*0.1) doesn't do that in OnTakeDamage.
Nursik is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-05-2016 , 09:02   Re: How to get damage done by an attacker and...
Reply With Quote #2

Reduce the damage value by 10% in OnTakeDamage?
__________________
WildCard65 is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 08-05-2016 , 10:00   Re: How to get damage done by an attacker and...
Reply With Quote #3

Quote:
Originally Posted by WildCard65 View Post
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.
Nursik is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-05-2016 , 10:02   Re: How to get damage done by an attacker and...
Reply With Quote #4

try:
PHP Code:
SetEntityHealth(clientGetClientHealth(client) + (damage .1)); 
__________________
WildCard65 is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 08-05-2016 , 10:12   Re: How to get damage done by an attacker and...
Reply With Quote #5

Quote:
Originally Posted by WildCard65 View Post
try:
PHP Code:
SetEntityHealth(clientGetClientHealth(client) + (damage .1)); 
let me try.
EDIT: gives tag mismatch warning and doesn't work. :/

Last edited by Nursik; 08-05-2016 at 10:15.
Nursik is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 08-05-2016 , 10:30   Re: How to get damage done by an attacker and...
Reply With Quote #6

Quote:
Originally Posted by WildCard65 View Post
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)); 
Potato Uno is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 08-05-2016 , 10:41   Re: How to get damage done by an attacker and...
Reply With Quote #7

ist the client the attacker?

in onTakeDamage the client is the victim..
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...
Totenfluch is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 08-05-2016 , 10:49   Re: How to get damage done by an attacker and...
Reply With Quote #8

Quote:
Originally Posted by Totenfluch View Post
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.
Nursik is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 08-05-2016 , 10:54   Re: How to get damage done by an attacker and...
Reply With Quote #9

Then this should work
Code:
SetEntityHealth(attacker, GetClientHealth(attacker) + RoundToFloor(damage * .1));
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...
Totenfluch is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 08-05-2016 , 11:07   Re: How to get damage done by an attacker and...
Reply With Quote #10

Quote:
Originally Posted by Potato Uno View Post
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.

Last edited by Nursik; 08-05-2016 at 11:25.
Nursik is offline
Reply


Thread Tools
Display Modes

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:33.


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