Page 2 of 2

Re: Spawnable healthpacks in CoD2

Posted: August 5th, 2010, 8:05 pm
by Hoogie
My knowledge of mapping/scripting is like 0 but why don't you make it so that the player keeps getting the extra health.

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 :P

Re: Spawnable healthpacks in CoD2

Posted: August 5th, 2010, 8:06 pm
by Rezil
My knowledge of mapping/scripting is like 0
Stopped reading there.

Re: Spawnable healthpacks in CoD2

Posted: August 5th, 2010, 11:09 pm
by waywaaaard
hm there must be a way to achieve this - they've done it in quake 3 too :D Maybe with too much time on my hands I have a look at some quake scripts

Re: Spawnable healthpacks in CoD2

Posted: August 5th, 2010, 11:50 pm
by <LT>YosemiteSam[NL]
I tried something with the _healthoverlay.gsc

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();
	}	
}
When I change the lines there you continously get the breathingsound have no clue what it realy does ?

Re: Spawnable healthpacks in CoD2

Posted: August 6th, 2010, 1:53 am
by Hoogie
Rezil wrote:
My knowledge of mapping/scripting is like 0
Stopped reading there.
Oh i'm sorry for trying to help :|

Re: Spawnable healthpacks in CoD2

Posted: August 6th, 2010, 8:01 am
by <LT>YosemiteSam[NL]
Hoogie wrote:
Rezil wrote:
My knowledge of mapping/scripting is like 0
Stopped reading there.
Oh i'm sorry for trying to help :|
He just kidding m8, all help is usefull :)