Home   Help Search Login Register  

Author Topic: Attatch marker to Unit/Vehicle/object  (Read 1808 times)

0 Members and 1 Guest are viewing this topic.

Offline stephen271276

  • Members
  • *
Attatch marker to Unit/Vehicle/object
« on: 31 Jan 2011, 21:53:17 »
Is there a simple way to attatch a marker that will move round the map with the item its attatched to so it can be tracked by the player via the map?
NOTE:
Am really crap at scripting hence asking for a simple way or script??

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Attatch marker to Unit/Vehicle/object
« Reply #1 on: 31 Jan 2011, 22:19:20 »
You can use endless loop or change the "true" to something else e.g. (alive itemname).

ScriptName.sqf:
Code: [Select]
while {true} do {sleep 0.05; "MarkerName" setmarkerpos (position itemname);};
In a Trigger (condition true):
Code: [Select]
_nul = [] execVM "ScriptName.sqf";

Offline stephen271276

  • Members
  • *
Re: Attatch marker to Unit/Vehicle/object
« Reply #2 on: 31 Jan 2011, 22:43:43 »
"Markername"
Is this specifying the type of marker or is it just the name Im to give it?

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Attatch marker to Unit/Vehicle/object
« Reply #3 on: 31 Jan 2011, 22:49:11 »
Thats the name you give to the marker. You can write e.g. Mname1 to the name field when creating marker and then use the loop like this:
Code: [Select]
while {true} do {sleep 0.05; "Mname1" setmarkerpos (position itemname);};
In the same way the script name can be anything, just with the sqf end (or sqs but then execVM needs to be just exec).

Edit: And if you have many markers, you dont need to make a separate script for every marker. Just change the script to look like this:
Code: [Select]
_m = _this select 0;
_i = _this select 1;
while {true} do {sleep 0.05; _m setmarkerpos (position _i);};

And use the script like this:
Code: [Select]
_nul = ["Mname1",itemname] execVM "ScriptName.sqf";
_nul = ["Mname2",player] execVM "ScriptName.sqf";

Or just add more markers to move to the loop:
Code: [Select]
while {true} do {sleep 0.05;
"Mname1" setmarkerpos (position itemname);
"Mname2" setmarkerpos (position player);};
« Last Edit: 31 Jan 2011, 22:56:20 by SaOk »

Offline stephen271276

  • Members
  • *
Re: Attatch marker to Unit/Vehicle/object
« Reply #4 on: 01 Feb 2011, 09:48:57 »
GREAT!
Works a treat, thanks man!