I'm making a script where I'm reducing the players health and maxhealth, but none of the things I've tried worked. It seems it only works if I set the number manually.
Strange, that should be fine. How do you know it isn't working? Maybe there is another function that resets the health, like jug does.
Edit, have you tried setting max health, and then a dodamage the difference of what they have and what you want them to have? Or a radiusdamage so it don't crash the game, just in case.
Last Edit: February 23, 2016, 10:40:55 pm by MakeCents
I don't know if you have a health counter that you can check if the damage is really taking ?
btw you can try make it iprintln to check what you current health are if you don't have a health counter of course.
also What I also know is that the health restored quickly, example:
health = 100 you being hit by a zombie your health now is: health = 40 it takes maybe between 1 or 2 second before the health is back on 100, it is not all the time 1 or 2 second but it is a example.
I know it isn't working because I have a Health counter, like gamer said. It only changes when I use doDamage() or self.health = <manual value> I'm not using doDamage() because it doesn't do all the damage sometimes (maybe it's due to the origin argument (?)). Will test with doDamage() again too.
instead of using doDamage do like makecents said and use radiusDamage on the player. doDomage on coop will force the game to restart since its a damage of MOD_UNKNOWN
Last Edit: February 23, 2016, 11:01:08 pm by buttkicker845
instead of using doDamage do like makecents said and use radiusDamage on the player. doDomage on coop will force the game to restart since its a damage of MOD_UNKNOWN
Can't do it with doDamage() or radiusDamage() because I still have the problem of the maxhealth. By the way, you can set the MOD of the damage on the fifth parameter of doDamage().
Can't do it with doDamage() or radiusDamage() because I still have the problem of the maxhealth. By the way, you can set the MOD of the damage on the fifth parameter of doDamage().
...does change the health and maxhealth values. I'll try to do something similar. Hope it works.
In the one map intro I did, I had to hurt the player in increments to get it to work right. I never figured out why, cause it worked and I moved on. I ended up damaging the player like half their health over and over. Not sure if it is related, but seeing what you said, makes me feel like it.
Not sure why you have the maxhealth problem. Doesn't make sense unless you need a wait in there....?
If your passing damage over to the function have you tried int(damage);
This works as well. Didn't test it yesterday. It seems that player.health and player.maxhealth only accept an integer as value. And probably, when you do a division, the game transform it to a double or a float, even though it has no decimals.
But, anyway, it's doing something weird. Initial health and maxhealth: 300. The player loses 6 points of health and maxhealth (294). Everything aright. But if the player is hit by a zombie - health: 240, maxhealth: 300 - and then loses the 6 points of health - health: 234, maxhealth: 234.
If I print the maxhealth instead of the health, it's always 300, until the player loses the 6 points, when it changes to 294. If the player is hit by a zombie, the maxhealth is still 300, until the player loses the 6 points, when it's reduced to 234.
Doesn't make sense. ??? Don't know if I explained myself well. Double Post Merge: February 25, 2016, 02:48:06 pmOk, think I've fixed it. I set another variable: self.force_maxhealth and a function that forces the maxhealth: