hello,
I tried a lot around and I'm not able to solve this problems.
The first one is a little function that _should_ spawn entities in one line from one position to another one.

Code:
unction felsSpitzen(VECTOR* startPos,VECTOR* endPos)
{
VECTOR tempPos;
VECTOR addPos;
vec_set(addPos,endPos);
vec_sub(addPos,startPos);
vec_normalize(addPos,50);
vec_set(tempPos,startPos);
while(vec_dist(tempPos,endPos)>25)
{
ent_create("felsen.mdl",tempPos,felsMoveOut);
vec_add(tempPos,addPos);
wait(-random(0.05));
}
}



it spawns them correctly, but it don't stop spawning them, if they reached the end-position.If i comment out the wait() everything works property.

My second problem is, that a function(main) I use to check if a key is pressed is closed if I call another function.
I left out all unimportant parts. If I comment out the ent_remove everything works fine.
Code:
function flash_func()
{
set(my,BRIGHT | TRANSLUCENT);
my.alpha = 100;
while(my.alpha>0)
{
my.alpha -= 7*time_step;
wait(1);
}
ent_remove(me);
}

function spawn_flash(VECTOR* position)
{
me = ent_create("lightning2.tga",position,flash_func);
}

int main()
{
[...]
while(1)
{
if(key_l)
{
spawn_flash(nullvector);
while(key_l){wait(1);}
}
wait(1);
}
return 0;
}



Last edited by Scorpion; 12/02/07 10:17.