Sorry, my bad. I left out a layer of thinking.
function i_am_fly(box* Thisbox)
{
while(Thisbox.lifetime>0)
{
wait(1); //wait 1 frame
Thisbox.lifetime -= 1; //reduce counter
}
ent_remove(Thisbox.model); //remove timed-out model
ptr_remove(Thisbox); //remove empty box
}
Does this explain my intention better?
Cause if Ive got it right, and you JUST want to have a time-out counter,
you could look into using the entities "skills". Below is an exact copy of whats happening above.
/// Assume in new_box you said
...
my_model = ent_create("cube_small.x",vector(0,0,0),NULL);
my_model.skill25 = 100;
i_am_Dying(My_Model);
...
function i_am_dying(ENTITY* ThisModel)
{
while(ThisModel.skill25>0)
{
wait(1); //wait 1 frame
ThisModel.skill25 -= 1; //reduce counter
}
ent_remove(ThisModel); //remove timed-out model
}
Interesting? 100 built-in variables in every entity. Or is this old news to you?