|
0 registered members (),
1,012
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: vec_dist? :(
[Re: Funeral]
#289531
09/13/09 19:16
09/13/09 19:16
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
you must set a "while(player == NULL) wait(1);" bevore your if because at the start all entities are at nullvector  hope this helps! EDIT: you even have to put the if in a while(1)  !
Last edited by Rei_Ayanami; 09/13/09 19:18.
|
|
|
Re: vec_dist? :(
[Re: Rei_Ayanami]
#289532
09/13/09 19:18
09/13/09 19:18
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
Member
|
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Alo you should say
action item() { if (vec_dist(player.x, me.x) < 10 ) { ent_remove(me); wait(1); } }
instead. You where checking if the other objekt is further then 10 quands away. And not closer then 10
|
|
|
Re: vec_dist? :(
[Re: Funeral]
#289558
09/14/09 03:20
09/14/09 03:20
|
Joined: Mar 2006
Posts: 1,993 Karlsruhe
PadMalcom
Serious User
|
Serious User
Joined: Mar 2006
Posts: 1,993
Karlsruhe
|
Your problem is, that you are checking just once if there are entities near you. A while loop will help: action item() { while(1) { //echecking each frame if(vec_dist(player.x,my.x) < 10) { //The 10 might be too small!! ent_remove(me); } wait(1); } } Not it should work! 
|
|
|
Re: vec_dist? :(
[Re: PadMalcom]
#289559
09/14/09 03:27
09/14/09 03:27
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
Member
|
Member
Joined: Apr 2009
Posts: 248
Philippines
|
I think Rei_Ayanami answers your question completely.. before you implement a loop please check first if the player exists..
action item()
{
while( player == NULL ) { wait(1); }
while(1)
{
if(vec_dist(player.x,my.x) < 10) //play with 10
{
ent_remove(me);
}
wait(1);
}
}
That should fix your problem...
Can't is not an option™
|
|
|
|