ItsMods
Distance(self.origin, location) not working? - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: Distance(self.origin, location) not working? (/Thread-Distance-self-origin-location-not-working.html)



Distance(self.origin, location) not working? - xplosiff - 01-05-2012

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


RE: Distance(self.origin, location) not working? - Pozzuh - 01-05-2012

hmm, weird. Give us the rest of the function please.


RE: Distance(self.origin, location) not working? - Yamato - 01-05-2012

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


RE: Distance(self.origin, location) not working? - xplosiff - 01-05-2012

(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