Home   Help Search Login Register  

Author Topic: GODAMN NearestObject!  (Read 948 times)

0 Members and 1 Guest are viewing this topic.

RaiN_MaN

  • Guest
GODAMN NearestObject!
« on: 13 Nov 2002, 14:14:00 »
Hi all

I don't know exactly but i think it's about 6 months now that i wait for the nearestObject command to work. Now that the 1.85 patch is out and that command should work again i tried a little stupid script, but ... IT DOESN'T WORK !!  :hmm: ....  >:(  >:( ....look at this:


_FleeUnit = _this select 0
_x = getPos _FleeUnit select 0
_y = getPos _FleeUnit select 1
_z = getPos _FleeUnit select 2

_near = NearestObject [_x,_y,_z]

player globalChat format ["Driver: %1, Car: %2", _FleeUnit, _near]


^ this works, but it doesn't return what i need, it returns the name of FleeUnit (nearestobject to myself is myself ? :hmm: oh well).

I searched the forum and the Command Reference (official and not), every example different from the one above doesn't work.
I need to find the nearest land vehicle to _FleeUnit, i thought that would be:


_FleeUnit = _this select 0
_near = NearestObject [_FleeUnit, "Car"]


... or:


_FleeUnit = _this select 0
_near = NearestObject [_FleeUnit, "Land"]


... but everytime i try that i get a "scalar bool string ecc ..." stuff instead of the nearest vehicle name.

Did BIS really fix the nearestObject command or did they just say so?!
Maybe i'm just too stupid, but WTF, even if i copy an example from the comref it doesn't work !!!!!!!!!  >:( >:(

Plz  :help: !!
Thx in advance!

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:GODAMN NearestObject!
« Reply #1 on: 13 Nov 2002, 16:19:03 »
It works, but not that way.

SOmeone once dropped me an email and told me NearestObject only works if the object is within 50m.  You might also need to call it by its specific name (but on this I am not secure).
Dinger/Cfit

RaiN_MaN

  • Guest
Re:GODAMN NearestObject!
« Reply #2 on: 13 Nov 2002, 16:32:08 »
50 meters? specific name?! That way the nearestobject command is useless!

I have a test mission ich which _FleeUnit has a jeep near it and even if i try to use :

_found = nearestObject[_FleeUnit, "testcar"]

...it doesn't work. "testcar" is the name of the jeep near FleeUnit, which now is not more than 5 meters away from FLeeUnit.
Still nothing! I really don't understand how this command is intended to work, and what BIS smoked while they where coding that command.  ??? ???

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:GODAMN NearestObject!
« Reply #3 on: 13 Nov 2002, 16:56:11 »
_found = nearestObject[_FleeUnit, "testcar"]

...it doesn't work. "testcar" is the name of the jeep near FleeUnit, which now is not more than 5 meters away from FLeeUnit.

try using  this instead

_found = nearestObject[_FleeUnit, "jeep"]

look in the official command reference in the cfgvehicles section, you can use any boject with a + next to its name

RaiN_MaN

  • Guest
Re:GODAMN NearestObject!
« Reply #4 on: 13 Nov 2002, 19:17:53 »
Thx mate! Now it works fine!
I thought every vehicle type in the cfgvehicle section could be used since i saw a land mine script which usses the "Land" constant.
Is something like that mine script possibile or do i have to write pages of code to get al kinds of land vehicles out of the nearestobject command? I mean, if i wanna spot  JeepMGs too, not only Jeeps, do i need to write a lot of ifs or a loop or can i just type something like "nearestobject[player, "Jeep", "JeepMG", ...] ?

Thanx a lot! :)