Home   Help Search Login Register  

Author Topic: Marker follow a unit  (Read 1165 times)

0 Members and 1 Guest are viewing this topic.

Offline Adam David

  • Members
  • *
Marker follow a unit
« 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?

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Marker follow a unit
« Reply #1 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.

"When 900 years YOU reach, look as good you will not!"

Offline sharkattack

  • Former Staff
  • ****
Re: Marker follow a unit
« Reply #2 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"
"HOLY SARDINE" - see Shark-Attack meet his match