OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started 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?
-
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:
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.
-
i use this script by sickboy pretty easy to use .. :)
/////////////////////////////////////////////////////////////
// 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
x = [unitsname] execVM "markers.sqf"