ItsMods
Problem changeing maxhealth - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: Problem changeing maxhealth (/Thread-Problem-changeing-maxhealth.html)



Problem changeing maxhealth - eXedit - 07-02-2011

I'm trying to change players hp induvidually depending on what team they are on using this code.

PHP Code:
sethp(hp) { self.maxhealth = hp; self.health = self.maxhealth; self iPrintLn(self.name+" maxhealth: "+self.maxhealth+ "hp:"+hp); }

It prints the name correctly by different clients so I know it gets run as player but it refuses to change the maxhp. Is there something else that needs to be changed to get it to work?


RE: Problem changeing maxhealth - iAegle - 07-02-2011

Huh? this should work fine ... try this.. maybe it doesn't register fast enough

Code:
sethp(hp) { self.maxhealth = hp; self.health = self.maxhealth; wait .05; self iPrintLn(self.name+" maxhealth: "+self.maxhealth+ "hp:"+hp); }



RE: Problem changeing maxhealth - eXedit - 07-02-2011

Im printing out the maxhp somewhere else all the time and tested it by just shooting people/bots, the maxhealth just wont change.

-----EDIT----

Tried calling the function in onPlayerSpawned()... worked fine.
But calling the function in a for level.players loop doesnt.
Strange thing is the function recognizes the player it is called on since it outputs the player.name correctly.



RE: Problem changeing maxhealth - Lost4468 - 07-03-2011

(07-02-2011, 17:07)iAegle Wrote: Huh? this should work fine ... try this.. maybe it doesn't register fast enough

Code:
sethp(hp) { self.maxhealth = hp; self.health = self.maxhealth; wait .05; self iPrintLn(self.name+" maxhealth: "+self.maxhealth+ "hp:"+hp); }

That's not going to matter at all. Maybe you should attempt to loop the iprintln to see if the game sets it back to another value at all.