I have a health kit that adds 50 hp onto my player, but I want my player to have a limit on how much he can add to his health. I have maxhealth variable and a hp variable. Do i need to make an infinte loop cycle? I tried that and it lagged me out. I am rather new at this so please noobie it down for me ;) |
All you need to do is after adding the 50 health points to the player, check if they are over their max health and if they are set their health to their max health.
Alternatively you could have an additional variable which measures how much health they have been given by health kits, if they have relieved the limit you want them to then make it so that health kits no longer work for them. It all depends on how exactly you want to limit the health that they can receive. |
Thanks to both of you, I am beginning to like the roundabout ways of solving problems ;)
|
In response to Laser50
|
|
Laser50 wrote:
Turn it into a function; > mob/proc/AddHealth(var/amt) A bit like that? Code would need some editing, obviously. I marked your answer as correct, slightly simpler way of doing this tho I'd like to share : GainHp(amt=0) |
A bit like that? Code would need some editing, obviously.