Jump to content

Recommended Posts

Hi folks!

​Loosing a firefight sucks, especially because of major mistakes concerning tactics or securing your buddies.

​So i wondered if there is a possibility to
-record the movement (and viewdirection) of all units (Players + AI) no matter if and when they spawn
-rewatch the whole mission on the 2D-map with the whole Team (to discuss what has to be improved)
-in a rather ressource-friendly way

​As far as I know, "UnitCapture" can only be used with one unit over a specific time?

Thanks!
​

Share this post


Link to post
Share on other sites

I think that's fairly easy to do. You could just record the positions and directions of all units for every second like this:

record = [];

while {true} do
{
_frame = [];
{
_frame pushback ([_x, getpos _x, getdir _x]);
} foreach allunits;

record pushback _frame;

sleep 1;
};

then you just do foreach loop at record and create markers and set their directions to play it back.

  • Like 1

Share this post


Link to post
Share on other sites

This was extremely fun to write. This code will give you a frame-by-frame analysis of every unit on the map. It gives position, animation, weapons, and their direction.

DE_missionUnitInfo = [];

["DE_unitTracker", "onEachFrame",
{
	_frame = [diag_frameNo];
	{
		if (isNil {_x getVariable "DE_trackerName"}) then
		{
			_x setVariable ["DE_trackerName", _x call BIS_fnc_objectVar];
		};
		_frame pushBack [_x getVariable "DE_trackerName", name _x, typeOf _x, getPosASL _x, animationState _x, weapons _x, [vectorDir _x, vectorUp _x]];
	} forEach allUnits;
}] call BIS_fnc_addStackedEventHandler;

Be sure at the end of the mission that this code runs

//this is pseudocode
if (MISSION_END) then
{
	profileNamespace setVariable ["DE_lastMissionInfo", DE_missionUnitInfo];
}; 

This code then (should) fully recall every unit at the exact frame when it was recorded.

{
	while (diag_frameNo < (_x select 0)) do {};
	{
		_temp = createVehicle [_x select 2, _x select 3, [], 0, "CAN_COLLIDE"];
		_temp setPosASL (_x select 3);
		_temp setVectorDirAndUp (_x select 6);
		removeAllWeapons _temp;
		{
			_temp addWeapon _x;
		} forEach (_x select 5);
		_temp switchMove (_x select 4);
		
	} forEach (_x select [1, (count _x) - 2]);
} forEach (profileNamespace getVariable "DE_lastMissionInfo");

I had many ideas and a lot has been trimmed, but I haven't written a script in a long time so I need some time to get back into it. Be warned that all of this should be executed on the server only. It will probably be very intensive on the server too.

  • Like 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

×