Power up Count down timer

I am trying to make a function that will power down my ship up grades in a 2d shooter. My thought is if the player picks up a power-up then every 30 seconds it goes down one level till back at base ship level. But I can’t figure it out I read and did the tutorials found on the web e.g. walker boys but all I can get done is move up in the power level but then reset in one swoop to beginning level. It is like going up a ladder and then jumping off. Her is the code I have been working on to have the player go down in levels and not jump there.

function PowerDown(powerUP_levle:int, powerUP_count:int, powerUP_time:string)
{
	//First loop will be number of powerups which will need to be added to when another power up it touched

	//Second loop will be the timer in seconds

	//After each run of the timer decament by one the power up level


	var Count   : int    = powerUP_count;
	var Time    : int    = powerUP_time;
	private var C	    : int;
	private var T	    : int;
	
	//If powerup count is greater then the current count reset the counter to zero and start loop again with new limit
	//also reset timer;

	if (Count != 0)
	{
		C=0;
		Count++;
		T=0;
		Time = powerup_time;
	}

	for (C=0;C<Count;C++)
	{
		for (T=0; T<Time; T++)
		{
		   yeid;
		}
		//Once the counter is at zero decament the powerup level
		powerUP_level--;
	}

	return void;
}

This is the answer to the problem it was the timer it should be float and the counter sould be j+=Time.deltatime
solution code

function PowerupTimer()
{
	//Variables for the PowerupTimer I is the laser type and J is the PowerupTimer
	var i : int;
	var j : float; 
	
	/*This will check to see if powerUP it true and if so, set variables to starting values
	This will will only be true when there has been a power up previously picked up and reset the values
	everytime a powerup is picked up.*/
	if (powerUP)
	{
		i=-1;
		j=PowerupTimer;
	}
	/*The I loop will countdown the laser type
	  The J loop is the PowerupTimer which is set by the developer
	  once the PowerupTimer is done the PowerupTimer is reset and the laser type is decramented by one
	  and then then I loop repeats till i is greater than the lasertype.*/
	for (i=-1; i<laserType; i++)
	{
		for (j=0; j<PowerupTimer; j+=Time.deltaTime)
		{
			yield;
			
		}
		//once the PowerupTimer is done reset the PowerupTimer and decrament the laser by one
		j=PowerupTimer;
		--laserType;
	}
	
	/*Once the I loop is finished turn off the powerup and set the lasertype back to zero*/
	powerUP = false;
	//check to see if power up is less than zero if so reset
	if(laserType<0){
		laserType = 0;}
}