Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Hacktank on March 15, 2009, 09:36:46 pm

Title: Healing with a vest -~ SOLVED ~-
Post 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)
Code: [Select]
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.
Title: Re: Healing with a vest
Post by: chutem on March 15, 2009, 11:00:38 pm
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
Title: Re: Healing with a vest
Post by: danmer on March 16, 2009, 04:07:54 am
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
Title: Re: Healing with a vest
Post by: Hacktank on March 16, 2009, 01:13:45 pm
Thanks danmer. It works now. Im starting to feel stupid.. :P