Member
Last active 8 years ago
Obviously this is a function.
Returns an array with side units count profiled + spawned
[_east,_west,_indep]
Preprocess this code in any file and call by:
_domination = [] call function.
You can set couple of game modes using ALiVE.
Which one we are talking about?
Your insurgents faction is defined in assymetrical AI Commander module.
If you have trouble with your cfgFunction classes instead of merging it put the files in one file and preprocess that file in init.sqf.
removes:
"Land_RattanTable_01_F",
"Fridge_01_open_F",
"Land_WaterCooler_01_new_F",
"Land_MapBoard_F",
"ALiVE_IED",
"Box_East_AmmoOrd_F"
//by SpyderBlack723 private ["_west", "_east", "_indep", "_inactiveProfilesBySide"]; _west = 0; _east = 0; _indep = 0; // count spawned units { switch (side _x) do { case EAST: {_east = _east + 1}; case WEST: {_west = _west + 1}; case INDEPENDENT: {_indep = _indep + 1}; }; } foreach allUnits; // use foreach so you only need to iterate through allUnits once // count inactive profiles _inactiveProfilesBySide = ([ALiVE_profileHandler,"profilesInActiveBySide"] call ALIVE_fnc_hashGet) select 2; _east = _east + (count ((_inactiveProfilesBySide select 0) select 1)); _west = _west + (count ((_inactiveProfilesBySide select 1) select 1)); _indep = _indep + (count ((_inactiveProfilesBySide select 2) select 1)); [_east,_west,_indep]
I have just test this, handle damage eventhandler works out of the box. I do not knew why its not working for you i think there is something else going on.
Destroying the Caches with Satchels or Charges has always been the bane of my existence with this script. I tried a lot of different things however it did work at one time. It could simply be the changed the way the event handler get handled in the latest versions. In the end, I wanted the cache to be able to be destroyed by most explosive types including aircraft bombs. Never got around to really working that out.
Why then you limited it to only pipe bombs, checking given damage (>= 1) would be enough.
_debug = false; //hange to true for some debug output
I have just added that possibility for share the function with you guys.
If you set _debug = true you will get log info in rpt and map marker around the installation.
Those markers are basically only visible by server because they are local to server .
If you host the mission or preview in editor you can see those markers.
Thats why i have set switch on debug.
Here I present you guys my figment.
Function to handle AliVE insurgents installations destruction in asymmetrical warfare.
Installations affected:
IED Factory
Recruitment HQ
Weapons Depot
In correlation with the other functions used
creating big explosion and sends notifications
to nearby players about destroyed installation.
It also removes installation trashes.
Change debug and insurgent faction class to meet your needs.
private ["_debug", "_asymFCT", "_vis", "_insIEDfab", "_insRHQ", "_insWPDT", "_choose", "_OPCOM_HANDLER", "_objectives", "_objective", "_factory", "_HQ", "_depot", "_markerF", "_EHExploIdxF", "_markerR", "_EHExploIdxR", "_markerW", "_EHExploIdxW"]; //**************************edit down here*********************// _debug = false; // change to true for some debug output _asymFCT = "OPF_MTI_F"; //change to your insurgents faction class //*************************edit up here***********************// if (_debug) then { _vis = 1; }else{ _vis = 0; }; _insIEDfab = []; _insRHQ = []; _insWPDT = []; if (_asymFCT in (((OPCOM_instances select 0) select 2) select 1)) then { _choose = 0; }else{ _choose = 1; }; _OPCOM_HANDLER = OPCOM_instances select _choose; _objectives = [_OPCOM_HANDLER,"objectives",[]] call ALiVE_fnc_HashGet; { _objective = _x; _factory = [_OPCOM_HANDLER,"convertObject",[_objective,"factory",[]] call ALiVE_fnc_HashGet] call ALiVE_fnc_OPCOM; _insIEDfab pushback _factory; _HQ = [_OPCOM_HANDLER,"convertObject",[_objective,"HQ",[]] call ALiVE_fnc_HashGet] call ALiVE_fnc_OPCOM; _insRHQ pushback _HQ; _depot = [_OPCOM_HANDLER,"convertObject",[_objective,"depot",[]] call ALiVE_fnc_HashGet] call ALiVE_fnc_OPCOM; _insWPDT pushback _depot; } foreach _objectives; _insIEDfab = _insIEDfab - [objNull]; _insRHQ = _insRHQ - [objNull]; _insWPDT = _insWPDT - [objNull]; { if (isnil {_x getVariable "EHExploIdxF"}) then { if !(getText (configfile >> "CfgVehicles" >> typeOf _x >> "destrType") isEqualTo "DestructNo") then { if (_debug) then { diag_log format ["*********** INSURGENCY: IED Factory found as object %1 ***********", typeOf _x]; }; _markerF = createMarkerLocal [format ["%1_factory_%2_%3_%4", floor(random 1000), floor(random 1000),floor(random 1000), _forEachIndex + 1], getpos _x]; _markerF setMarkerSizeLocal [150, 150]; _markerF setMarkerShapeLocal "ELLIPSE"; _markerF setMarkerAlphaLocal _vis; _x setVariable ["factory_marker",_markerF,false]; _EHExploIdxF = _x addEventHandler ["Explosion",{ params ["_object", "_nearBuildings", "_trashes", "_oamarker", "_bomb", "_EHid"]; _nearBuildings = nearestObjects [_object, ["house","building"], 25]; _trashes = nearestObjects [_object, ["Land_RattanTable_01_F","Fridge_01_open_F","Land_WaterCooler_01_new_F","Land_MapBoard_F","ALiVE_IED","Box_East_AmmoOrd_F"], 25]; _oamarker = (_object getVariable "factory_marker"); _EHid = _object getVariable "EHExploIdxF"; _object removeEventHandler ["Explosion", _EHid]; _object setVariable ["EHExploIdxF",nil ,false]; _bomb = createVehicle ["Bo_Mk82",[getPos _object select 0, getPos _object select 1,0],[], 0, 'FLY']; [_bomb,-90,0] call BIS_fnc_setPitchBank; _bomb setVelocity [0, 0, -80]; { _x setDamage 1; if (alive _x) then { deleteVehicle _x; }; } foreach _nearBuildings; {deleteVehicle _x;} foreach _trashes; [_oamarker, "iedfactoryhq", "IED factory"] call INS_fnc_sendNotif; }]; _x setVariable ["EHExploIdxF",_EHExploIdxF,false]; }; }; } forEach _insIEDfab; { if (isnil {_x getVariable "EHExploIdxR"}) then { if !(getText (configfile >> "CfgVehicles" >> typeOf _x >> "destrType") isEqualTo "DestructNo") then { if (_debug) then { diag_log format ["*********** INSURGENCY: Recruitment HQ found as object %1 ***********", typeOf _x]; }; _markerR = createMarkerLocal [format ["%1_rhq_%2_%3_%4", floor(random 1000), floor(random 1000),floor(random 1000), _forEachIndex + 1], getpos _x]; _markerR setMarkerSizeLocal [150, 150]; _markerR setMarkerShapeLocal "ELLIPSE"; _markerR setMarkerAlphaLocal _vis; _x setVariable ["rhq_marker",_markerR,false]; _EHExploIdxR = _x addEventHandler ["Explosion",{ params ["_object", "_nearBuildings", "_trashes", "_oamarker", "_bomb", "_EHid"]; _nearBuildings = nearestObjects [_object, ["house","building"], 25]; _trashes = nearestObjects [_object, ["Land_RattanTable_01_F","Fridge_01_open_F","Land_WaterCooler_01_new_F","Land_MapBoard_F","ALiVE_IED","Box_East_AmmoOrd_F"], 25]; _oamarker = (_object getVariable "rhq_marker"); _EHid = _object getVariable "EHExploIdxR"; _object removeEventHandler ["Explosion", _EHid]; _object setVariable ["EHExploIdxR",nil ,false]; _bomb = createVehicle ["Bo_Mk82",[getPos _object select 0, getPos _object select 1,0],[], 0, 'FLY']; [_bomb,-90,0] call BIS_fnc_setPitchBank; _bomb setVelocity [0, 0, -80]; { _x setDamage 1; if (alive _x) then { deleteVehicle _x; }; } foreach _nearBuildings; {deleteVehicle _x;} foreach _trashes; [_oamarker, "recruitmenthq", "Recruitment HQ"] call INS_fnc_sendNotif; }]; _x setVariable ["EHExploIdxR",_EHExploIdxR,false]; }; }; } forEach _insRHQ; { if (isnil {_x getVariable "EHExploIdxW"}) then { if !(getText (configfile >> "CfgVehicles" >> typeOf _x >> "destrType") isEqualTo "DestructNo") then { if (_debug) then { diag_log format ["*********** INSURGENCY: Weapons Depot found as object %1 ***********", typeOf _x]; }; _markerW = createMarkerLocal [format ["%1_wpd_%2_%3_%4", floor(random 1000), floor(random 1000),floor(random 1000), _forEachIndex + 1], getpos _x]; _markerW setMarkerSizeLocal [150, 150]; _markerW setMarkerShapeLocal "ELLIPSE"; _markerW setMarkerAlphaLocal _vis; _x setVariable ["wpd_marker",_markerW,false]; _EHExploIdxW = _x addEventHandler ["Explosion",{ params ["_object", "_nearBuildings", "_trashes", "_oamarker", "_bomb", "_EHid"]; _nearBuildings = nearestObjects [_object, ["house","building"], 25]; _trashes = nearestObjects [_object, ["Land_RattanTable_01_F","Fridge_01_open_F","Land_WaterCooler_01_new_F","Land_MapBoard_F","ALiVE_IED","Box_East_AmmoOrd_F"], 25]; _oamarker = (_object getVariable "wpd_marker"); _EHid = _object getVariable "EHExploIdxW"; _object removeEventHandler ["Explosion", _EHid]; _object setVariable ["EHExploIdxW",nil ,false]; _bomb = createVehicle ["Bo_Mk82",[getPos _object select 0, getPos _object select 1,0],[], 0, 'FLY']; [_bomb,-90,0] call BIS_fnc_setPitchBank; _bomb setVelocity [0, 0, -80]; { _x setDamage 1; if (alive _x) then { deleteVehicle _x; }; } foreach _nearBuildings; {deleteVehicle _x;} foreach _trashes; [_oamarker, "weaponsdepothq", "Weapons depot"] call INS_fnc_sendNotif; }]; _x setVariable ["EHExploIdxW",_EHExploIdxW,false]; }; }; } forEach _insWPDT;