I have a while loop #1 which has wait time 1 step and while loop #2 which has wait time 2 seconds and must stay INSIDE while loop#1, . And here comes the problem: the engine executes WhileLoop #1 properly, but doesn't wait 2 seconds for "#2" and executes it every frame instead!

here is a code which examinates this:

Code:
function shooting()
{
while(1)// this is while loop #2 
{
  create_bullet();
  wait(-2);
}

}


action npc()
{

while(1) //this is while loop #1 
{
  //do some stuff constantly 
  shooting(); //THIS little function is executed every frame instead of 2 sec interval >: ( 
 wait(1);
}

}


So how can I manage to execute properly while loop with 2 sec wait() time inside a while loop with 1 frame wait time?