OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: cutter on 03 Oct 2009, 14:00:54
-
Thing is, i have a mission, blufor need to escort a rockstar to airport, opfor needs to eliminate him, the whole Chernarus is in use, so what i need is a small script to located the position of the rockstart everu 5 min or so, and report that to opfor, otherwise it will be to difficult for opfor to find him.
To be noted, i am noob with scripting :confused:
-
<rockstarname> is whatever you put in name field of unit.
Add this to the end of init.sqf:
sleep 1;
if(side player == east) then {rockstarname execVM "tracker.sqf"};
if(isServer && isDedicated) exitWith {};
private ["_unit","_marker"];
_unit = _this;
_marker = createMarkerLocal [format ["%1marker", _unit], getPos _unit];
_marker setMarkerTypeLocal "mil_unknown";
_marker setMarkerColorLocal "ColorBlack";
_marker setMarkerTextLocal "Last Known Pos";
while {alive _unit} do {
_marker setMarkerPosLocal (getPos _unit);
sleep 300; //5 minutes
};
In your tasks code, you can use:
<marker name='rockstarnamemarker'>rockstarname</marker>
-
I greatly appriciate this, thanks alot mate. :good:
UPDATE.
I tryed it and it almost work :) , but its not updating, it puts the marker right at the start and thats fine, but thats it, it isnt updating or anything, and i did exactly as writte above.
-
OK, I made two mistakes:
This needs two equal signs:
if(side player == east) then {rockstarname execVM "tracker.sqf"};
Needs isDedicated to support player hosting:
if(isServer && isDedicated) exitWith {};
It works for me now, changes are made above as well.
Also, interval is set to 5 minutes. Change sleep <seconds>; in tracker.sqf to make it shorter.
-
I love you man :)