Hi all,
i have a question about saving and checking the you pointer.
function carried_ent()
{
//ENTITY* carrier = you;
while(you)
{
vec_for_vertex(my.skill30,you,141);
vec_set(my.x,my.skill30);
//some additional code
wait(1);
}
ent_remove(me);
}
The code above is working fine. This entity has to exist as long as its creator exists. "You" is pointing to the creating entity, but what i would like to know:
- if i add code in the loop that alters the you pointer like c_scan or c_trace, will "while(you)" check if the creator or the target of scan/trace still exists?
if i change the code above like this its no longer working
function carried_ent()
{
ENTITY* carrier = you;
while(carrier)
{
vec_for_vertex(my.skill30,carrier,141);
vec_set(my.x,my.skill30);
//some additional code
wait(1);
}
ent_remove(me);
}
I guess cause i only set it once, "carrier" doesn`t know that the creator was removed.
If i replace "while(carrier)" with "while(carrier==you)" its working again, but i dont know whether i will get the same problem as with the first codeexample.
Any suggestions? I`m thankfull for your help.
Regards