Raised This Month: $ Target: $400
 0% 

Set Player's max HP on spawn (TF2)


Post New Thread Reply   
 
Thread Tools Display Modes
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-14-2009 , 19:17   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #31

Can someone give me one example of where making code readable reduces efficiency? >.>
Dragonshadow is offline
Flynn
Senior Member
Join Date: Sep 2009
Old 09-14-2009 , 20:43   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #32

Quote:
Originally Posted by Dragonshadow View Post
Can someone give me one example of where making code readable reduces efficiency? >.>
In the case of idiomatic C (C that uses syntax abuse in order to function correctly)

Code:
while(*(string1++) = *(string2++));
Would be re-written to be readable as
Code:
//Iterators for strings
int Iterator1 = 0;
int Iterator2 = 0;
//Copy from Source string to Destination String
while(Destination[Iterator1] != '\0')
{
   Destination[Iterator1] = Source[Iterator2];
   Iterator1++;
   Iterator2++;
}
//This code takes longer to write over-all, requires ints and a larger memory footprint, but is more readable
Pointer and bitwise logic will make things more unreadable. SM thankfully shields people from pointers.

Code:
int G, J;
int *L, *X; //Pointers; * is not 'multiply' but 'dereferencing'

L = G, X = J;

*L = *X = 2;

*L = (*L| (2 == (*L | *X))); //Fairly useless code, but some code can be written as confusingly

L = L ^ X;
X = L ^ X;
L = L ^ X;
//This is a swapping operation... but what has it swapped? The addresses or the variables?
If I was to simplify the code to make it readable I'd need to declare separate variables (as well named bools), instead of using bitwise operations, using standard C ops that are better recognised (or explaining each operation process throughout). If you have trouble following this code then you got problems; this is the basics.
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-14-2009 , 21:27   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #33

Brain, it hurts
Dragonshadow is offline
Stinkyfax
BANNED
Join Date: Aug 2007
Old 09-15-2009 , 09:24   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #34

Guys, don't fight.
I tried modifying m_iMaxHealth in map props and in netprops -> CTFPlayerResource -> m_iMaxHealth
neither of them seemed to work.
The last method has weired effect:
Like for 1 frame each 5 seconds I see my max HP being modified but then it instantly goes to normal...
Stinkyfax is offline
Flynn
Senior Member
Join Date: Sep 2009
Old 09-15-2009 , 10:06   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #35

Quote:
Originally Posted by Stinkyfax View Post
Like for 1 frame each 5 seconds I see my max HP being modified but then it instantly goes to normal...
That sounds like it implies TF2 has a maximum for how high you can heal a class up to, a threshold for where the HP starts to degenerate, and (keypoint) the 'current' HP.

Surely there must be a way we can find the other two variables...
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-15-2009 , 10:49   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #36

Quote:
Originally Posted by Flynn View Post
a maximum for how high you can heal a class up to
Possibly 2147483647.

Quote:
Originally Posted by Flynn View Post
a threshold for where the HP starts to degenerate
Default class max health +1?

Quote:
Originally Posted by Flynn View Post
and (keypoint) the 'current' HP.
m_iHealth
bl4nk is offline
Stinkyfax
BANNED
Join Date: Aug 2007
Old 09-15-2009 , 11:48   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #37

bl4nk You've got the point
I can freely set the hp to 500 and it will degenerate.
As I said, all my methods complitely failed, does smbody know any new ideas?
By the way All the plugins I found which manipulate max health are not working as well. I guess it is new TF2 update since I honestly disrespect the way TF2 support modifications. I feel like they don't care about others who try to make their game more popular.
Stinkyfax is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 09-15-2009 , 12:37   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #38

Theres a plugin around that keeps health from degenerating. It just uses repeating timers and keeps setting it back. Not sure how resource friendly it was but, it did work.
retsam is offline
Flynn
Senior Member
Join Date: Sep 2009
Old 09-15-2009 , 13:30   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #39

Quote:
Originally Posted by bl4nk View Post
Default class max health +1?
But where is that default? If you can modify that, you can stop the degeneration.

Or maybe, like, a continuous 'healing' on the target player that doesn't give them health; just stops the degeneration?

Perhaps something like that. An always firing heal event on the given target that adds no health. Theoretically that could stop it, as if they had an invisible medic following them with a useless medigun.
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 09-15-2009 , 14:44   Re: Set Player's max HP on spawn (TF2)
Reply With Quote #40

You could play around with these couple cvars:

tf_boost_drain_time
tf_max_health_boost
pheadxdll 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 01:15.


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