Jump to content
Sign in to follow this  
darkbob12

script to record metadata of the units

Recommended Posts

Hey all,

 

  i'm new to scripting in arma, so i apologize if my question is stupid.So

 

I want to write a script that as i play it records the location, rotation, ect of everyone. Basically collect everyone metadata per time.  I also wish to output this information ( from what i read online saving data as txt files is a pain?)

 

My question is: is this possible? how would i go about writing a simple script that just collects the unit metadata. (in their wiki, they have commands to pull metadata, so basically run that command to all the units and save that somewhere)

 

thanks alot. 

Share this post


Link to post
Share on other sites

Depends on what exactly you want,
if you simply want to track movement and direction something like this might do the trick:

tGA4RDp.jpg

Spoiler

 


//GOM_fnc_GPSTracker.sqf
//by Grumpy Old Man
//V0.9
//put into object init field

_nul = [this] spawn {
params ["_car"];

_check = _car getvariable ["GOM_fnc_GPSTracker",true];
_counter = 0;
_markers = [];
_markerTimes = [];

while {alive _car} do {

		_lastmarkerpos = _car getvariable ["GOM_fnc_lastmarker",[0,0,0]];

		if (getposATL _car distancesqr _lastmarkerpos > 5^2) then {
		_markertype = "";

		_text = format ["%1: %2km/h.",[((daytime)),"HH:MM"] call bis_fnc_timetostring,round speed _car];
		_car setvariable ["GOM_fnc_lastmarker",getposATL _car,true];
		_markertype = "hd_arrow";
		_marker = createMarker [str time,getPosATLVisual _car];
		_marker setMarkerShape "ICON";
		_marker setMarkerSize [1,1];
		_marker setMarkerType "hd_arrow";
		_marker setMarkerAlpha 1;
		_marker setMarkerColor "ColorCiv";
		_marker setMarkerDir getdir _car;

		if (_counter isEqualTo 10) then {_counter = 0};
		if !(_counter isequalto 0) then {_text = ""};

		_counter = _counter + 1;
		_marker setmarkertext _text;
		_markers pushback _marker;
		_markerTimes pushback time;

	};

	{

		_index = _markerTimes find _x;

		if (time - _x > 300) then {

			_marker = _markers select _index;
			deleteMarkerLocal _marker;
			_markers deleteAt _index;
			_markerTimes deleteAT _index;

		};


	} foreach _markerTimes;

	_sleep = time + 2;

	waituntil {time > _sleep};

};
true
};

 

 

 

 

Made primarily for vehicles but works for individual units just fine.

Can easily be modified to store the information to arrays etc.

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×