All pastes #507738 Raw Edit

Stuff

public text v1 · immutable
·published 2007-05-24 18:36 UTC
rendered paste body
////////////////////////////////////////////////////////////////////////////////
/// <header>
/// This SQF Function created using Project: JADE v0.6 on 2007-04-28 08:41:30Z
/// 
/// <author>Sickboy</author>
/// <filename>fObjHandler.sqf</filename>
/// <version>1.0.0</version>
/// 
/// <summary>
/// This function will Handle Objectives
/// </summary>
/// 
/// <parameters>
/// 
/// </parameters>
/// 
/// <returns>{Edit Me}</returns>
/// </header>
////////////////////////////////////////////////////////////////////////////////
private ["_conf","_obj","_objId","_objC"];

_obj=_this select 0;
_objID=_this select 1;
_objC=_this select 2;
_conf=_this select 3;

if(six_debug_miss&&six_isClient)then{server globalChat format["SIX_AIM_ObjHandler: Objtype: %1, ID: %2, Amount: %3, Conf: %4",_obj,_objID,_objC,_conf];};

_obj call compile preprocessFile (SIX_AIM_P+"c\cfg_ObjHandler.sqf");


// This is contents of the cfg_objHandler.sqf:
// from fCreateObjective: private ["_basepos","_conf","_obj","_objC","_objId","_pos","_ps","_pside","_s","_side","_sub","_caller"];
private ["_ar","_objC","_units","_u","_trg","_i","_grp","_am"];
_ar=[];_objC=0;
six_aim_objtypes=["Rescue","Recover","Destroy"];
six_aim_objsubs=[["Captives","Civilian"],["Documents","Vehicles"],["Tanks","APCs","Buildings"]];
if(str(_caller)==str(group server))then{_caller="ALL";};

switch _this do
{
	case 0:
	{
		// Rescue
		switch _sub do
		{
			case 0:
			{
				// Captives
				_units=[21,_conf select 2] call six_fGetCfg;
			};
			case 1:
			{
				// Civilian
				_units=[1,300] call six_fGetCfg;
			};
		};
		_grp=createGroup _ps;_i=0;_am=(_conf select 0) call six_fRndInt;
		while{_i<_am}do
		{
			_u=[_grp,_units call six_fRndSelect,_pos,six_ranks_inf call six_fRndSelect] call six_fCreateUnit;
			_ar=_ar+[_u];
			removeAllWeapons _u;
			_u setCaptive true;
			_u disableAI "MOVE";
			_objC=_objC+1;
			_i=_i+1;
		};
		[_ar,[format["six_aim_obj%1_",_objId]],["RANDOM","GLOBAL"]] call six_fSetVarName;
		call compile format["six_aim_obj%1_ar=_ar;[] spawn { while{({alive _x}count six_aim_obj%1_ar)>0}do{{if(!alive _x)then{six_aim_obj%1_ar=six_aim_obj%1_ar-[_x];};sleep 1;}forEach six_aim_obj%1_ar;sleep 60;};};",_objId];

		_units=[1,_conf select 1] call six_fGetCfg;
		_grp=createGroup _s;_am=_am*4;_i=0;
		while{_i<_am}do{_u=[_grp,_units call six_fRndSelect,_pos,six_ranks_inf call six_fRndSelect] call six_fCreateUnit;_i=_i+1;};

		_trg=createTrigger ["EmptyDetector", _pos ];
		_trg setTriggerActivation [str(_ps), "PRESENT", true];
		_trg setTriggerArea [5, 5, 0, false ];
		_trg setTriggerStatements ["this", format["d=[%1,%2,%3,[thisList,%4]] spawn six_fObjHandler",_obj,_objId,_objC,_basepos], ""];
		_trg setTriggerTimeout [10, 10, 10, false ];
		[format["six_aim_obj%1_m",_objId], _pos, "ICON", [1,1], "GLOBAL", "TEXT:", format["OBJ%1: %2 %3 (%4)",_objId,six_aim_objtypes select _obj,((six_aim_objsubs select _obj) select _sub),_caller], "TYPE:", "PickUp", "COLOR:", "ColorRed"] call six_fCreateMarker;
		[format["six_aim_obj%1_e",_objId], _basepos, "ICON", [1,1], "GLOBAL", "TEXT:", format["OBJ%1: End (%2)",_objId,_caller], "TYPE:", "End", "COLOR:", "ColorBlack"] call six_fCreateMarker;
		call compile format["six_aim_obj%1_d=false;publicVariable 'six_aim_obj%1_d'; six_aim_obj%1_trg=_trg",_objId];
	};

	case 1:
	{
		// Recover
		switch _sub do
		{
			case 0:
			{
				// Documents
				_units=["DOCUMENT_PLACEHOLDER"];
			};
			case 1:
			{
				// Vehicles
				_units=[3,_conf select 1] call six_fGetCfg;
			};
		};

		_i=0;_am=(_conf select 0) call six_fRndInt;
		while{_i<_am}do
		{
			_u=(_units call six_fRndSelect) createVehicle _pos;
			_u lock false;
			_ar=_ar+[_u];
			_objC=_objC+1;
			_i=_i+1;
		};

		[_ar,[format["six_aim_obj%1_",_objId]],["RANDOM"]] call six_fSetVarName;
		call compile format["six_aim_obj%1_ar=_ar;[] spawn { while{({alive _x}count six_aim_obj%1_ar)>0}do{{if(!alive _x)then{six_aim_obj%1_ar=six_aim_obj%1_ar-[_x];};sleep 1;}forEach six_aim_obj%1_ar;sleep 60;};};",_objId];

		_units=[1,_conf select 1] call six_fGetCfg;
		_grp=createGroup _s;_am=_am*4;_i=0;
		while{_i<_am}do{_u=[_grp,_units call six_fRndSelect,_pos,six_ranks_inf call six_fRndSelect] call six_fCreateUnit;_i=_i+1;};

		_trg=createTrigger ["EmptyDetector", _pos ];
		_trg setTriggerActivation ["ANY", "PRESENT", true];
		_trg setTriggerArea [20, 20, 0, false ];
		_trg setTriggerStatements ["this", format["d=[%1,%2,%3,[thisList,%4]] spawn six_fObjHandler",_obj,_objId,_objC,_basepos], ""];
		_trg setTriggerTimeout [10, 10, 10, false ];
		[format["six_aim_obj%1_m",_objId], _pos, "ICON", [1,1], "GLOBAL", "TEXT:", format["OBJ%1: %2 %3 (%4)",_objId,six_aim_objtypes select _obj,((six_aim_objsubs select _obj) select _sub),_caller], "TYPE:", "PickUp", "COLOR:", "ColorRed"] call six_fCreateMarker;
		[format["six_aim_obj%1_e",_objId], _basepos, "ICON", [1,1], "GLOBAL", "TEXT:", format["OBJ%1: End (%2)",_objId,_caller], "TYPE:", "End", "COLOR:", "ColorBlack"] call six_fCreateMarker;
		call compile format["six_aim_obj%1_d=false;publicVariable 'six_aim_obj%1_d'; six_aim_obj%1_trg=_trg",_objId];
	};

	case 2:
	{
		// Destroy
		switch _sub do
		{
			case 0:
			{
				// Tanks
				_units=[3,_conf select 1] call six_fGetCfg;
			};
			case 1:
			{
				// APCs
				_units=[2,_conf select 1] call six_fGetCfg;
			};
			case 2:
			{
				// Buildings
				_units=[22,_conf select 1] call six_fGetCfg;
			};
		};
		_i=0;_am=(_conf select 0) call six_fRndInt;
		while{_i<_am}do
		{
			_u=(_units call six_fRndSelect) createVehicle _pos;
			_u lock true;
			_ar=_ar+[_u];
			_objC=_objC+1;
			_i=_i+1;
		};

		[_ar,[format["six_aim_obj%1_",_objId]],["RANDOM"]] call six_fSetVarName;
		call compile format["six_aim_obj%2_ar=_ar;[] spawn { private['_y'];_y=six_aim_obj%2_ar;while{({alive _x}count _y)>0}do{{if(!alive _x)then{_y=_y-[_x];};sleep 1;}forEach _y;sleep 60;};[%1,%2,%3,[thisList,%4]] spawn six_fObjHandler};",_obj,_objId,_objC,_basepos];

		_units=[1,_conf select 1] call six_fGetCfg;
		_grp=createGroup _s;_am=_am*4;_i=0;
		while{_i<_am}do{_u=[_grp,_units call six_fRndSelect,_pos,six_ranks_inf call six_fRndSelect] call six_fCreateUnit;_i=_i+1;};

		[format["six_aim_obj%1_m",_objId], _pos, "ICON", [1,1], "GLOBAL", "TEXT:", format["OBJ%1: %2 %3 (%4)",_objId,six_aim_objtypes select _obj,((six_aim_objsubs select _obj) select _sub),_caller], "TYPE:", "Destroy", "COLOR:", "ColorRed"] call six_fCreateMarker;
		[format["six_aim_obj%1_e",_objId], _basepos, "ICON", [1,1], "GLOBAL", "TEXT:", format["OBJ%1: End (%2)",_objId,_caller], "TYPE:", "End", "COLOR:", "ColorBlack"] call six_fCreateMarker;
		call compile format["six_aim_obj%1_d=false;publicVariable 'six_aim_obj%1_d';",_objId];
	};
};