Jump to content
Sign in to follow this  
coolfact

AI distribution script problems [HC]

Recommended Posts

I'm trying to play around with the new "setGroupOwner" command, have taken Mons00n's "MoveToHC" script in his HC guide. I can transfer groups to HC just fine, but when I want the the FPS from the HC (called in fnc_sim) I get "ANY", indicating that it's not running as intended. Another problem I keep bumping into is when the HC DC and reconnect to the server (retaking the HC spot and join the mission) the script would not allocate the AI like it did before DC. Any help or pointers would be appreciated.

HC_init.sqf:

/*
* Purpose: Move a groups to the headless client
*          AFTER the mission launches
*
* Mission: Arma3 Headless Client Tutorial
*  Author: Monsoon
*   Email: rweezera@hotmail.com
*
*  edited: Coolfact
*
*/

if(!isServer) exitWith{};      //only execute on the server
if(!isMultiplayer) exitWith{}; //only execute in a MP environment

fnc_sim = {
_grp = _this select 0;
{
	_x enableSimulation false;
} foreach units _grp;
VAR_FPS_HC = diag_fps;
publicvariableserver "VAR_FPS_HC";
};
_HC = HC1;
_HCid = owner _HC;
_grps = [];
VAR_FPS_HC = 50;

if(isNull _HC) exitwith{}; // If HC not available exit

// Main AI Distributor
while {true} do {
{
	_grp = _x;
	if(VAR_FPS_HC < 30) then { // Don't transfer if HC FPS are lower than 30
		if(_grp setGroupOwner _HCid) then{
			_grps = _grps + [_grp];
			[[_grp],"fnc_sim",_HCid] call BIS_fnc_MP; // Disable PhysX and get HC FPS
		} else {
			_grps = _grps - [_grp];
		};
	};
	sleep 2;
} foreach allgroups;
diag_log format["HC: Successfully transfered %1 groups to (id:%3) with FPS: %2",count _grps,VAR_FPS_HC,_HCid];
sleep 10;
};
diag_log format["HC: Headless client NOT present, keeping %1 on the server.",_HCid];

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  

×