Hi
I'm trying to heal smoothly the player by adding point by point the heal of the med box
It works but if i place let's say 10 med kit, all med kit are consumed !
I tried a lot of thing but nothing works
I even tried to verify the id of the entity the hard way but no luck
Can someone help ?
CODE :
function health_grad_init(e)
StartTimer(e)
medkitpoints = 10
PointsToAdd = 0
AddingHealth = false
PickupCollected = false
id = e
end
function health_grad_main(e)
PlayerDist = GetPlayerDistance(e)
if not PickupCollected and PlayerDist < 70 and id == 16 then
PickupCollected = true
PlaySound(e, 0)
Hide(e)
end
if PickupCollected and g_PlayerHealth > 0 and id == 16 then
if not AddingHealth then
AddingHealth = true
PointsToAdd = medkitpoints
StartTimer(e)
end
if AddingHealth and PointsToAdd > 0 and GetTimer(e) > 100 and id == 16 then
AddPlayerHealth(e)
PointsToAdd = PointsToAdd - 1
StartTimer(e)
end
if PointsToAdd == 0 and id == 16 then
AddingHealth = false
ActivateIfUsed(e)
PromptDuration("Med kit caught : +"..medkitpoints.." id:"..e, 2000)
Destroy(e)
end
end
end