OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: SniperUK on 01 Jul 2007, 13:21:50

Title: Detecting when a given position has been reached.
Post by: SniperUK 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;
Title: Re: Detecting when a given position has been reached.
Post by: LCD 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
Title: Re: Detecting when a given position has been reached.
Post by: SniperUK 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.