Although your script didn't work, the "time_step * 0.0625" part helped immensely and fixed the problem. I reduced the max to 15 (300 ticks was fine but not 300 seconds grin ) and now my character runs for a constant maximum of 15 seconds (give or take a thousandth of a second) and must rest afterward for a constant 15 seconds.

If she doesn't run the full 15 seconds, she still must rest for the time she did run if shift is released, still debating whether I want this effect.

So thanks

Code:

function sprint()		//allows the player to sprint for a maximum of 15 seconds, after which she must rest for the time she sprinted
{
	if(key_shift)					//if shift is pressed
	{
		if(tired == 0)				//if tired is zero
		{
			if(sprinting < 15)	//if the sprinting variable is less than max
			{
				sprinting += time_step * 0.0625;	//increase by 1 if sprinting is less than max, constrained to max
				player.speed = 60;					//set player speed to 60
			}
			else							//if sprinting variable is greater/equal to than max
			{
				tired = 1;				//set tired to 1
				player.speed = 10;	//set player speed back to 10
			}
		}	
		else
		{		
			sprinting -= (time_step * 0.0625) * (sprinting >= 0);	//reduce sprinting by 1 if sprinting isn't 0
			tired = (sprinting >= 0);										//set tired to 0 when sprinting hits 0
		}
	}
	else										//if shift is released, allow sprinting to reduce back to 0
	{		
		sprinting -= (time_step * 0.0625) * (sprinting >= 0);	//reduce sprinting by 1 if sprinting isn't 0
		tired = (sprinting >= 0);										//set tired to 0 when sprinting hits 0
		player.speed = 10;												//set speed back to 10
	}
}



I was once Anonymous_Alcoholic.

Code Breakpoint;