Jump to content
champ-1

CH Mobile Headquarters

Recommended Posts

Champ-1,

this script is brilliant, I love it. Quick question, I tried to add an SDV, added the class list with [] for the composition and it won't take it. You get the Deploy MHQ near land, but not when at depth or away from shore, would be nice but not essential if there was a fix.

Anyway, in our mission pack we're using Marids as MHQs, below is the composition we used for it, might be useful for someone.

	case (toLower "O_APC_Wheeled_02_rcws_F") : {
	_composition = [["CamoNet_INDP_big_Curator_F",[-2.18277,-0.473415,0.000566483],-359.981],["ModuleChemlightRed_F",[-1.36815,-2.9854,0.000566483],-359.981],["Land_Razorwire_F",[2.78963,1.75545,0.000566483],-99.2007],["Land_BarrelWater_F",[-0.666675,3.9968,0.000624657],-0.864716],["Land_BarrelWater_F",[0.0409352,4.27831,0.000624657],-0.875946],["O_CargoNet_01_ammo_F",[-2.27552,4.11548,0.000566006],-59.435],["Land_BarrelWater_F",[-0.592652,4.90351,0.000624657],-0.865234],["Land_BagFence_Long_F",[3.59061,-3.66229,0.000566483],-263.536],["ModuleChemlightRed_F",[-4.98858,2.10122,0.000566483],-359.981],["O_CargoNet_01_ammo_F",[-4.58421,3.83107,0.000566483],-339.013],["Land_Razorwire_F",[-0.57078,6.09882,0.000566483],-359.981],["Land_BagFence_Round_F",[2.33203,-6.04226,0.000566483],-20.0836],["Land_CampingChair_V1_F",[-5.15567,-4.23808,0.00369167],-258.723],["Land_CampingTable_F",[-6.01811,-4.65186,0.000565052],-119.639],["Land_CampingChair_V1_F",[-5.30711,-5.96654,0.00368977],-218.204],["FlexibleTank_01_forest_F",[-8.02475,0.478183,0.000669003],-359.887],["Land_MetalCase_01_large_F",[-8.23797,-0.551533,0.000566959],0.00421143],["Land_GasTank_01_blue_F",[-8.20019,-1.50711,0.000607967],-0.551971],["B_GMG_01_high_F",[-3.72459,-7.48854,-0.0112429],-245.001],["Land_Razorwire_F",[-7.88963,3.08117,0.000566483],-232.341],["Land_BagFence_Long_F",[-3.73847,-8.12623,0.000566483],-359.086],["Land_BagFence_Long_F",[-7.8955,-4.49842,0.000566483],-307.93],["Land_BagFence_Long_F",[-6.09499,-6.83445,0.000566483],-312.22],["Land_BagFence_Long_F",[-9.6531,-2.35283,0.00156641],-307.93]];
	_cargoInfo = ["Land_Ammobox_rounds_F",[0,-1.2,0],0];
	[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;

};
	};

Nice job, and thanks.

Share this post


Link to post
Share on other sites

Command that checks for for empty and flat ground doesn't allow water nearby. So yeah, I guess it doesn't work with naval vehicles. I lied.

Share this post


Link to post
Share on other sites

I see this script still works but does anyone have a working function code to be able to grab the layout of a custom fob?

 

This function only grabs on or two items now.

 

CHHQ_fnc_getComposition = {

_radius = _this select 0;

_veh = if (vehicle player isEqualTo player) then {objNull} else {vehicle player};

if (isNull _veh) exitWith {systemChat "You need to be inside the vehicle to grab object composition around it."};



_objArray = [];

_vehPos = getPosASL _veh;

_vehDir = getDir _veh;

{

if (_x != _veh && !(_x isKindOf "Man")) then {

_pos = getPosASL _x;

_dir = getDir _x;

_type = typeOf _x;

_offset = [

(_vehPos select 0) - (_pos select 0),

(_vehPos select 1) - (_pos select 1),

(_pos select 2) - (_vehPos select 2)

];

_diroffset = _dir - _vehDir;

_objArray pushBack [_type,_offset,_diroffset];

};

} forEach nearestObjects [_veh, ["all"], _radius];

copyToClipboard str _objArray;

};



[500] call CHHQ_fnc_getComposition; // radius in meters from vehicle to grab objects

Share this post


Link to post
Share on other sites

Downloaded the 0.91 version.  Ran the example mission.  Nothing.  Has this script been obsoleted by ArmA updates?

 

Is it dedicated only, perhaps?

 

​Never mind, have to deploy HQ before seeing anything on the board.

Share this post


Link to post
Share on other sites

So I am using this script for my server and it is working great!! Thanks for this by the way.

I have one question, Is there any way to spawn a composition through the _cargoInfo variable?

Share this post


Link to post
Share on other sites

Only just came across this scrip does anyone know why when trying to add

null = [this, SIDE] execVM "CHHQ.sqf  in to the items init field i get a return of init: generic error in exception  ?

Share this post


Link to post
Share on other sites

reading the first post could help!

 

EDIT:

But I ve a helpful day so I point u to the part where usage of SIDE is described.

Edited by sarogahtyp
  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, sarogahtyp said:

reading the first post could help!

 

EDIT:

But I ve a helpful day so I point u to the part where usage of SIDE is described.

 

I guess that's what i get for trying to do things at 4 in the morning lol.  Thank you though that has no doubt saved me a few hours of scratching my head some more, I've had a few years of tweaking Arma and have somehow forgotten 90% of what i learned (the price of getting old i guess)

Share this post


Link to post
Share on other sites

Nope i must be doing something wrong  I've tried leaving it blank, West, Blufor & NATO as the side and it doesn't seem to work on any of them any ideas? I'm trying to use this on a Tanoa map

 

Please remember i am a noob so take it easy and dumb it down  :D

 

 

Placed 3 x HEMTT Transport  with

null = [this] execVM "CHHQ.sqf"

 

placed 2 x Laptops with

null = [this] execVM "CHHQ.sqf"

 

And put this in the init.sqf

CHHQ_showMarkers = true; // Set 'true' if you want real time map markers for all HQs on your side. (Default: true)

 

The script is in the root of my mission so any ideas?

Edited by jimbouk1977
to add what ive done.

Share this post


Link to post
Share on other sites

This seems to be correct if the HEMTT shall be a HQ for side west:

null = [this] execVM "CHHQ.sqf"

For ur laptos u have to use the side parameter because it's not an optional parameter.

null = [this, west] execVM "CHHQ.sqf"

 

You can delete the line in init.sqf because true is the default value of that script and doesn't need to be set.

 

I suggest u should try 1 MHQ and 1 Laptop first and if that works u add more.

 

If that all doesn't help then just post the complete CHHQ.sqf please. I'am too lazy to download it ;-)

Share this post


Link to post
Share on other sites
5 minutes ago, sarogahtyp said:

This seems to be correct if the HEMTT shall be a HQ for side west:


null = [this] execVM "CHHQ.sqf"

For ur laptos u have to use the side parameter because it's not an optional parameter.


null = [this, west] execVM "CHHQ.sqf"

 

You can delete the line in init.sqf because true is the default value of that script and doesn't need to be set.

 

I suggest u should try 1 MHQ and 1 Laptop first and if that works u add more.

 

If that all doesn't help then just post the complete CHHQ.sqf please. I'am too lazy to download it ;-)

Thanks for the response I appreciate it, i will give that a go and see if it works.

Share this post


Link to post
Share on other sites

Well that didn't do the trick either :/

 

here is the SQF & once again thank you for trying to help :-)

Spoiler

CHHQ_fnc_deploy = {
	_veh = _this select 0;
	_caller = _this select 1;
	_side = _this select 3 select 0;
	_cargoInfo = _this select 3 select 1;
	_composition = _this select 3 select 2;
	_cargo = _veh getVariable ["CHHQ_cargo", objNull];
	
	if (_veh getVariable ["CHHQ_compositionRadius", -1] < 0) then {
		_sortedByDist = [_composition,[],{
			_frstNum = abs (_x select 1 select 0);
			_secNum = abs (_x select 1 select 1);
			if (_frstNum > _secNum) then {_frstNum} else {_secNum}
		},"DESCEND"] call BIS_fnc_sortBy;	
		_biggestOffset = (_sortedByDist select 0) select 1;
		_biggestOffsetAbs = if (abs (_biggestOffset select 0) > abs (_biggestOffset select 1)) then {abs (_biggestOffset select 0)} else {abs (_biggestOffset select 1)};
		
		_boundingSize = [_sortedByDist select 0 select 0] call CHHQ_fnc_boundingSize;
		_radius = _biggestOffsetAbs + _boundingSize;
		
		_sortedBySize = [_composition,[],{sizeOf (_x select 0)},"DESCEND"] call BIS_fnc_sortBy;
		_boundingSize = [_sortedBySize select 0 select 0] call CHHQ_fnc_boundingSize;	
		
		if (_boundingSize > _radius) then {
			_radius = _boundingSize;
		};
		_veh setVariable ["CHHQ_compositionRadius", _radius, true];
	};
	_radius = _veh getVariable ["CHHQ_compositionRadius", -1];
	
	_flatPos = (getPosASL _veh) isFlatEmpty [
		_radius,	//--- Minimal distance from another object
		0,				//--- If 0, just check position. If >0, select new one
		0.4,			//--- Max gradient
		_radius max 5,	//--- Gradient area
		0,				//--- 0 for restricted water, 2 for required water,
		false,			//--- Has to have shore nearby!
		objNull			//--- Ignored object
	];
	
	if (count _flatPos isEqualTo 0) exitWith {systemChat format ["You can't deploy HQ here! Find a flat position without any objects nearby (%1m).", round _radius]};
	if (_veh getVariable ["CHHQ_inProgress", false]) exitWith {};
	
	_veh setVariable ["CHHQ_inProgress", true, true];
	
	[[_veh], "CHHQ_fnc_removeAction", _side] call BIS_fnc_MP;
	_nearestPlayers = [];
	{
		if (isPlayer _x && _x distance _veh < 25) then {
			_nearestPlayers pushBack _x
		};
	} forEach (playableUnits + switchableUnits);
	[["CHHQ_deployBlackout"],"BIS_fnc_blackOut",_nearestPlayers,false,true] call BIS_fnc_MP;
	[["DEPLOYING HQ"],"BIS_fnc_dynamicText",_nearestPlayers] call BIS_fnc_MP;
	sleep 3;	
	{moveOut _x} forEach crew _veh;
	{_x allowDamage false; _x enableSimulationGlobal false} forEach _nearestPlayers;
	
	deleteVehicle _cargo;
	
	_veh enableSimulationGlobal false;
	_veh allowDamage false;
	
	[[_veh, _side, "HQ"],"CHHQ_fnc_drawMarker",_side] call BIS_fnc_MP;
	_objArray = [];
	{
		_type = _x select 0;
		_offset = _x select 1;
		_newdir = _x select 2;
		_code = [_x, 3, "", ["", {}]] call BIS_fnc_param;
		
		_obj = createVehicle [_type, [0,0,0], [], 0, "CAN_COLLIDE"];
		_obj allowDamage false;
		[_veh,_obj,_offset,_newdir, true, true] call BIS_fnc_relPosObject;
		_objArray pushBack _obj;
		
		if !(_code isEqualTo "") then {
			_code = [_code] call CHHQ_fnc_compileCode;
			[[[_obj,_veh], _code],"BIS_fnc_spawn",true] call BIS_fnc_MP;
		};
	} forEach _composition;
	
	/*
	_grp = createGroup _side;
	_unitType = switch _side do {
		case east: {"O_soldier_F"};
		case west: {"B_soldier_F"};
		case resistance: {"I_soldier_F"};
		default {"C_man_1"};
	};
	_unit = _grp createUnit [_unitType, [0,0,0], [], 0, "NONE"];
	[[_unit,{hideObject _this}],"BIS_fnc_spawn",true] call BIS_fnc_MP;
	_unit moveInCargo _veh;
	_veh setPilotLight false;
	_veh setCollisionLight false;
	_veh engineOn false;
	_grp setBehaviour "CARELESS";
	{_unit disableAI _x} forEach ["MOVE","TARGET","AUTOTARGET","ANIM","FSM"];
	_objArray pushBack _unit;
	*/
	
	[[_veh, 2],"lock",true] call BIS_fnc_MP;
		
	_veh enableSimulationGlobal true;
	_veh allowDamage true;
	{_x allowDamage true} forEach _objArray;	
	{_x setPos ((getPosASL _x) findEmptyPosition [0, 25, "CAManBase"]); _x allowDamage true; _x enableSimulationGlobal true} forEach _nearestPlayers;
	
	sleep 3;
	[["CHHQ_deployBlackout"],"BIS_fnc_blackIn",_nearestPlayers,false,true] call BIS_fnc_MP;
	[[_veh, ["Undeploy HQ", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]], "CHHQ_fnc_addAction", _side] call BIS_fnc_MP;
	[["RespawnAdded",["DEPLOYMENT POINT",format ["HQ deployed at grid %1", mapGridPosition (getPos _veh)],"\A3\ui_f\data\map\markers\nato\b_hq.paa"]],"BIS_fnc_showNotification",_side] call BIS_fnc_MP;

	_veh setVariable ["CHHQ_inProgress", false, true];
	_veh setVariable ["CHHQ_deployed", true, true];
	_veh setVariable ["CHHQ_objArray", _objArray, true];
	[[_veh], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;
};
CHHQ_fnc_undeploy = {
	_veh = _this select 0;
	_caller = _this select 1;
	_side = _this select 3 select 0;
	_cargoInfo = _this select 3 select 1;
	_cargoType = _cargoInfo select 0;
	_cargoOffset = _cargoInfo select 1;
	_cargoDir = _cargoInfo select 2;
	_cargoCode = [_cargoInfo, 3, "", ["", {}]] call BIS_fnc_param;
	_composition = _this select 3 select 2;
	
	if (_veh getVariable ["CHHQ_inProgress", false]) exitWith {};	
	_veh setVariable ["CHHQ_inProgress", true, true];
	
	[[_veh], "CHHQ_fnc_removeAction", _side] call BIS_fnc_MP;
	
	_nearestPlayers = [];
	{
		if (isPlayer _x && _x distance _veh < 25) then {
			_nearestPlayers pushBack _x
		};
	} forEach (playableUnits + switchableUnits);
	[["CHHQ_deployBlackout"],"BIS_fnc_blackOut",_nearestPlayers,false,true] call BIS_fnc_MP;
	[["UNDEPLOYING HQ"],"BIS_fnc_dynamicText",_nearestPlayers] call BIS_fnc_MP;
	sleep 3;
	{_x allowDamage false; _x enableSimulationGlobal false} forEach _nearestPlayers;	
	
	{deleteVehicle _x} forEach (_veh getVariable ["CHHQ_objArray", []]);
	_veh setVariable ["CHHQ_deployed", false, true];	
	
	[[_veh, _side, "MHQ"],"CHHQ_fnc_drawMarker",_side] call BIS_fnc_MP;	
	[[_veh, false],"lock",true] call BIS_fnc_MP;	
	[[_veh, true],"lockCargo",true] call BIS_fnc_MP;
	[[_veh, [0,false]],"lockCargo",true] call BIS_fnc_MP;
	
	_cargo = createVehicle [_cargoType, [0,0,0], [], 0, "CAN_COLLIDE"];		
	_cargo attachTo [_veh, _cargoOffset]; 
					
	_veh setPos (getPos _veh);
	_veh setDir (getDir _veh);
	_cargo setDir _cargoDir;	
	_veh setVariable ["CHHQ_cargo", _cargo, true];
			
	if !(_cargoCode isEqualTo "") then {
		_cargoCode = [_cargoCode] call CHHQ_fnc_compileCode;
		[[[_cargo,_veh], _cargoCode],"BIS_fnc_spawn",true] call BIS_fnc_MP;
	};
	
	sleep 3;	
	_veh enableSimulationGlobal true;
	_veh allowDamage true;
	{_x setPos ((getPosASL _x) findEmptyPosition [0, 25, "CAManBase"]); _x allowDamage true; _x enableSimulationGlobal true} forEach _nearestPlayers;
	[["CHHQ_deployBlackout"],"BIS_fnc_blackIn",_nearestPlayers,false,true] call BIS_fnc_MP;
	[[_veh,["Deploy HQ", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]], "CHHQ_fnc_addAction", _side] call BIS_fnc_MP;
	
	_veh setVariable ["CHHQ_inProgress", false, true];
	[[_veh, "cargo"], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;
};
CHHQ_fnc_boundingSize = {
	_type = _this select 0;
	_bbdummy = _type createVehicleLocal [0,0,0];
	_boundingBox = (boundingBox _bbdummy) select 1;
	deleteVehicle _bbdummy;
	_boundingSize = if (_boundingBox select 0 > _boundingBox select 1) then {_boundingBox select 0} else {_boundingBox select 1};
	_boundingSize
};
CHHQ_fnc_compileCode = {
	_code = [_this, 0, "", ["", {}]] call BIS_fnc_param;
	
	if (toLower typeName _code == "code") then {
		_array = toArray str _code;
		_array deleteAt 0;
		_array deleteAt count _array - 1;
		_code = toString _array;
	};
	if !(_code isEqualTo "") then {
		_prefix = "_target = _this select 1; _this = _this select 0; ";
		_code = _prefix + _code;
	};
	compile _code
};
CHHQ_fnc_deleteVehicleEH = {
	_veh = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
	_type = [_this, 1, "", [""]] call BIS_fnc_param;
	_objArray = _veh getVariable ["CHHQ_objArray", []];
	_cargo = _veh getVariable ["CHHQ_cargo", objNull];
		
	waitUntil {isNull _veh};
	if (_type isEqualTo "cargo") then {
		deleteVehicle _cargo;
	} else {
		{deleteVehicle _x} forEach _objArray;
	};
};
CHHQ_fnc_arrayUpdateEH = {
	_array = _this select 0;
	_code = _this select 1;
	
	for "_i" from 0 to 1 step 0 do {
		_countArray = count _array;
		waitUntil {count _array != _countArray};
		call _code;
	};
};
CHHQ_fnc_drawMarker = {
	if !(CHHQ_showMarkers) exitWith {};
	private ["_color","_icon","_mrkName"];
	_veh = _this select 0;
	_side = _this select 1;
	_text = _this select 2;
	terminate (_veh getVariable ["CHHQ_drawMarkerHandle", scriptNull]);
	
	switch _side do {
		case west: {
			_color = "ColorWEST";
			_icon = "b_hq";
		};
		case east: {
			_color = "ColorEAST";
			_icon = "o_hq";
		};
		case resistance: {
			_color = "ColorGUER";
			_icon = "n_hq";
		};
		default {
			_color = "ColorUNKNOWN";
			_icon = "n_hq";
		};
	};
	
	if (_veh getVariable ["CHHQ_mrkName", ""] isEqualTo "") then {
		_veh setVariable ["CHHQ_mrkName", format ["CHHQ_%1", [str _veh] call BIS_fnc_filterString]];
	};
	_mrkName = _veh getVariable ["CHHQ_mrkName", format ["CHHQ_%1", [str _veh] call BIS_fnc_filterString]];
	
	if (getMarkerPos _mrkName isEqualTo [0,0,0]) then {
		createMarkerLocal [_mrkName, getPos _veh];
	} else {
		_mrkName setMarkerPosLocal (getPos _veh);
	};
	_mrkName setMarkerShapeLocal "ICON";
	_mrkName setMarkerTypeLocal _icon;
	//_mrkName setMarkerSizeLocal [0.7,0.7];
	_mrkName setMarkerColorLocal _color;

	_handle = [_veh, _mrkName, _text] spawn {
		_veh = _this select 0;
		_mrkName = _this select 1;
		while {alive _veh} do {
			_text = if (count CHHQ_HQarray > 1) then {format ["%1-%2", _this select 2, _veh getVariable ["CHHQ_index", -1]]} else {_this select 2};
			_mrkName setMarkerTextLocal _text;
			_mrkName setMarkerPosLocal (getPos _veh);
			sleep 1;
		};
		deleteMarkerLocal _mrkName;
	};
	_veh setVariable ["CHHQ_drawMarkerHandle", _handle];
};
CHHQ_fnc_addAction = {
	_veh = _this select 0;
	_settings = _this select 1;

	_id = _veh addAction _settings;
	_veh setVariable ["CHHQ_actionID",_id];
};
CHHQ_fnc_removeAction = {
	_obj = _this select 0;
	_obj removeAction (_obj getVariable ["CHHQ_actionID",-1]);
};
CHHQ_fnc_actionConditions = {
	_target = _this select 0;
	_caller = _this select 1;

	(speed _target isEqualTo 0 && {alive _target} && {_caller distance _target < 8} && {vehicle _caller isEqualTo _caller})
};
CHHQ_fnc_teleportActionConditions = {
	_target = _this select 0;
	_caller = _this select 1;
	_veh = _this select 2;

	(_veh getVariable ["CHHQ_deployed", false] && {!isNil "_veh"} && {alive _veh} && {_caller distance _target < 8} && {vehicle _caller isEqualTo _caller})	
};
CHHQ_fnc_teleportToHQ = {
	_obj = _this select 0;
	_caller = _this select 1;
	_veh = _this select 3 select 0;
	
	["CH_teleportToHQblackout"] call BIS_fnc_blackOut;
	sleep 3;
	_caller setPos ((getPosASL _veh) findEmptyPosition [0, 25, "CAManBase"]);	
	["CH_teleportToHQblackout"] call BIS_fnc_blackIn;
	[] call CHHQ_fnc_BISshowOSD;
};
CHHQ_fnc_BISshowOSD = {
	/*
		Author: Jiri Wainar

		Description:
		Display OSD with location, time and possibly some other campaign related info.

		Parameter(s):
		_this select 0: array (optional)	- position (default: player's position)
		_this select 1: array (optional)	- date in format [_year,_month,_day,_hour,_min] (default: current date)

		Example:
		[] call BIS_fnc_camp_showOSD;

		Returns:
		- nothing -
	*/

	if (missionNamespace getVariable ["BIS_fnc_camp_showOSD__running",false]) exitWith {};

	BIS_fnc_camp_showOSD__running = true;

	private["_fn_getSector"];

	_fn_getSector =
	{
		private["_map","_posX","_posY","_gridX","_gridY","_secWidth","_secHeight"];
		private["_bottomLeftX","_bottomLeftY","_topRightX","_topRightY"];

		_map = toLower worldName;

		if !(_map in ["altis","stratis"]) exitWith
		{
			-1
		};

		if (_map == "stratis") then
		{
			_bottomLeftX = 1302;
			_bottomLeftY = 230;
			_topRightX   = 6825;
			_topRightY   = 7810;
		}
		else
		{
			_bottomLeftX = 1765;
			_bottomLeftY = 4639;
			_topRightX   = 28624;
			_topRightY   = 26008;
		};

		_posX = _this select 0;
		_posY = _this select 1;

		//check if player is outside the map grid
		if !(_posX > _bottomLeftX && _posX < _topRightX && _posY > _bottomLeftY && _posY < _topRightY) exitWith
		{
			0
		};

		//offset player pos to [0,0]
		_posX      = _posX - _bottomLeftX;
		_posY      = _posY - _bottomLeftY;

		_secWidth  = (_topRightX - _bottomLeftX)/3;
		_secHeight = (_topRightY - _bottomLeftY)/3;

		_gridX = floor (_posX/_secWidth);
		_gridY = floor (_posY/_secHeight);

		((_gridY * 3) + _gridX + 1)
	};


	private["_position","_date","_output","_showDate","_showLocation","_showMap"];
	private["_tLoc","_tMap","_tDate","_tTime","_tTimeH","_tTimeM","_tDay","_tMonth","_tYear"];

	_showDate 	= true;


	_position  	= [_this, 0, getPos player, [[]]] call BIS_fnc_param;
	_date 	   	= [_this, 1, date, [[]]] call BIS_fnc_param;
	_tMap		= [_this, 2, "auto", [""]] call BIS_fnc_param;
	_tLoc		= [_this, 3, "auto", [""]] call BIS_fnc_param;

	//safecheck _date to make sure no values are out of boundries
	_date = _date call BIS_fnc_fixDate;

	if (_tMap != "") then
	{
		_showMap = true;
	}
	else
	{
		_showMap = false;
	};

	if (_tLoc != "") then
	{
		_showLocation = true;
	}
	else
	{
		_showLocation = false;
	};

	//get map text
	if (_showMap && _tMap == "auto") then
	{
		private["_sector","_map","_template"];

		_sector = _position call _fn_getSector;

		if (_sector == -1) then
		{
			["Map not recognized! Only 'Altis' and 'Stratis' are supported."] call BIS_fnc_error;

			_showMap 	= false;
			_showLocation 	= false;
		};

		_map = gettext (configfile >> "cfgworlds" >> worldname >> "description");

		_template = switch (_sector) do
		{
			case 7: {localize "STR_A3_SectorNorthWest"};
			case 8: {localize "STR_A3_SectorNorth"};
			case 9: {localize "STR_A3_SectorNorthEast"};
			case 4: {localize "STR_A3_SectorWest"};
			case 5: {localize "STR_A3_SectorCentral"};
			case 6: {localize "STR_A3_SectorEast"};
			case 1: {localize "STR_A3_SectorSouthWest"};
			case 2: {localize "STR_A3_SectorSouth"};
			case 3: {localize "STR_A3_SectorSouthEast"};

			default
			{
				_showLocation = false;

				//hardcoded for Stratis and Altis only
				if (worldname == "Stratis") then
				{
					localize "STR_A3_NearStratis"
				}
				else
				{
					localize "STR_A3_NearAltis"
				};
			};
		};

		_tMap = format[_template,_map];
	};

	//get current location text
	if (_showLocation && _tLoc == "auto") then
	{
		private["_locations","_loc"];

		_locations = nearestLocations [getPos player, ["NameCity","NameCityCapital","NameLocal","NameMarine","NameVillage"], 500];

		//filter-out locations without names
		{
			if (text _x == "") then
			{
				locations set [_forEachIndex, objNull];
			};
		}
		forEach _locations; _locations = _locations - [objNull];

		if (count _locations > 0) then
		{
			_loc = _locations select 0;

			if ((getPos player) in _loc) then
			{
				_tLoc  = text _loc;
			}
			else
			{
				_tLoc = format[localize "STR_A3_NearLocation", text _loc];		//tolocalize: "Pobl? lokace %1"
			};
		}
		else
		{
			_tLoc = "";
			_showLocation = false;
		};
	};

	//get daytime data
	_tYear 	= _date select 0;
	_tMonth = _date select 1;
	_tDay 	= _date select 2;

	if (_tMonth < 10) then {_tMonth = format["0%1",_tMonth]};
	if (_tDay < 10) then {_tDay = format["0%1",_tDay]};

	//get date text
	_tDate = format["%1-%2-%3 ",_tYear,_tMonth,_tDay];

	//get time text
	_tTimeH = _date select 3;
	_tTimeM = _date select 4;

	if (_tTimeH < 10) then {_tTimeH = format["0%1",_tTimeH]};
	if (_tTimeM < 10) then {_tTimeM = format["0%1",_tTimeM]};

	_tTime = format["%1:%2",_tTimeH,_tTimeM];

	/*
	A3 fonts:

	PuristaLight
	PuristaMedium
	PuristaSemiBold
	PuristaBold
	*/


	//sum the output params & print it
	_output =
	[
		[_tDate,""],
		[_tTime,"font='PuristaMedium'"],["","<br/>"]
	];

	if (_showLocation) then
	{
		_output = _output + [[toUpper _tLoc,""],["","<br/>"]];
	};

	if (_showMap) then
	{
		_output = _output + [[_tMap,""],["","<br/>"]];
	};

	private["_handle"];

	//vertically align to cinematic border
	_handle = [_output,safezoneX - 0.01,safeZoneY + (1 - 0.125) * safeZoneH,true,"<t align='right' size='1.0' font='PuristaLight'>%1</t>"] spawn BIS_fnc_typeText2;

	waitUntil
	{
		scriptDone _handle;
	};

	BIS_fnc_camp_showOSD__running = false;
};
CHHQ_fnc_startingSetup = {
	private ["_cargo"];
	_veh = _this select 0;
	_side = _this select 1;
	_cargoInfo = _this select 2;
	_cargoType = _cargoInfo select 0;
	_cargoOffset = _cargoInfo select 1;
	_cargoDir = _cargoInfo select 2;
	_cargoCode = [_cargoInfo, 3, "", ["", {}]] call BIS_fnc_param;
	_composition = _this select 3;
		
	if (_veh getVariable ["CHHQ_deployed",false]) then {
		_veh lock 2;
		
		if (playerSide isEqualTo _side) then {		
			{
				_obj = (_veh getVariable ["CHHQ_objArray", []]) select _forEachIndex;
				_code = [_x, 3, "", ["", {}]] call BIS_fnc_param;
			
				if !(_code isEqualTo "") then {
					_code = [_code] call CHHQ_fnc_compileCode;
					[_obj, _veh] spawn _code;
				};
			} forEach _composition;
			
			[_veh, _side, "HQ"] call CHHQ_fnc_drawMarker;
			
			if (isNil "CHHQ_HQarray") then {
				CHHQ_HQarray = [];
			};
			CHHQ_HQarray pushBack _veh;
			if (_veh getVariable ["CHHQ_index", -1] < 0) then {
				_veh setVariable ["CHHQ_index", (CHHQ_HQarray find _veh) + 1, true];
			};
			
			_id = _veh addAction ["Undeploy HQ", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"];
			_veh setVariable ["CHHQ_actionID",_id];
		};
	} else {
		_veh lock false;
		_veh lockCargo true;	
		_veh lockCargo [0, false];
		if (isServer) then {
			_cargo = createVehicle [_cargoType, [0,0,0], [], 0, "NONE"];	
			{_x enableSimulation true} forEach [_veh, _cargo];
			_cargo attachTo [_veh, _cargoOffset];
					
			_veh setPos (getPos _veh);
			_veh setDir (getDir _veh);
			_cargo setDir _cargoDir;
			_veh setVariable ["CHHQ_cargo", _cargo, true];
		};
		_cargo = _veh getVariable ["CHHQ_cargo", objNull];
		
		if (playerSide isEqualTo _side) then {
			[_veh, _side, "MHQ"] call CHHQ_fnc_drawMarker;
			
			if (isNil "CHHQ_HQarray") then {
				CHHQ_HQarray = [];
			};
			CHHQ_HQarray pushBack _veh;
			if (_veh getVariable ["CHHQ_index", -1] < 0) then {
				_veh setVariable ["CHHQ_index", (CHHQ_HQarray find _veh) + 1, true];
			};
			
			_id = _veh addAction ["Deploy HQ", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"];	
			_veh setVariable ["CHHQ_actionID",_id];	

			[[_veh, "cargo"], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;	

			if !(_cargoCode isEqualTo "") then {
				_cargoCode = [_cargoCode] call CHHQ_fnc_compileCode;
				[_cargo, _veh] spawn _cargoCode;
			};			
		};
	};
};
CHHQ_fnc_updateTeleportActions = {
	_obj = _this select 0;
	
	{
		_obj removeAction _x;
	} forEach (_obj getVariable ["CHHQ_actionIDarray",[]]);
	
	_actionIDarray = [];
	{
		_vehString = "CHHQ_HQarray select " + str _forEachIndex;
		_actionText = if (count CHHQ_HQarray > 1) then {format ["Move to HQ-%1", _x getVariable ["CHHQ_index", -1]]} else {"Move to HQ"};
		_id = _obj addAction [_actionText, "_this spawn CHHQ_fnc_teleportToHQ", [_x], 6, true, true, "", format ["[_target, _this, %1] call CHHQ_fnc_teleportActionConditions", _vehString]];
		_actionIDarray pushBack _id;
	} forEach CHHQ_HQarray;
	_obj setVariable ["CHHQ_actionIDarray", _actionIDarray];
};
CHHQ_fnc_clearNullFromArray = {
	[] spawn {
		waitUntil {!isNil "CHHQ_HQarray"};
		for "_i" from 0 to 1 step 0 do {
			waitUntil {{isNull _x} count CHHQ_HQarray > 0};
			CHHQ_HQarray = CHHQ_HQarray - [objNull];
		};
	};
};

waitUntil {time > 1};
_obj = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_side = [_this, 1, sideUnknown, [sideUnknown]] call BIS_fnc_param;
CHHQ_showMarkers = if (isNil "CHHQ_showMarkers") then {true} else {CHHQ_showMarkers};

if (_side isEqualTo sideUnknown && toLower typeOf _obj != toLower "MapBoard_altis_F") then {
	_sideNum = getNumber (configFile >> "CfgVehicles" >> typeOf _obj >> "side");
	_side = switch _sideNum do {
		case 0: {east};
		case 1: {west};
		case 2: {resistance};
		default {sideUnknown};
	};
};
[] call CHHQ_fnc_clearNullFromArray;
switch (toLower typeOf _obj) do {
	case (toLower "B_Truck_01_transport_F"): {
		_composition = [["Land_PowerGenerator_F",[-2.99756,2.07959,0.0971174],180.556],["CamoNet_BLUFOR_big_F",[0.013916,-0.0551758,0.0971174],337.248],["Land_ToiletBox_F",[3.71655,3.98242,0.097096],181.571],["MapBoard_altis_F",[4.04272,1.50049,0.0449162],359.984],["Land_CampingTable_F",[-3.40649,-1.95361,0.0971169],252.548],["Land_CampingChair_V1_F",[-4.34302,-1.66504,0.100242],253.27],["Land_Cargo20_grey_F",[4.11963,-0.677246,0.0971179],271.612,{_this animate ["Door_1_rot",1]; _this animate ["Door_2_rot",1]}]];
		_cargoInfo = ["Land_Cargo20_grey_F",[0.045,-2.31,1.15],270,{_this setVariable ['bis_disabled_Door_1',1]; _this setVariable ['bis_disabled_Door_2',1]}];
		[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
	};
	case (toLower "O_Truck_02_transport_F"): {
		_composition = [["CamoNet_OPFOR_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_PowerGenerator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterTank_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["Land_Cargo10_sand_F",[3.70703,-2.79932,0.0315285],274.286]];	
		_cargoInfo = ["Land_Cargo10_sand_F",[0.07,-2,0.5],270];
		[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
	};
	case (toLower "I_Truck_02_transport_F"): {
		_composition = [["CamoNet_INDP_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_PowerGenerator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterTank_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["Land_Cargo10_military_green_F",[3.70703,-2.79932,0.0315285],274.286]];	
		_cargoInfo = ["Land_Cargo10_military_green_F",[0.07,-2,0.5],270];		
		[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
	};
	case (toLower "O_Truck_03_transport_F"): {
		_composition = [["Land_PowerGenerator_F",[-2.74097,0.837891,0.0376329],182.12],["Land_CampingTable_F",[-3.02441,-2.60107,0.0376248],276.309],["Land_CampingChair_V1_F",[-4.10986,-2.13037,0.0407581],288.114],["Land_FieldToilet_F",[4.37451,-0.489258,0.0376129],195.192],["Land_Cargo10_sand_F",[3.79224,-3.17822,0.0376348],285.205],["CamoNet_OPFOR_big_F",[0,-0.568848,0.119837],350.522]];
		_cargoInfo = ["Land_Cargo10_sand_F",[0.07,-3.46,0.8],270];
		[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
	};
	case (toLower "B_G_Van_01_transport_F"): {
		_composition = [["CamoNet_BLUFOR_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_Portable_generator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterBarrel_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["CargoNet_01_box_F",[3.70703,-2.79932,0.0315285],274.286]];
		_cargoInfo = ["CargoNet_01_box_F",[0,-1.2,0],0];
		[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;	
	};
	default {
		waitUntil {!isNil "CHHQ_HQarray"};
		[_obj] call CHHQ_fnc_updateTeleportActions;
		[CHHQ_HQarray, {[[_obj], "CHHQ_fnc_updateTeleportActions", _side] call BIS_fnc_MP}] call CHHQ_fnc_arrayUpdateEH;
	};
};

 

 

Share this post


Link to post
Share on other sites
4 minutes ago, sarogahtyp said:

did u get any errors?
please check ur rpt file:
https://community.bistudio.com/wiki/Crash_Files

Nope no crashes so logs are uneventful, Laptop there but no action on it and the Hemet (troop carrying one) there but not marked as MHQ.

 

The thing that annoys me is i have working MHQ scripts on some of my Altis map I & A map edits (old ones) but i cant load them in the Eden editor

Share this post


Link to post
Share on other sites

which map are u trying currently?

 

Did u look inside that .rpt file? ur answer sounds to me like "game isn't crashing therfore I don't need to look at that file"... but this is not the truth bout .rpt

Share this post


Link to post
Share on other sites
5 minutes ago, sarogahtyp said:

which map are u trying currently?

 

Did u look inside that .rpt file? ur answer sounds to me like "game isn't crashing therfore I don't need to look at that file"... but this is not the truth bout .rpt

Tanoa map and the only thing in the last report file  was this whisch i dont understand as that script isnt even in the mission folder or inside the script folder

 

Spoiler

c>
 7:58:22   Error Undefined variable in expression: _vehicle
 7:58:22 File mpmissions\__cur_mp.Tanoa\scripts\MHQvehicleInit.sqf, line 96
Version 1.72.142223
Fault time: 2017/07/20 07:58:22
Fault address:  00FEB45B 01:006BA45B G:\SteamLibrary\steamapps\common\Arma 3\Arma3_x64.exe
file:     Invade_&_annex_EGTID edit v1_0_8 (__cur_mp)
world:    Tanoa
Prev. code bytes: 80 00 00 00 00 48 8B 0B 48 85 C9 74 09 48 8B 01
Fault code bytes: FF 90 90 00 00 00 48 FF C7 48 83 C3 08 48 3B FE
=======================================================
note: Minidump has been generated into the file C:\Users\james\AppData\Local\Arma 3\Arma3_x64_2017-07-20_07-40-48.mdmp
 7:58:23 Error in expression <hile {_run} do
{
sleep 1; 

if (!(alive _vehicle)) then
{
_vehKilled = true;


c>
 7:58:23   Error position: <_vehicle)) then
{
_vehKilled = true;

 

Then it just repeats those few lines over an over again but my last one where i tried changing  to what you said showed this only

Spoiler

Original output filename: Arma3Retail_DX11_x64
Exe timestamp: 2017/06/27 16:32:28
Current time:  2017/07/20 08:15:22

Type: Public
Build: Stable
Version: 1.72.142223

Allocator: G:\SteamLibrary\steamapps\common\Arma 3\Dll\tbb4malloc_bi_x64.dll [2017.0.0.0] [2017.0.0.0]
PhysMem: 16 GiB, VirtMem : 131072 GiB, AvailPhys : 10 GiB, AvailVirt : 131072 GiB, AvailPage : 9.3 GiB
=====================================================================

 8:15:22 Detected number of DLCs: 18
 8:15:22 DLC index:0 - unable to get DLC data
 8:15:22 DLC index:3 - unable to get DLC data
 8:15:22 DLC index:14 - unable to get DLC data
 8:15:22 ----------------------------------------- Dlcs -----------------------------------------
 8:15:22                                 name      appId   owned  installed  available   isDlc
 8:15:22                               Arma 3     107410     yes        yes        yes      no
 8:15:22                              Unknown         -1      no         no         no     yes
 8:15:22                          Arma 3 Zeus     275700     yes        yes        yes     yes
 8:15:22                   Arma 3 Helicopters     304380     yes        yes        yes     yes
 8:15:22                  Arma 3 DLC Bundle 2     612480     yes         no         no     yes
 8:15:22                        Arma 3 Malden     639600     yes        yes        yes     yes
 8:15:22                        Arma 3 Server     233780     yes        yes         no     yes
 8:15:22                    Arma 3 Soundtrack     249860     yes        yes         no     yes
 8:15:22                  Arma 3 DLC Bundle 1     304400     yes        yes        yes     yes
 8:15:22                       Arma 3 Samples     390500     yes        yes         no     yes
 8:15:22                          Arma 3 Apex     395180     yes        yes        yes     yes
 8:15:22                          Arma 3 Jets     601670     yes        yes        yes     yes
 8:15:22                          Arma 3 Maps     249861     yes        yes         no     yes
 8:15:22                Arma 3 Tactical Guide     249862     yes        yes         no     yes
 8:15:22                         Arma 3 Tools     233800     yes        yes         no     yes
 8:15:22                         Arma 3 Karts     288520     yes        yes        yes     yes
 8:15:22                      Arma 3 Marksmen     332350     yes        yes        yes     yes
 8:15:22 ----------------------------------------------------------------------------------------

 

 

Share this post


Link to post
Share on other sites

this is what is happening i go to the laptop and it has no scroll option to move to MHQ so i then go to the HMET transport that also just shows as a default truck  I've tried driving it off then killing myself then going back to base but no option shows on the laptop still so it is almost like the script is not even initiating  at server start. I've also tried to login as admin and execute the command from within game.

Share this post


Link to post
Share on other sites

Don't know if this is still active, but interesting issue. 

 

Place a vehicle on the deck of CVN-83, with

[this,WEST] execVM "chhq.sqf"; 

in the init, and the vehicle spawns below the carrier, or fall through the deck. I verified correct height of vehicle. Removed the line from the init, and the vehicle stay on the deck.  

 

Any ideas why you can't use this script on a vehicle sitting on the deck of the carrier? I am looking through the code. 

Share this post


Link to post
Share on other sites

I updated this script by swapping out the BIS_fnc_MP with RemoteExec lines. I tested on my dedicated server. No issues noted. 

 

I needed the exercise with remoteExec command. All the original lines are still present, just rem'd out. 

 

Spoiler

CHHQ_fnc_deploy = {

    _veh = _this select 0;

    _caller = _this select 1;

    _side = _this select 3 select 0;

    _cargoInfo = _this select 3 select 1;

    _composition = _this select 3 select 2;

    _cargo = _veh getVariable ["CHHQ_cargo", objNull];

    

    if (_veh getVariable ["CHHQ_compositionRadius", -1] < 0) then {

        _sortedByDist = [_composition,[],{

            _frstNum = abs (_x select 1 select 0);

            _secNum = abs (_x select 1 select 1);

            if (_frstNum > _secNum) then {_frstNum} else {_secNum}

        },"DESCEND"] call BIS_fnc_sortBy;   

        _biggestOffset = (_sortedByDist select 0) select 1;

        _biggestOffsetAbs = if (abs (_biggestOffset select 0) > abs (_biggestOffset select 1)) then {abs (_biggestOffset select 0)} else {abs (_biggestOffset select 1)};

        

        _boundingSize = [_sortedByDist select 0 select 0] call CHHQ_fnc_boundingSize;

        _radius = _biggestOffsetAbs + _boundingSize;

        

        _sortedBySize = [_composition,[],{sizeOf (_x select 0)},"DESCEND"] call BIS_fnc_sortBy;

        _boundingSize = [_sortedBySize select 0 select 0] call CHHQ_fnc_boundingSize;   

        

        if (_boundingSize > _radius) then {

            _radius = _boundingSize;

        };

        _veh setVariable ["CHHQ_compositionRadius", _radius, true];

    };

    _radius = _veh getVariable ["CHHQ_compositionRadius", -1];

    

    _flatPos = (getPosASL _veh) isFlatEmpty [

        _radius,    //--- Minimal distance from another object

        0,              //--- If 0, just check position. If >0, select new one

        0.4,            //--- Max gradient

        _radius max 5,  //--- Gradient area

        0,              //--- 0 for restricted water, 2 for required water,

        false,          //--- Has to have shore nearby!

        objNull         //--- Ignored object

    ];

    

    if (count _flatPos isEqualTo 0) exitWith {systemChat format ["You can't deploy FARP here! Find a flat position without any objects nearby (%1m).", round _radius]};

    if (_veh getVariable ["CHHQ_inProgress", false]) exitWith {};

    

    _veh setVariable ["CHHQ_inProgress", true, true];

    

     [_veh] remoteExec ["CHHQ_fnc_removeAction",_side];

    //[[_veh], "CHHQ_fnc_removeAction", _side] call BIS_fnc_MP;

 

    _nearestPlayers = [];

    {

        if (isPlayer _x && _x distance _veh < 25) then {

            _nearestPlayers pushBack _x

        };

    } forEach (playableUnits + switchableUnits);

 

    ["CHHQ_deployBlackout", true] remoteExec ["BIS_fnc_blackOut",_nearestPlayers];

    //[["CHHQ_deployBlackout"],"BIS_fnc_blackOut",_nearestPlayers,false,true] call BIS_fnc_MP;

    

    ["Deploying FARP", -1, -1, 2, 1] remoteExec ["BIS_fnc_dynamicText",_nearestPlayers];

    //[["DEPLOYING HQ"],"BIS_fnc_dynamicText",_nearestPlayers] call BIS_fnc_MP;

    

    sleep 3;    

    {moveOut _x} forEach crew _veh;

    {_x allowDamage false; _x enableSimulationGlobal false} forEach _nearestPlayers;

    

    deleteVehicle _cargo;

    

    _veh enableSimulationGlobal false;

    _veh allowDamage false;

    

    

    [_veh,_side,"FARP"] remoteExec ["CHHQ_fnc_drawMarker",_side];

    //[[_veh, _side, "HQ"],"CHHQ_fnc_drawMarker",_side] call BIS_fnc_MP;

    _objArray = [];

    {

        _type = _x select 0;

        _offset = _x select 1;

        _newdir = _x select 2;

        _code = [_x, 3, "", ["", {}]] call BIS_fnc_param;

        

        _obj = createVehicle [_type, [0,0,0], [], 0, "CAN_COLLIDE"];

        _obj allowDamage false;

        [_veh,_obj,_offset,_newdir, true, true] call BIS_fnc_relPosObject;

        _objArray pushBack _obj;

        

        if !(_code isEqualTo "") then {

            _code = [_code] call CHHQ_fnc_compileCode;

            [[_obj,_veh], _code] remoteExec ["BIS_fnc_spawn",true];

            //[[[_obj,_veh], _code],"BIS_fnc_spawn",true] call BIS_fnc_MP;

        };

    } forEach _composition;

    

    /*

    _grp = createGroup _side;

    _unitType = switch _side do {

        case east: {"O_soldier_F"};

        case west: {"B_soldier_F"};

        case resistance: {"I_soldier_F"};

        default {"C_man_1"};

    };

    _unit = _grp createUnit [_unitType, [0,0,0], [], 0, "NONE"];

    [[_unit,{hideObject _this}],"BIS_fnc_spawn",true] call BIS_fnc_MP;

    _unit moveInCargo _veh;

    _veh setPilotLight false;

    _veh setCollisionLight false;

    _veh engineOn false;

    _grp setBehaviour "CARELESS";

    {_unit disableAI _x} forEach ["MOVE","TARGET","AUTOTARGET","ANIM","FSM"];

    _objArray pushBack _unit;

    */

 

    [_veh,2] remoteExec ["lock"];

    //[[_veh, 2],"lock",true] call BIS_fnc_MP;

        

    _veh enableSimulationGlobal true;

    _veh allowDamage true;

    {_x allowDamage true} forEach _objArray;    

    {_x setPos ((getPosASL _x) findEmptyPosition [0, 25, "CAManBase"]); _x allowDamage true; _x enableSimulationGlobal true} forEach _nearestPlayers;

    

    sleep 3;

    ["CHHQ_deployBlackout"] remoteExec ["BIS_fnc_blackIn",_nearestPlayers,false,true];

    //[["CHHQ_deployBlackout"],"BIS_fnc_blackIn",_nearestPlayers,false,true] call BIS_fnc_MP;

 

    [_veh, ["Undeploy FARP", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]] remoteExec ["CHHQ_fnc_addAction", _side];

    //[[_veh, ["Undeploy FARP", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]], "CHHQ_fnc_addAction", _side] call BIS_fnc_MP;

 

    ["RespawnAdded",["DEPLOYMENT POINT",format ["FARP deployed at grid %1", mapGridPosition (getPos _veh)],"\A3\ui_f\data\map\markers\nato\b_service.paa"]]remoteExec ["BIS_fnc_showNotification",_side];

    //[["RespawnAdded",["DEPLOYMENT POINT",format ["FARP deployed at grid %1", mapGridPosition (getPos _veh)],"\A3\ui_f\data\map\markers\nato\b_service.paa"]],"BIS_fnc_showNotification",_side] call BIS_fnc_MP;

 

    _veh setVariable ["CHHQ_inProgress", false, true];

    _veh setVariable ["CHHQ_deployed", true, true];

    _veh setVariable ["CHHQ_objArray", _objArray, true];

 

    [_veh] remoteExec ["CHHQ_fnc_deleteVehicleEH"];

    //[[_veh], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;

};

CHHQ_fnc_undeploy = {

    _veh = _this select 0;

    _caller = _this select 1;

    _side = _this select 3 select 0;

    _cargoInfo = _this select 3 select 1;

    _cargoType = _cargoInfo select 0;

    _cargoOffset = _cargoInfo select 1;

    _cargoDir = _cargoInfo select 2;

    _cargoCode = [_cargoInfo, 3, "", ["", {}]] call BIS_fnc_param;

    _composition = _this select 3 select 2;

    

    if (_veh getVariable ["CHHQ_inProgress", false]) exitWith {};   

    _veh setVariable ["CHHQ_inProgress", true, true];

    

    [_veh] remoteExec ["CHHQ_fnc_removeAction", _side];

    //[[_veh], "CHHQ_fnc_removeAction", _side] call BIS_fnc_MP;

    

    _nearestPlayers = [];

    {

        if (isPlayer _x && _x distance _veh < 25) then {

            _nearestPlayers pushBack _x

        };

    } forEach (playableUnits + switchableUnits);

    

    ["CHHQ_deployBlackout", true] remoteExec ["BIS_fnc_blackOut",_nearestPlayers];

    //[["CHHQ_deployBlackout"],"BIS_fnc_blackOut",_nearestPlayers,false,true] call BIS_fnc_MP;

    

    ["UNDEPLOYING FARP", -1, -1, 2, 1] remoteExec ["BIS_fnc_dynamicText",_nearestPlayers];

    //[["UNDEPLOYING FARP"],"BIS_fnc_dynamicText",_nearestPlayers] call BIS_fnc_MP;

    

    sleep 3;

    {_x allowDamage false; _x enableSimulationGlobal false} forEach _nearestPlayers;    

    

    {deleteVehicle _x} forEach (_veh getVariable ["CHHQ_objArray", []]);

    _veh setVariable ["CHHQ_deployed", false, true];    

    

    [_veh, _side, "MHQ"] remoteExec ["CHHQ_fnc_drawMarker",_side];

    //[[_veh, _side, "MHQ"],"CHHQ_fnc_drawMarker",_side] call BIS_fnc_MP;   

    

    [_veh,0] remoteExec ["lock"];

    //[[_veh, false],"lock",true] call BIS_fnc_MP;  

    

    [_veh,true] remoteExec ["lockCargo"];

    //[[_veh, true],"lockCargo",true] call BIS_fnc_MP;

 

    [_veh,false] remoteExec ["lockCargo"];

    //[[_veh, [0,false]],"lockCargo",true] call BIS_fnc_MP;

    

    _cargo = createVehicle [_cargoType, [0,0,0], [], 0, "CAN_COLLIDE"];     

    _cargo attachTo [_veh, _cargoOffset]; 

                    

    _veh setPos (getPos _veh);

    _veh setDir (getDir _veh);

    _cargo setDir _cargoDir;    

    _veh setVariable ["CHHQ_cargo", _cargo, true];

            

    if !(_cargoCode isEqualTo "") then {

        _cargoCode = [_cargoCode] call CHHQ_fnc_compileCode;

 

        [[_cargo,_veh], _cargoCode,true] remoteExec ["BIS_fnc_spawn"];

        //[[[_cargo,_veh], _cargoCode],"BIS_fnc_spawn",true] call BIS_fnc_MP;

    };

    

    sleep 3;    

    _veh enableSimulationGlobal true;

    _veh allowDamage true;

    {_x setPos ((getPosASL _x) findEmptyPosition [0, 25, "CAManBase"]); _x allowDamage true; _x enableSimulationGlobal true} forEach _nearestPlayers;

 

    ["CHHQ_deployBlackout", true] remoteExec ["BIS_fnc_blackIn", _nearestPlayers];

    //[["CHHQ_deployBlackout"],"BIS_fnc_blackIn",_nearestPlayers,false,true] call BIS_fnc_MP;

    

    [_veh, ["Deploy FARP", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]] remoteExec ["CHHQ_fnc_addAction", _side];

    //[[_veh,["Deploy FARP", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]], "CHHQ_fnc_addAction", _side] call BIS_fnc_MP;

    

    _veh setVariable ["CHHQ_inProgress", false, true];

    

    [_veh, "cargo"] remoteExec ["CHHQ_fnc_deleteVehicleEH"];

    //[[_veh, "cargo"], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;

};

CHHQ_fnc_boundingSize = {

    _type = _this select 0;

    _bbdummy = _type createVehicleLocal [0,0,0];

    _boundingBox = (boundingBox _bbdummy) select 1;

    deleteVehicle _bbdummy;

    _boundingSize = if (_boundingBox select 0 > _boundingBox select 1) then {_boundingBox select 0} else {_boundingBox select 1};

    _boundingSize

};

CHHQ_fnc_compileCode = {

    _code = [_this, 0, "", ["", {}]] call BIS_fnc_param;

    

    if (toLower typeName _code == "code") then {

        _array = toArray str _code;

        _array deleteAt 0;

        _array deleteAt count _array - 1;

        _code = toString _array;

    };

    if !(_code isEqualTo "") then {

        _prefix = "_target = _this select 1; _this = _this select 0; ";

        _code = _prefix + _code;

    };

    compile _code

};

CHHQ_fnc_deleteVehicleEH = {

    _veh = [_this, 0, objNull, [objNull]] call BIS_fnc_param;

    _type = [_this, 1, "", [""]] call BIS_fnc_param;

    _objArray = _veh getVariable ["CHHQ_objArray", []];

    _cargo = _veh getVariable ["CHHQ_cargo", objNull];

        

    waitUntil {isNull _veh};

    if (_type isEqualTo "cargo") then {

        deleteVehicle _cargo;

    } else {

        {deleteVehicle _x} forEach _objArray;

    };

};

CHHQ_fnc_arrayUpdateEH = {

    _array = _this select 0;

    _code = _this select 1;

    

    for "_i" from 0 to 1 step 0 do {

        _countArray = count _array;

        waitUntil {count _array != _countArray};

        call _code;

    };

};

CHHQ_fnc_drawMarker = {

    if !(CHHQ_showMarkers) exitWith {};

    private ["_color","_icon","_mrkName"];

    _veh = _this select 0;

    _side = _this select 1;

    _text = _this select 2;

    terminate (_veh getVariable ["CHHQ_drawMarkerHandle", scriptNull]);

    

    switch _side do {

        case west: {

            _color = "ColorWEST";

            _icon = "b_service";

        };

        case east: {

            _color = "ColorEAST";

            _icon = "o_hq";

        };

        case resistance: {

            _color = "ColorGUER";

            _icon = "n_hq";

        };

        default {

            _color = "ColorUNKNOWN";

            _icon = "n_hq";

        };

    };

    

    if (_veh getVariable ["CHHQ_mrkName", ""] isEqualTo "") then {

        _veh setVariable ["CHHQ_mrkName", format ["CHHQ_%1", [str _veh] call BIS_fnc_filterString]];

    };

    _mrkName = _veh getVariable ["CHHQ_mrkName", format ["CHHQ_%1", [str _veh] call BIS_fnc_filterString]];

    

    if (getMarkerPos _mrkName isEqualTo [0,0,0]) then {

        createMarkerLocal [_mrkName, getPos _veh];

    } else {

        _mrkName setMarkerPosLocal (getPos _veh);

    };

    _mrkName setMarkerShapeLocal "ICON";

    _mrkName setMarkerTypeLocal _icon;

    //_mrkName setMarkerSizeLocal [0.7,0.7];

    _mrkName setMarkerColorLocal _color;

 

    _handle = [_veh, _mrkName, _text] spawn {

        _veh = _this select 0;

        _mrkName = _this select 1;

        while {alive _veh} do {

            _text = if (count CHHQ_HQarray > 1) then {format ["%1-%2", _this select 2, _veh getVariable ["CHHQ_index", -1]]} else {_this select 2};

            _mrkName setMarkerTextLocal _text;

            _mrkName setMarkerPosLocal (getPos _veh);

            sleep 1;

        };

        deleteMarkerLocal _mrkName;

    };

    _veh setVariable ["CHHQ_drawMarkerHandle", _handle];

};

CHHQ_fnc_addAction = {

    _veh = _this select 0;

    _settings = _this select 1;

 

    _id = _veh addAction _settings;

    _veh setVariable ["CHHQ_actionID",_id];

};

CHHQ_fnc_removeAction = {

    _obj = _this select 0;

    _obj removeAction (_obj getVariable ["CHHQ_actionID",-1]);

};

CHHQ_fnc_actionConditions = {

    _target = _this select 0;

    _caller = _this select 1;

 

    (speed _target isEqualTo 0 && {alive _target} && {_caller distance _target < 8} && {vehicle _caller isEqualTo _caller})

};

CHHQ_fnc_teleportActionConditions = {

    _target = _this select 0;

    _caller = _this select 1;

    _veh = _this select 2;

 

    (_veh getVariable ["CHHQ_deployed", false] && {!isNil "_veh"} && {alive _veh} && {_caller distance _target < 8} && {vehicle _caller isEqualTo _caller}) 

};

CHHQ_fnc_teleportToHQ = {

    _obj = _this select 0;

    _caller = _this select 1;

    _veh = _this select 3 select 0;

    

    ["CH_teleportToHQblackout"] call BIS_fnc_blackOut;

    sleep 3;

    _caller setPos ((getPosASL _veh) findEmptyPosition [0, 25, "CAManBase"]);   

    ["CH_teleportToHQblackout"] call BIS_fnc_blackIn;

    [] call CHHQ_fnc_BISshowOSD;

};

CHHQ_fnc_BISshowOSD = {

    /*

        Author: Jiri Wainar

 

        Description:

        Display OSD with location, time and possibly some other campaign related info.

 

        Parameter(s):

        _this select 0: array (optional)    - position (default: player's position)

        _this select 1: array (optional)    - date in format [_year,_month,_day,_hour,_min] (default: current date)

 

        Example:

        [] call BIS_fnc_camp_showOSD;

 

        Returns:

        - nothing -

    */

 

    if (missionNamespace getVariable ["BIS_fnc_camp_showOSD__running",false]) exitWith {};

 

    BIS_fnc_camp_showOSD__running = true;

 

    private["_fn_getSector"];

 

    _fn_getSector =

    {

        private["_map","_posX","_posY","_gridX","_gridY","_secWidth","_secHeight"];

        private["_bottomLeftX","_bottomLeftY","_topRightX","_topRightY"];

 

        _map = toLower worldName;

 

        if !(_map in ["altis","stratis"]) exitWith

        {

            -1

        };

 

        if (_map == "stratis") then

        {

            _bottomLeftX = 1302;

            _bottomLeftY = 230;

            _topRightX   = 6825;

            _topRightY   = 7810;

        }

        else

        {

            _bottomLeftX = 1765;

            _bottomLeftY = 4639;

            _topRightX   = 28624;

            _topRightY   = 26008;

        };

 

        _posX = _this select 0;

        _posY = _this select 1;

 

        //check if player is outside the map grid

        if !(_posX > _bottomLeftX && _posX < _topRightX && _posY > _bottomLeftY && _posY < _topRightY) exitWith

        {

            0

        };

 

        //offset player pos to [0,0]

        _posX      = _posX - _bottomLeftX;

        _posY      = _posY - _bottomLeftY;

 

        _secWidth  = (_topRightX - _bottomLeftX)/3;

        _secHeight = (_topRightY - _bottomLeftY)/3;

 

        _gridX = floor (_posX/_secWidth);

        _gridY = floor (_posY/_secHeight);

 

        ((_gridY * 3) + _gridX + 1)

    };


 

    private["_position","_date","_output","_showDate","_showLocation","_showMap"];

    private["_tLoc","_tMap","_tDate","_tTime","_tTimeH","_tTimeM","_tDay","_tMonth","_tYear"];

 

    _showDate   = true;


 

    _position   = [_this, 0, getPos player, [[]]] call BIS_fnc_param;

    _date       = [_this, 1, date, [[]]] call BIS_fnc_param;

    _tMap       = [_this, 2, "auto", [""]] call BIS_fnc_param;

    _tLoc       = [_this, 3, "auto", [""]] call BIS_fnc_param;

 

    //safecheck _date to make sure no values are out of boundries

    _date = _date call BIS_fnc_fixDate;

 

    if (_tMap != "") then

    {

        _showMap = true;

    }

    else

    {

        _showMap = false;

    };

 

    if (_tLoc != "") then

    {

        _showLocation = true;

    }

    else

    {

        _showLocation = false;

    };

 

    //get map text

    if (_showMap && _tMap == "auto") then

    {

        private["_sector","_map","_template"];

 

        _sector = _position call _fn_getSector;

 

        if (_sector == -1) then

        {

            ["Map not recognized! Only 'Altis' and 'Stratis' are supported."] call BIS_fnc_error;

 

            _showMap    = false;

            _showLocation   = false;

        };

 

        _map = gettext (configfile >> "cfgworlds" >> worldname >> "description");

 

        _template = switch (_sector) do

        {

            case 7: {localize "STR_A3_SectorNorthWest"};

            case 8: {localize "STR_A3_SectorNorth"};

            case 9: {localize "STR_A3_SectorNorthEast"};

            case 4: {localize "STR_A3_SectorWest"};

            case 5: {localize "STR_A3_SectorCentral"};

            case 6: {localize "STR_A3_SectorEast"};

            case 1: {localize "STR_A3_SectorSouthWest"};

            case 2: {localize "STR_A3_SectorSouth"};

            case 3: {localize "STR_A3_SectorSouthEast"};

 

            default

            {

                _showLocation = false;

 

                //hardcoded for Stratis and Altis only

                if (worldname == "Stratis") then

                {

                    localize "STR_A3_NearStratis"

                }

                else

                {

                    localize "STR_A3_NearAltis"

                };

            };

        };

 

        _tMap = format[_template,_map];

    };

 

    //get current location text

    if (_showLocation && _tLoc == "auto") then

    {

        private["_locations","_loc"];

 

        _locations = nearestLocations [getPos player, ["NameCity","NameCityCapital","NameLocal","NameMarine","NameVillage"], 500];

 

        //filter-out locations without names

        {

            if (text _x == "") then

            {

                locations set [_forEachIndex, objNull];

            };

        }

        forEach _locations; _locations = _locations - [objNull];

 

        if (count _locations > 0) then

        {

            _loc = _locations select 0;

 

            if ((getPos player) in _loc) then

            {

                _tLoc  = text _loc;

            }

            else

            {

                _tLoc = format[localize "STR_A3_NearLocation", text _loc];      //tolocalize: "Pobl? lokace %1"

            };

        }

        else

        {

            _tLoc = "";

            _showLocation = false;

        };

    };

 

    //get daytime data

    _tYear  = _date select 0;

    _tMonth = _date select 1;

    _tDay   = _date select 2;

 

    if (_tMonth < 10) then {_tMonth = format["0%1",_tMonth]};

    if (_tDay < 10) then {_tDay = format["0%1",_tDay]};

 

    //get date text

    _tDate = format["%1-%2-%3 ",_tYear,_tMonth,_tDay];

 

    //get time text

    _tTimeH = _date select 3;

    _tTimeM = _date select 4;

 

    if (_tTimeH < 10) then {_tTimeH = format["0%1",_tTimeH]};

    if (_tTimeM < 10) then {_tTimeM = format["0%1",_tTimeM]};

 

    _tTime = format["%1:%2",_tTimeH,_tTimeM];

 

    /*

    A3 fonts:

 

    PuristaLight

    PuristaMedium

    PuristaSemiBold

    PuristaBold

    */


 

    //sum the output params & print it

    _output =

    [

        [_tDate,""],

        [_tTime,"font='PuristaMedium'"],["","<br/>"]

    ];

 

    if (_showLocation) then

    {

        _output = _output + [[toUpper _tLoc,""],["","<br/>"]];

    };

 

    if (_showMap) then

    {

        _output = _output + [[_tMap,""],["","<br/>"]];

    };

 

    private["_handle"];

 

    //vertically align to cinematic border

    _handle = [_output,safezoneX - 0.01,safeZoneY + (1 - 0.125) * safeZoneH,true,"<t align='right' size='1.0' font='PuristaLight'>%1</t>"] spawn BIS_fnc_typeText2;

 

    waitUntil

    {

        scriptDone _handle;

    };

 

    BIS_fnc_camp_showOSD__running = false;

};

CHHQ_fnc_startingSetup = {

    private ["_cargo"];

    _veh = _this select 0;

    _side = _this select 1;

    _cargoInfo = _this select 2;

    _cargoType = _cargoInfo select 0;

    _cargoOffset = _cargoInfo select 1;

    _cargoDir = _cargoInfo select 2;

    _cargoCode = [_cargoInfo, 3, "", ["", {}]] call BIS_fnc_param;

    _composition = _this select 3;

        

    if (_veh getVariable ["CHHQ_deployed",false]) then {

        _veh lock 2;

        

        if (playerSide isEqualTo _side) then {      

            {

                _obj = (_veh getVariable ["CHHQ_objArray", []]) select _forEachIndex;

                _code = [_x, 3, "", ["", {}]] call BIS_fnc_param;

            

                if !(_code isEqualTo "") then {

                    _code = [_code] call CHHQ_fnc_compileCode;

                    [_obj, _veh] spawn _code;

                };

            } forEach _composition;

            

            [_veh, _side, "HQ"] call CHHQ_fnc_drawMarker;

            

            if (isNil "CHHQ_HQarray") then {

                CHHQ_HQarray = [];

            };

            CHHQ_HQarray pushBack _veh;

            if (_veh getVariable ["CHHQ_index", -1] < 0) then {

                _veh setVariable ["CHHQ_index", (CHHQ_HQarray find _veh) + 1, true];

            };

            

            _id = _veh addAction ["Undeploy FARP", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"];

            _veh setVariable ["CHHQ_actionID",_id];

        };

    } else {

        _veh lock false;

        _veh lockCargo true;    

        _veh lockCargo [0, false];

        if (isServer) then {

            _cargo = createVehicle [_cargoType, [0,0,0], [], 0, "NONE"];    

            {_x enableSimulation true} forEach [_veh, _cargo];

            _cargo attachTo [_veh, _cargoOffset];

                    

            _veh setPos (getPos _veh);

            _veh setDir (getDir _veh);

            _cargo setDir _cargoDir;

            _veh setVariable ["CHHQ_cargo", _cargo, true];

        };

        _cargo = _veh getVariable ["CHHQ_cargo", objNull];

        

        if (playerSide isEqualTo _side) then {

            [_veh, _side, "MHQ"] call CHHQ_fnc_drawMarker;

            

            if (isNil "CHHQ_HQarray") then {

                CHHQ_HQarray = [];

            };

            CHHQ_HQarray pushBack _veh;

            if (_veh getVariable ["CHHQ_index", -1] < 0) then {

                _veh setVariable ["CHHQ_index", (CHHQ_HQarray find _veh) + 1, true];

            };

            

            _id = _veh addAction ["Deploy FARP", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"];  

            _veh setVariable ["CHHQ_actionID",_id]; 

 

            [_veh, "cargo"] remoteExec ["CHHQ_fnc_deleteVehicleEH"];

            //[[_veh, "cargo"], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP; 

 

            if !(_cargoCode isEqualTo "") then {

                _cargoCode = [_cargoCode] call CHHQ_fnc_compileCode;

                [_cargo, _veh] spawn _cargoCode;

            };          

        };

    };

};

CHHQ_fnc_updateTeleportActions = {

    _obj = _this select 0;

    

    {

        _obj removeAction _x;

    } forEach (_obj getVariable ["CHHQ_actionIDarray",[]]);

    

    _actionIDarray = [];

    {

        _vehString = "CHHQ_HQarray select " + str _forEachIndex;

        _actionText = if (count CHHQ_HQarray > 1) then {format ["Move to Forward Area-%1", _x getVariable ["CHHQ_index", -1]]} else {"Move to Forward Area"};

        _id = _obj addAction [_actionText, "_this spawn CHHQ_fnc_teleportToHQ", [_x], 6, true, true, "", format ["[_target, _this, %1] call CHHQ_fnc_teleportActionConditions", _vehString]];

        _actionIDarray pushBack _id;

    } forEach CHHQ_HQarray;

    _obj setVariable ["CHHQ_actionIDarray", _actionIDarray];

};

CHHQ_fnc_clearNullFromArray = {

    [] spawn {

        waitUntil {!isNil "CHHQ_HQarray"};

        for "_i" from 0 to 1 step 0 do {

            waitUntil {{isNull _x} count CHHQ_HQarray > 0};

            CHHQ_HQarray = CHHQ_HQarray - [objNull];

        };

    };

};

 

waitUntil {time > 1};

_obj = [_this, 0, objNull, [objNull]] call BIS_fnc_param;

_side = [_this, 1, sideUnknown, [sideUnknown]] call BIS_fnc_param;

CHHQ_showMarkers = if (isNil "CHHQ_showMarkers") then {true} else {CHHQ_showMarkers};

 

if (_side isEqualTo sideUnknown && toLower typeOf _obj != toLower "MapBoard_altis_F") then {

    _sideNum = getNumber (configFile >> "CfgVehicles" >> typeOf _obj >> "side");

    _side = switch _sideNum do {

        case 0: {east};

        case 1: {west};

        case 2: {resistance};

        default {sideUnknown};

    };

};

[] call CHHQ_fnc_clearNullFromArray;

switch (toLower typeOf _obj) do {

    case (toLower "B_Truck_01_flatbed_F"): {

        _composition = 

        [["CamoNet_BLUFOR_big_F",[1.65112,2.77051,0.025075],0],

        ["B_Slingload_01_Ammo_F",[3.43823,0.306396,0.025075],-3.05176],

        ["FlexibleTank_01_forest_F",[-4.71363,-4.99657,0.0252037],0],

        ["FlexibleTank_01_forest_F",[-3.38307,-6.04858,0.0252094],0],

        ["FlexibleTank_01_forest_F",[-6.03882,-3.61278,0.0252037],0]];

        _cargoInfo = ["B_Slingload_01_Ammo_F",[0.0,-2.0,0.5],0,{}];

        [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;

    };

    case (toLower "O_Truck_02_transport_F"): {

        _composition = [["CamoNet_OPFOR_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_PowerGenerator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterTank_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["Land_Cargo10_sand_F",[3.70703,-2.79932,0.0315285],274.286]];    

        _cargoInfo = ["Land_Cargo10_sand_F",[0,0,0.3],0];

        [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;

    };

    case (toLower "I_Truck_02_transport_F"): {

        _composition = [["CamoNet_INDP_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_PowerGenerator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterTank_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["Land_Cargo10_military_green_F",[3.70703,-2.79932,0.0315285],274.286]];   

        _cargoInfo = ["Land_Cargo10_military_green_F",[0.07,-2,0.5],270];       

        [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;

    };

    case (toLower "O_Truck_03_transport_F"): {

        _composition = [["Land_PowerGenerator_F",[-2.74097,0.837891,0.0376329],182.12],["Land_CampingTable_F",[-3.02441,-2.60107,0.0376248],276.309],["Land_CampingChair_V1_F",[-4.10986,-2.13037,0.0407581],288.114],["Land_FieldToilet_F",[4.37451,-0.489258,0.0376129],195.192],["Land_Cargo10_sand_F",[3.79224,-3.17822,0.0376348],285.205],["CamoNet_OPFOR_big_F",[0,-0.568848,0.119837],350.522]];

        _cargoInfo = ["Land_Cargo10_sand_F",[0.07,-3.46,0.8],270];

        [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;

    };

    case (toLower "B_G_Van_01_transport_F"): {

        _composition = [["CamoNet_BLUFOR_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_Portable_generator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterBarrel_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["CargoNet_01_box_F",[3.70703,-2.79932,0.0315285],274.286]];

        _cargoInfo = ["CargoNet_01_box_F",[0,-1.2,0],0];

        [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;    

    };

    default {

        waitUntil {!isNil "CHHQ_HQarray"};

        [_obj] call CHHQ_fnc_updateTeleportActions;

 

        [CHHQ_HQarray, {[_obj] remoteExec ["CHHQ_fnc_updateTeleportActions", _side]}] call CHHQ_fnc_arrayUpdateEH;

        //[CHHQ_HQarray, {[[_obj], "CHHQ_fnc_updateTeleportActions", _side] call BIS_fnc_MP}] call CHHQ_fnc_arrayUpdateEH;

    };

};

 

[["CamoNet_BLUFOR_big_F",[-1.64966,-2.77002,0.0251894],-360],["B_Slingload_01_Ammo_F",[-3.43701,0.307379,0.0251894],9.15527e-005],["FlexibleTank_01_forest_F",[4.71363,4.99657,0.0252037],-359.977],["FlexibleTank_01_forest_F",[3.38307,6.04858,0.0252094],-359.981],["FlexibleTank_01_forest_F",[6.03882,3.61278,0.0252037],-359.977]]

 

Share this post


Link to post
Share on other sites

If someone searching for this kind of script but want to add Respawn point and Arsenal on their custom composition , here is the code:

 

Spoiler

switch (toLower typeOf _obj) do {
    case (toLower "B_Truck_01_transport_F"): {
        _composition = [["CamoNet_INDP_big_F",[0.126475,2.50781,0.0178409],-180],
        ["Land_CampingTable_small_F",[-3.68262,-0.749985,0.0152397],180],
        ["Land_CampingChair_V1_F",[-3.67579,-1.70848,0.014751],-2.00212],
        ["Land_Cargo20_grey_F",[4.50147,1.75779,0.0178409],90.0002,{_this allowDamage false;[west, _this] call BIS_fnc_addRespawnPosition;}],
        ["Land_PowerGenerator_F",[-4.06859,3.06642,0.0178409],-180],
        ["Land_PortableLight_single_F",[-5.62353,1.88284,0.0178409],142],
        ["B_supplyCrate_F",[0.126496,7.50781,0.0178409],-180,{_this allowDamage false;clearWeaponCargoGlobal _this; clearMagazineCargoGlobal _this; clearItemCargoGlobal _this;["AmmoboxInit",[_this, true]] spawn BIS_fnc_arsenal;}]];
        _cargoInfo = ["Land_Cargo20_grey_F",[0.045,-2.31,1.15],270,{_this setVariable ['bis_disabled_Door_1',1]; _this setVariable ['bis_disabled_Door_2',1]}];
        [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
    };
    default {
        waitUntil {!isNil "CHHQ_HQarray"};
        [_obj] call CHHQ_fnc_updateTeleportActions;
        [CHHQ_HQarray, {[[_obj], "CHHQ_fnc_updateTeleportActions", _side] call BIS_fnc_MP}] call CHHQ_fnc_arrayUpdateEH;
    };
};

- The code highlighted with red color.

- This is for Blufor side only. You can add the same code to other side.

 

If you want the vehicle to respawn and have the option to deploy mobile hq again, i recommend Light advanced vehicle respawn by Fiddi.

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

×