ItsMods

Full Version: Distance(self.origin, location) not working?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have this code inside a while(1) which is active all the time while the player is spawned, but it ALWAYS returns true, no matter where you are in the map.

Code:
        if(Distance(self.origin, level.intel[level.currentintel].coordinates) <= 70) self.nearintel = true;
        else self.nearintel = false;

have I done anything wrong? yes, level.currentintel and level.intel[ID].coordinates are defined, forced before anything else is. i have set self.nearintel = false; when the player connects.

thanks in advance
hmm, weird. Give us the rest of the function please.
Code:
if(Distance(self.origin, level.intel[level.currentintel].coordinates) <= 70)

to:

Code:
if(Distance(self.origin, level.intel[level.currentintel].coordinates.origin) <= 70)

It needs origin, no? Smile
(01-05-2012, 12:06)Yamato Wrote: [ -> ]
Code:
if(Distance(self.origin, level.intel[level.currentintel].coordinates) <= 70)

to:

Code:
if(Distance(self.origin, level.intel[level.currentintel].coordinates.origin) <= 70)

It needs origin, no? Smile

thanks, but it works now. the coordinates weren't even initialized and thats why it was bugging up. I ended up fixing it myself, but thanks anyway Smile