Home   Help Search Login Register  

Author Topic: [SOLVED] position nearestObject type help  (Read 1222 times)

0 Members and 1 Guest are viewing this topic.

Offline paritybit

  • Members
  • *
[SOLVED] position nearestObject type help
« on: 27 Mar 2008, 21:41:27 »
I've searched and found many results regarding the Position nearestObject Object command, but none of them seem to give me the information I need.

I'm attempting to check for the nearest Man and enable or disable a spawn point depending on which side it is -- my base is Dr. Eyeball's respawning script which works lovely without any modifications.  If there is no man within 50 meters (ComRef says this is the limit of the check) then I'm fine with assuming it's west.  So I do this:

Code: [Select]
_tempPosition = getPos west_spawn_1;
_tempObject = _tempPosition nearestObject "Man";
player sideChat "DEBUG: Checking for friendlies near town center";
if ( (isNull _tempObject) || (side _tempObject == west) ) then {
player sideChat "DEBUG: Nearest man to town center is friendly; spawn point available";
_MyDualList = _MyDualList + [["Town (center)", "west_spawn_1"]];
};

I always get the first message ("DEBUG: Checking for friendlies near town center."), but never the second message.  I've tried different variations: I placed a west man at the marker, I placed an east man at the marker, I made sure no men were near the marker; all with the same results.

I tried printing out the value of _tempObject using "player sideChat str _tempObject", but no message ever showed up (which is why I added the null check).

I've also tried using "Vehicle" for the type and I tried isNil ("_tempObject") but to no avail.

Any suggestions?  Is it obvious that I've done something wrong or am I playing with strange behaviors of the ArmA engine?
« Last Edit: 09 Apr 2008, 23:39:25 by paritybit »
Heroes don't die -- they just respawn.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: position nearestObject type help
« Reply #1 on: 27 Mar 2008, 21:47:13 »
is west_spawn_1 an object or gamelogic?

Offline paritybit

  • Members
  • *
Re: position nearestObject type help
« Reply #2 on: 27 Mar 2008, 21:53:53 »
Sorry, should have specified.  It is a point marker.
Heroes don't die -- they just respawn.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: position nearestObject type help
« Reply #3 on: 27 Mar 2008, 22:00:11 »
Code: [Select]
_tempPosition = getMarkerPos "west_spawn_1";