Home   Help Search Login Register  

Author Topic: Detecting when a given position has been reached.  (Read 1104 times)

0 Members and 1 Guest are viewing this topic.

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Detecting when a given position has been reached.
« on: 01 Jul 2007, 13:21:50 »
Hi guys, i am trying to do a fairly simple script but am having difficulty detecting when a selected position has been reached.
At the moment i am making a heli take off and move to a given position that is selected from the map using the onmapsingleclick command. The given position creates a game logic at this location. What i am trying to do is once the helicopter detects it is within lets just say....... 10 metres from the game logic to force itself to land.

The problem is, when i use the distance command the helicopter never seems to force itself to land as with it being in the air it detects the distance vertically as being outside the range, what i really want it to do is just detect that it has reached the location horizontally on the map and land. My code to make the chopper move, is simple and listed as below, what would i add to this to finish it? Thanks in advance.

start script :
onMapSingleClick "([player11,_pos] exec 'land.sqs')";

land script :

_pos = _this select 1;

HeliLogic = "Logic" createVehicle [_pos select 0, _pos select 1, _pos select 2];
supplies move _pos;

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Detecting when a given position has been reached.
« Reply #1 on: 01 Jul 2007, 13:26:05 »
da prob w/ choppers is dat dey stop movin 2 far b4 da target (sometimes more dan 50 meters distance)

try usin as a condition da line

unitready supplies

dis wil give u true wen da chopper thinks it arrived

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Re: Detecting when a given position has been reached.
« Reply #2 on: 01 Jul 2007, 14:23:38 »
thanks again LCD, it wasnt the answer to the method i was looking for but having said that, after implementing your advise i achieved exactly the same outcome in probably alot less code. Thanks again mate.