Raised This Month: $51 Target: $400
 12% 

m_iMaxHealth not affecting max health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blakeoxx
Member
Join Date: Jan 2009
Old 03-09-2009 , 17:52   m_iMaxHealth not affecting max health
Reply With Quote #1

I have tried two (pretty much the same) variants of setting the value of m_iMaxHealth on clients:

SetEntProp(client, Prop_Data, "m_iMaxHealth", 500);
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 500, 4, true);

They seem to change the value to 500, but TF2 still treats the extra health as a buff and degrades it over time. Is it no longer possible to change a players maximum health?
blakeoxx is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-10-2009 , 18:28   Re: m_iMaxHealth not affecting max health
Reply With Quote #2

Im pretty sure you must set m_iHealth and m_iMaxHealth on a single player.
__________________
CrimsonGT is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-11-2009 , 11:58   Re: m_iMaxHealth not affecting max health
Reply With Quote #3

When you touch a resupply cabinet or anything like that, it will reset their max health back to the default. You also must set their max health on a timer after they spawn (their class information such as life, max health, weapons, etc aren't loaded on the same frame that they spawn in).
bl4nk is offline
blakeoxx
Member
Join Date: Jan 2009
Old 03-11-2009 , 13:11   Re: m_iMaxHealth not affecting max health
Reply With Quote #4

The following does not work:

Quote:
public Action:Command_maxhealth(client, args)
{
SetEntProp(client, Prop_Data, "m_iMaxHealth", 500);
SetEntProp(client, Prop_Send, "m_iHealth", 500);
ReplyToCommand(client, "Max health set to 500");
}
I tried it while away from resupply cabinets, and at least 20 seconds after respawn. It set my health to 500, but the health started decreasing.
blakeoxx is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 03-11-2009 , 16:43   Re: m_iMaxHealth not affecting max health
Reply With Quote #5

I have not been able to get this to work for quite some time. As you said, the health ALWAYS degrades over time, no matter what you set m_iMaxHealth to or when you set it.

It used to work if you set both m_iMaxHealth and m_iHealth, but then that broke after one of the valve updates (I think it was the medic update).

I suspect TF2 might be checking the PlayerResource or some other location when determining whether to degrade the health

Last edited by naris; 03-11-2009 at 16:47.
naris is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-11-2009 , 21:20   Re: m_iMaxHealth not affecting max health
Reply With Quote #6

Use Prop_Send for m_iMaxHealth.
bl4nk is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 03-11-2009 , 23:57   Re: m_iMaxHealth not affecting max health
Reply With Quote #7

Quote:
Originally Posted by bl4nk View Post
Use Prop_Send for m_iMaxHealth.
That doesn't work, you get this:

L 03/11/2009 - 20:53:18: [SM] Native "SetEntProp" reported: Property "m_iMaxHealth" not found (entity 1/player)
naris is offline
labelmaker
Member
Join Date: Mar 2009
Location: Kentucky USA
Old 03-13-2009 , 07:51   Re: m_iMaxHealth not affecting max health
Reply With Quote #8

just add health equivalent to the amount of health being degraded to the max health specified and you should be golden. I know more code than you want but its tf2 and valve likes to give us a challenge.
labelmaker is offline
Send a message via Skype™ to labelmaker
blakeoxx
Member
Join Date: Jan 2009
Old 03-13-2009 , 07:58   Re: m_iMaxHealth not affecting max health
Reply With Quote #9

Well, I DID do that, but I think thats a lot more expensive and likely to break than just setting entity properties. :S

Actually, I just saved what the clients health should be, then a 0.1 timer sets the health to the value of that variable. I also used a player_hurt hook to change the health value.
blakeoxx is offline
ukm
New Member
Join Date: Mar 2009
Old 03-22-2009 , 03:12   Re: m_iMaxHealth not affecting max health
Reply With Quote #10

bumpin this, any ideas? I'm running into the same problem.

Failing any way to actually set the max health, blake could you elaborate a bit on how you implemented periodically adding health to offset the degradation?

I tried hooking player_hurt event and also hooked TakeDamage via DukeHacks but neither are called when the player's health ticks down so blocking them doesnt help. Also had a look through TFPlayer entity properties and haven't been able to identify any flag that might indicate whether the health is ticking down or not.

I know it has to be possible somehow cause there's a server which runs a mod called "ammomod" based on SM and Dukehacks which has increased health that doesnt degrade naturally :O
ukm is offline
Reply



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 12:03.


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