|
0 registered members (),
631
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Waht is wrong hete ?
[Re: PadMalcom]
#403180
06/15/12 20:07
06/15/12 20:07
|
Joined: Jul 2001
Posts: 4,801 netherlands
Realspawn
OP

Expert
|
OP

Expert
Joined: Jul 2001
Posts: 4,801
netherlands
|
both did not help  this did  action stone_gone() { set(my,SHADOW); set(my,TRANSLUCENT); while((me != NULL) && (vec_dist(my.x,player.x) >80)) wait(300); ent_remove(me); }
|
|
|
Re: Waht is wrong hete ?
[Re: Realspawn]
#403185
06/15/12 20:49
06/15/12 20:49
|
Joined: May 2009
Posts: 5,367 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,367
Caucasus
|
Try this then:
action stone_gone(){
while(!player){ wait(1); } // wait till player is created!
set(my, SHADOW | TRANSLUCENT);
while(vec_dist(my.x, player.x) > 80){
wait(300);
}
wait(1);
ent_remove(me);
}
What should this do? Remove entity as soon as player gets closer or what?
|
|
|
Re: Waht is wrong hete ?
[Re: Realspawn]
#403256
06/17/12 07:48
06/17/12 07:48
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Can someone explain why?
I don't get it. Maybe I'm missing the obvious, but as soon as ent_remove(my) is called, the function should be stopped. That means the while() is never checked again. Which in turn means, assuming the player entity exists, the function shouldn't crash. Or is it that some other function uses the entity?
One more thing, Realspawn, I think the wait(300) is supposed to wait for a certain time before checking again, right? This time should be PC-independent, though, I asume. If that's the case you should wait a time, not a number of frames. Waiting 300 frames on one PC might take 10 seconds, while on the other PC it'll take 3 seconds. So instead, try: wait(-3); The wait(1) is fine though (but I don't think it's necessary).
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: Waht is wrong hete ?
[Re: Germanunkol]
#403267
06/17/12 09:37
06/17/12 09:37
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
Expert
|
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
correct me if i'm wrong, but i think the while loop checks the arguments as last after running through. like:
start loop run run run end loop but restart if()
?
Last edited by Espér; 06/17/12 09:38.
|
|
|
|