Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: Hacktank on March 15, 2009, 09:36:46 pm
-
I am having some trouble getting healing to work if you have a vest. I have it do a loop trying to max out the vest and health but it only heals a little bit of your health and vest per running.
Here is the code: (vesthp is 100 if the players vest is > 0, otherwise it is 0)
repeat
if getplayerstat(ID,'health') < 150 then dodamage(ID,-2);
if getplayerstat(ID,'health') > 150 then dodamage(ID,2);
if getplayerstat(ID,'vest') < vesthp then dodamage(ID,-1);
until (getplayerstat(ID,'health') = 150) AND (getplayerstat(ID,'vest') = vesthp);
I dont get why this isnt working. What is the % of the damage done to the vest and the health when damage is done? Why isnt this working?
Thank You.
-
You need to spawn a vest kit on them using give bonus.
If you want vesthp to be less than the max vest, I think doing 2 damage takes away 1 vest hp
-
its something like 1/3 of the damage goes into vest and 1/4 to health. Just do some testing with writeln's in onplayerdamage
-
Thanks danmer. It works now. Im starting to feel stupid.. :P