OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Adam David on 23 Feb 2008, 07:45:05

Title: Marker follow a unit
Post by: Adam David on 23 Feb 2008, 07:45:05
Hey people, I was looking around, and I didn't find anything related to "Marker follow a unit", so here comes my question: How?
Title: Re: Marker follow a unit
Post by: Wolfrug on 23 Feb 2008, 08:04:15
This is actually not particularly hard, although it does require a script of sorts. Here's how to do it the quick and nasty way:

First, create the unit you want followed and name it something (say t1), then create a marker and name it something (say "t1marker"). Create a trigger, make it activated by whatever you want (true if it's to be activated right away) and then write this in the On Activation field:

Code: [Select]
T1MarkerFollow = [] spawn {while {alive t1} do {"t1marker" setMarkerPos t1; sleep 0.5;}}
That will make "t1marker" move with the unit named t1 every half a second. If you want it to be smoother, make the sleep smaller. :)

If you want some of the commands etc. explained, we're here for you!

Wolfrug out.

Title: Re: Marker follow a unit
Post by: sharkattack on 23 Feb 2008, 13:38:32
i use this script by sickboy  pretty easy to use .. :)

Code: [Select]
/////////////////////////////////////////////////////////////
// ArmA - Marker Script - By Sickboy
/////////////////////////////////////////////////////////////

// Set local variables
private ["_obj","_marker"];

// Get Object
_obj = _this select 0;

/////////////////////////////////////////////////////////////

_marker = format["%1",group _obj];

// Create marker and set marker shape, type, size and text
createMarkerLocal [_marker, position _obj];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "destroy";
_marker setMarkerSizeLocal [.3,.3];
_marker setMarkerTextLocal _marker;

// If object alive loop position
while {alive _obj} do
{
   sleep 1;
   _marker setmarkerposLocal position _obj;
};
deletemarkerLocal _marker;

execute the script with

Code: [Select]
x = [unitsname] execVM "markers.sqf"