Raised This Month: $28 Target: $400
 7% 

Setting users health mod independant


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Isobold
Veteran Member
Join Date: Mar 2004
Old 02-18-2007 , 09:39   Setting users health mod independant
Reply With Quote #1

Hi,

again one of my stupid questions. I wrote a plugin called HP Balance : http://forums.alliedmods.net/showthread.php?t=50285

It's working fine, but I need some help to improve it. Right now I set users health to some value at round start. In some mods, users may regenerate some how. How can I restrict/expand their regeneration to another health value than 100?

This needs to be mod independant!

Thx in advance, of course you will get credit and karma for your relevant help ...
Isobold is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-18-2007 , 13:49   Re: Setting users health mod independant
Reply With Quote #2

Try checking their maximum HP.

Fakemeta:
Code:
new Float:maxhealth; pev(id,pev_max_health,maxhealth);

Engine:
Code:
new Float:maxhealth = entity_get_float(id,EV_FL_max_health);
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Isobold
Veteran Member
Join Date: Mar 2004
Old 02-18-2007 , 14:21   Re: Setting users health mod independant
Reply With Quote #3

I do not need to know it, I need to set it to another value until next respawn ...
Isobold is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-18-2007 , 17:30   Re: Setting users health mod independant
Reply With Quote #4

Uh, okay...

Fakemeta:
Code:
set_pev(id,pev_max_health,123.0);

Engine:
Code:
entity_set_float(id,EV_FL_max_health,123.0);
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 02-18-2007 , 20:55   Re: Setting users health mod independant
Reply With Quote #5

@Avalanche, he wasn't asking that.

@Isobold, I don't think thats possible without making it mod specific (j/w what mod are you talking about).
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-18-2007 , 22:01   Re: Setting users health mod independant
Reply With Quote #6

Lord_Destros: Then what was he asking?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 02-19-2007 , 01:57   Re: Setting users health mod independant
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX View Post
Lord_Destros: Then what was he asking?
From what I understood he's saying in some mods people automatically regain health (i.e. if shot down to 60 health from 100, they will slowly heal back up to 100). He was trying to make it so that after setting a users health if they were hurt they would auto regenerate if the mod allowed them to do so.

If I said it was impossible earlier I somewhat lied. Heres the only method I can think of:

To (re/de)generate their health:

1. Simply make a loop that gives players health every X seconds if their HP is greater than 100 UP TO whatever you initially used in set_pev.
2. To degenerate their health (they specify a value less than 100 in set_pev)
Simply make a loop that removes players health every X seconds if their HP is greater than what you initially used in set_pev.

To detect if the mod supports regeneration:

1. Check once every second to see if a players health has increased. If it has then measure the amount it has increased and over what period of time.

Downsides to this method. It will not work if they were hurt but the damage they received was not enough to trigger regeneration and if someone increases a users health via a medical kit or admin command then that will confuse the plugin.

If you want it to be mod independent I suggest just creating 2 cvars with examples shown below
sv_regeneration "<0/1>"
sv_regenerationRate "<Regeneration rate as a float in seconds>"
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
Isobold
Veteran Member
Join Date: Mar 2004
Old 02-19-2007 , 03:38   Re: Setting users health mod independant
Reply With Quote #8

That would not solve my problem, as I was asked to solve an issue, where people would use an health kit and regain their health up to 100 health no matter to which health amount they were set at round start (instead of regenerating to the value they got asigned at round start).

What I need is to allow health to be regenerated (by what ever event) to a value calculated at round start, so that one would not be able to have more than 67 health, while another player would be able to have 133 hp. My plugin already gives them this health at round start, and I could manage to survey that the first player would not get more than 67 hp, but how could I manage to let player two regain his 133 health by picking up a health kit? If he is at 101 health for example, he would not even pick up the health kit, so no event would follow?!?

Your idea to use a fix regeneration would not be a god idea, as wc3 for cs for example has regeneration for some characters only, others only regenerate if a healer is somewhere around.

Is there really now way to set some kind of max-health-value? HLČ makes exentsive use of this, was it only introduced there?
Isobold is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 02-19-2007 , 18:39   Re: Setting users health mod independant
Reply With Quote #9

My idea isn't that good since it has far too many problems but unless you specify the recover rate by cvar (and the amount to heal) then it should be impossible as far as I know to do it well.

About your wc3 comment you would be able to check if they are within range of someone else and are the correct 'race' with correct ability before giving them the HP.
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-19-2007 , 19:18   Re: Setting users health mod independant
Reply With Quote #10

Quote:
Originally Posted by Isobold View Post
Is there really now way to set some kind of max-health-value? HLČ makes exentsive use of this, was it only introduced there?
I already posted how to do this.

Mods that give players their own health regeneration certainly use max_health. Health chargers and medkit pickups check to make sure they don't go over max_health. So, change max_health, as I showed you already.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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:41.


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