For example, you pick up your extra health and it expires after 0.5 second then you make it that he gets another health pack at that moment and keep repeating it for the time you want it to last.
Hope that's a bit clear
Moderator: Core Staff


Stopped reading there.My knowledge of mapping/scripting is like 0

Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality

Code: Select all
playerHealthRegen()
{
self endon("end_healthregen");
////////////////////////////////////////////
maxhealth = 200;
////////////////////////////////////////////
oldhealth = maxhealth;
player = self;
health_add = 0;
regenRate = 0.1; // 0.017;
veryHurt = false;
thread playerBreathingSound(maxhealth * 0.35);
lastSoundTime_Recover = 0;
hurtTime = 0;
newHealth = 0;
for (;;)
{
wait (0.05);
if (player.health == maxhealth)
{
veryHurt = false;
continue;
}
if (player.health <= 0)
return;
wasVeryHurt = veryHurt;
ratio = player.health / maxHealth;
if (ratio <= level.healthOverlayCutoff)
{
veryHurt = true;
if (!wasVeryHurt)
{
hurtTime = gettime();
}
}
if (player.health >= oldhealth)
{
if (gettime() - hurttime < level.playerHealth_RegularRegenDelay)
continue;
if (gettime() - lastSoundTime_Recover > level.playerHealth_RegularRegenDelay)
{
lastSoundTime_Recover = gettime();
self playLocalSound("breathing_better");
}
if (veryHurt)
{
newHealth = ratio;
if (gettime() > hurtTime + 3000)
newHealth += regenRate;
}
else
newHealth = 1;
if (newHealth > 1.0)
newHealth = 1.0;
if (newHealth <= 0)
{
// Player is dead
return;
}
player setnormalhealth (newHealth);
oldhealth = player.health;
continue;
}
oldhealth = player.health;
health_add = 0;
hurtTime = gettime();
}
}
Oh i'm sorry for trying to helpRezil wrote:Stopped reading there.My knowledge of mapping/scripting is like 0

He just kidding m8, all help is usefullHoogie wrote:Oh i'm sorry for trying to helpRezil wrote:Stopped reading there.My knowledge of mapping/scripting is like 0