From 0c3ae05e69a31a546e3a74a2b04a6f60e7e823f4 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Sat, 6 Jan 2018 14:32:32 +0100 Subject: [PATCH 1/7] Add: composition to side mission mines --- .../core/fnc/side/mines.sqf | 150 +++++++++++++++--- 1 file changed, 128 insertions(+), 22 deletions(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf index 643b91f03..da413fb58 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf @@ -1,52 +1,158 @@ -private ["_useful","_city","_pos","_area","_marker","_mines","_closest"]; - -_useful = btc_city_all select {((_x getVariable ["type",""] != "NameLocal") && {_x getVariable ["type",""] != "Hill"} && (_x getVariable ["type",""] != "NameMarine"))}; +private _useful = btc_city_all select {((_x getVariable ["type",""] != "NameLocal") && {_x getVariable ["type",""] != "Hill"} && (_x getVariable ["type",""] != "NameMarine"))}; if (_useful isEqualTo []) then {_useful = + btc_city_all;}; -_city = selectRandom _useful; - -//_pos = [getPos _city, 100] call btc_fnc_randomize_pos; +private _city = selectRandom _useful; +private _pos = [getPos _city, 0, 500, 30, 0, 60 * (pi / 180), 0] call BIS_fnc_findSafePos; -_pos = [getPos _city, 0, 500, 30, 0, 60 * (pi / 180), 0] call BIS_fnc_findSafePos; btc_side_aborted = false; btc_side_done = false; btc_side_failed = false; btc_side_assigned = true;publicVariable "btc_side_assigned"; -[4,_pos,_city getVariable "name"] remoteExec ["btc_fnc_task_create", 0]; +[4, _pos,_city getVariable "name"] remoteExec ["btc_fnc_task_create", 0]; btc_side_jip_data = [4,_pos,_city getVariable "name"]; -_area = createmarker [format ["sm_%1",_pos],_pos]; +private _area = createmarker [format ["sm_%1", _pos], _pos]; _area setMarkerShape "RECTANGLE"; _area setMarkerBrush "SolidBorder"; -_area setMarkerSize [60, 60]; +private _area_size = 60; +_area setMarkerSize [_area_size, _area_size]; _area setMarkerAlpha 0.3; _area setmarkercolor "colorBlue"; -_marker = createmarker [format ["sm_2_%1",_pos],_pos]; +private _marker = createmarker [format ["sm_2_%1",_pos],_pos]; _marker setmarkertype "hd_flag"; [_marker,"STR_BTC_HAM_SIDE_MINES_MRK"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Mines _marker setMarkerSize [0.6, 0.6]; -_mines = []; - +//// Randomise composition \\\\ +private _cone = selectRandom ["Land_RoadCone_01_F", "RoadCone_F"]; +private _fences = ["Land_PlasticNetFence_01_long_F", "RoadBarrier_F", "TapeSign_F"]; +_fences pushBack _cone; +private _fence = selectRandom _fences; +private _portable_light = ["Land_PortableLight_double_F", "Land_PortableLight_single_F"]; +private _first_aid_kits = ["Land_FirstAidKit_01_open_F", "Land_FirstAidKit_01_closed_F"]; + +private _allclass = ("true" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; +_allclass = _allclass select {(getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2)}; +private _body_bags = _allclass select {( + (_x isKindOf "Land_Bodybag_01_base_F") || + (_x isKindOf "Land_Bodybag_01_empty_base_F") || + (_x isKindOf "Land_Bodybag_01_folded_base_F") +)}; +private _signs = _allclass select {(_x isKindOf "Land_Sign_Mines_F")}; +private _bloods = _allclass select {(_x isKindOf "Blood_01_Base_F")}; +private _medicals = _allclass select {(_x isKindOf "MedicalGarbage_01_Base_F")}; +//private _signs = ["Land_SignM_WarningMilAreaSmall_english_F", "Land_Sign_MinesTall_Greek_F", "Land_Sign_Mines_F", "Land_Sign_WarningUnexplodedAmmo_F", "Land_Sign_MinesTall_Greek_F", "Land_Sign_MinesTall_F", "TapeSign_F", "Land_Sign_MinesTall_English_F"]; +private _composition_pattern = [ + [selectRandom _bloods,81,[56.0991,5.71729,0]], + [_fence,180,[-0.100586,59.6567,0]], + [_fence,89,[59.9312,0.149414,0]], + [_fence,0,[0.0664063,-60.0156,0]], + [_fence,89,[-60.0195,-0.0229492,0]], + [_fence,180,[7.91162,59.6299,0]], + [_fence,180,[-8.0874,59.7124,0]], + [_fence,89,[59.9341,-7.6,0]], + [_fence,89,[-60.0166,-8.01172,0]], + [_fence,0,[8.05518,-60.0176,0]], + [_fence,0,[-7.94678,-60.0425,0]], + [_fence,89,[-60.0454,7.99023,0]], + [_cone,0,[60.3545,5.86768,0]], + [selectRandom _signs,270.59,[60.3721,7.92432,0]], + [_cone,0,[60.3755,9.47217,0]], + [selectRandom _signs,91,[-59.6802,-13.3745,0]], + [selectRandom _portable_light,101,[61.1982,3.28906,-4.76837e-007]], + [_fence,180,[15.9023,59.5737,0]], + [selectRandom _portable_light,37,[60.7373,11.856,0]], + [_fence,89,[59.9214,15.2153,0]], + [_fence,180,[-16.1187,59.7456,0]], + [_fence,89,[59.9521,-15.8672,0]], + [_fence,89,[-59.9985,-16.0396,0]], + [_fence,0,[-15.9355,-60.0405,0]], + [_fence,0,[16.084,-60,0]], + [_fence,89,[-60.0488,15.9761,0]], + [selectRandom _bloods,131,[61.9722,5.49609,0]], + [_fence,0,[62.1094,3.81641,0]], + [selectRandom _body_bags,332,[62.4473,0.76416,0]], + [selectRandom _signs,0,[-18.8491,-60.0767,0]], + [selectRandom _bloods,94,[62.3799,8.66309,0]], + [_fence,0,[62.2251,11.064,0]], + [_fence,180,[23.9307,59.5342,0]], + [_fence,89,[59.9019,23.2441,0]], + [_fence,180,[-24.1079,59.8008,0]], + [_fence,89,[59.9541,-23.8569,0]], + [_fence,89,[-59.9966,-24.0293,0]], + [_fence,0,[24.0728,-60.002,0]], + [_fence,0,[-23.9644,-60.0581,0]], + [_fence,89,[-60.0684,24.0049,0]], + [selectRandom _signs,92,[-59.7461,24.9878,0]], + [selectRandom _bloods,0,[65.3276,1.97803,0]], + [selectRandom _medicals,0,[65.4448,1.52734,0]], + [selectRandom _first_aid_kits,0,[65.6187,0.109863,0]], + [selectRandom btc_type_power,223,[63.9292,14.8687,0]], + [selectRandom (btc_type_barrel + btc_type_canister),0,[66.4707,0.0717773,0]], + [_fence,180,[31.9204,59.4849,0]], + [_fence,89,[59.9033,31.2363,0]], + [_fence,89,[59.9731,-31.8613,0]], + [_fence,180,[-32.1099,59.8413,0]], + [_fence,89,[-59.9775,-32.0337,0]], + [_fence,0,[-31.9531,-60.0562,0]], + [_fence,0,[32.0781,-59.9858,0]], + [_fence,89,[-60.0669,31.9971,0]], + [_fence,89,[59.8833,39.2388,0]], + [_fence,180,[39.9248,59.4414,0]], + [selectRandom _signs,0,[39.7676,-59.7939,0]], + [_fence,89,[59.9727,-39.8521,0]], + [_fence,180,[-40.0981,59.8965,0]], + [_fence,89,[-59.978,-40.0244,0]], + [_fence,0,[40.0669,-59.9878,0]], + [_fence,0,[-39.9585,-60.0723,0]], + [_fence,89,[-60.0869,39.9995,0]], + [selectRandom _signs,89.7217,[-59.5522,-43.2207,0]], + [_fence,89,[59.8828,47.2271,0]], + [_fence,180,[47.9146,59.3901,0]], + [_fence,89,[59.9937,-47.8809,0]], + [_fence,89,[-59.957,-48.0532,0]], + [_fence,0,[-47.9473,-60.0703,0]], + [_fence,180,[-48.1284,59.9307,0]], + [_fence,0,[48.0957,-59.9702,0]], + [_fence,89,[-60.0874,47.9878,0]], + [_fence,89,[59.9077,55.2588,0]], + [_fence,180,[55.9414,59.3506,0]], + [_fence,89,[59.9932,-55.8696,0]], + [_fence,89,[-59.9575,-56.042,0]], + [_fence,0,[56.0845,-59.9722,0]], + [_fence,0,[-55.9761,-60.0879,0]], + [_fence,180,[-56.1167,59.9863,0]], + [_fence,89,[-60.1089,56.0181,0]], + [selectRandom _signs,353,[59.5278,-59.5898,0]] +]; +private _composition_objects = [_pos, selectRandom [0, 90, 180, 270], _composition_pattern] call btc_fnc_create_composition; + + +private _mines = []; for "_i" from 1 to (5 + round random 5) do { - private ["_type","_m_pos"]; - _type = "ATMine"; + private _type = "ATMine"; if (random 1 > 0.6) then {_type = selectRandom btc_type_mines;}; - _m_pos = [_pos, 50] call btc_fnc_randomize_pos; - _m = createMine [_type, _m_pos, [], 0]; - _mines pushBack _m; + private _m_pos = [_pos, _area_size - 10] call btc_fnc_randomize_pos; + _mines pushBack createMine [_type, _m_pos, [], 0]; + + if (selectRandom [true, false]) then { + _m_pos = [_pos, _area_size - 10] call btc_fnc_randomize_pos; + private _s = createVehicle [selectRandom _signs, _m_pos, [], 10, "CAN_COLLIDE"]; + _s setDir random 360; + _composition_objects pushBack _s; + }; }; waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || ({_x distance _pos < 200} count playableUnits > 0))}; -_closest = [_city,btc_city_all select {!(_x getVariable ["active",false])},false] call btc_fnc_find_closecity; +private _closest = [_city,btc_city_all select {!(_x getVariable ["active",false])}, false] call btc_fnc_find_closecity; for "_i" from 1 to (round random 2) do { - [_closest,_pos,1,selectRandom btc_type_motorized] spawn btc_fnc_mil_send; + [_closest, _pos, 1, selectRandom btc_type_motorized] spawn btc_fnc_mil_send; }; waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || ({!isNull _x} count _mines == 0))}; @@ -54,11 +160,11 @@ waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || ({!isNull _x} count btc_side_assigned = false;publicVariable "btc_side_assigned"; if (btc_side_aborted || btc_side_failed) exitWith { 4 remoteExec ["btc_fnc_task_fail", 0]; - [[_area,_marker], _mines, [], []] call btc_fnc_delete; + [[_area,_marker], _mines + _composition_objects, [], []] call btc_fnc_delete; }; 30 call btc_fnc_rep_change; 4 remoteExec ["btc_fnc_task_set_done", 0]; -[[_area,_marker], [], [], []] call btc_fnc_delete; +[[_area,_marker], _composition_objects, [], []] call btc_fnc_delete; From 4bdd829a2df295f760e4e5cdedebea727b4baa8c Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Tue, 9 Jan 2018 17:26:15 +0100 Subject: [PATCH 2/7] remove commented _signs --- =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf index da413fb58..99cf9aac3 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf @@ -46,7 +46,6 @@ private _body_bags = _allclass select {( private _signs = _allclass select {(_x isKindOf "Land_Sign_Mines_F")}; private _bloods = _allclass select {(_x isKindOf "Blood_01_Base_F")}; private _medicals = _allclass select {(_x isKindOf "MedicalGarbage_01_Base_F")}; -//private _signs = ["Land_SignM_WarningMilAreaSmall_english_F", "Land_Sign_MinesTall_Greek_F", "Land_Sign_Mines_F", "Land_Sign_WarningUnexplodedAmmo_F", "Land_Sign_MinesTall_Greek_F", "Land_Sign_MinesTall_F", "TapeSign_F", "Land_Sign_MinesTall_English_F"]; private _composition_pattern = [ [selectRandom _bloods,81,[56.0991,5.71729,0]], [_fence,180,[-0.100586,59.6567,0]], From b9658e288e3b462aefb599d1efaeb53ddeb3ac00 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Tue, 9 Jan 2018 17:31:53 +0100 Subject: [PATCH 3/7] RMV () --- .../core/fnc/side/mines.sqf | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf index 99cf9aac3..69c6467f9 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf @@ -37,15 +37,21 @@ private _portable_light = ["Land_PortableLight_double_F", "Land_PortableLight_si private _first_aid_kits = ["Land_FirstAidKit_01_open_F", "Land_FirstAidKit_01_closed_F"]; private _allclass = ("true" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; -_allclass = _allclass select {(getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2)}; -private _body_bags = _allclass select {( +_allclass = _allclass select {getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2}; +private _body_bags = _allclass select { (_x isKindOf "Land_Bodybag_01_base_F") || (_x isKindOf "Land_Bodybag_01_empty_base_F") || (_x isKindOf "Land_Bodybag_01_folded_base_F") -)}; -private _signs = _allclass select {(_x isKindOf "Land_Sign_Mines_F")}; -private _bloods = _allclass select {(_x isKindOf "Blood_01_Base_F")}; -private _medicals = _allclass select {(_x isKindOf "MedicalGarbage_01_Base_F")}; +}; +private _signs = _allclass select {_x isKindOf "Land_Sign_Mines_F"}; +private _bloods = _allclass select {_x isKindOf "Blood_01_Base_F"}; +private _medicals = _allclass select {_x isKindOf "MedicalGarbage_01_Base_F"}; + + + + + + private _composition_pattern = [ [selectRandom _bloods,81,[56.0991,5.71729,0]], [_fence,180,[-0.100586,59.6567,0]], From fa2e68e18d2fa127059c34ddab86f41f4d009e61 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Tue, 9 Jan 2018 21:05:17 +0100 Subject: [PATCH 4/7] Add: random size for the mine field and optimize --- .../core/fnc/side/mines.sqf | 132 ++++++------------ 1 file changed, 40 insertions(+), 92 deletions(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf index 69c6467f9..c4e127cf2 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf @@ -1,5 +1,5 @@ -private _useful = btc_city_all select {((_x getVariable ["type",""] != "NameLocal") && {_x getVariable ["type",""] != "Hill"} && (_x getVariable ["type",""] != "NameMarine"))}; +private _useful = btc_city_all select {(_x getVariable ["type",""] != "NameLocal") && {_x getVariable ["type",""] != "Hill"} && (_x getVariable ["type",""] != "NameMarine")}; if (_useful isEqualTo []) then {_useful = + btc_city_all;}; @@ -11,21 +11,25 @@ btc_side_done = false; btc_side_failed = false; btc_side_assigned = true;publicVariable "btc_side_assigned"; -[4, _pos,_city getVariable "name"] remoteExec ["btc_fnc_task_create", 0]; +[4, _pos, _city getVariable "name"] remoteExec ["btc_fnc_task_create", 0]; btc_side_jip_data = [4,_pos,_city getVariable "name"]; +private _distance_between_fences = 8.1; +private _number_of_fences = 3 + floor random 4; +private _area_size = _distance_between_fences * _number_of_fences; +private _offset = _area_size + _distance_between_fences/2; + private _area = createmarker [format ["sm_%1", _pos], _pos]; _area setMarkerShape "RECTANGLE"; _area setMarkerBrush "SolidBorder"; -private _area_size = 60; -_area setMarkerSize [_area_size, _area_size]; +_area setMarkerSize [_offset, _offset]; _area setMarkerAlpha 0.3; _area setmarkercolor "colorBlue"; -private _marker = createmarker [format ["sm_2_%1",_pos],_pos]; +private _marker = createmarker [format ["sm_2_%1", _pos], _pos]; _marker setmarkertype "hd_flag"; -[_marker,"STR_BTC_HAM_SIDE_MINES_MRK"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Mines +[_marker, "STR_BTC_HAM_SIDE_MINES_MRK"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Mines _marker setMarkerSize [0.6, 0.6]; //// Randomise composition \\\\ @@ -47,97 +51,41 @@ private _signs = _allclass select {_x isKindOf "Land_Sign_Mines_F"}; private _bloods = _allclass select {_x isKindOf "Blood_01_Base_F"}; private _medicals = _allclass select {_x isKindOf "MedicalGarbage_01_Base_F"}; +private _offset_door = - 60 + _offset; +private _composition_pattern = [ + [selectRandom _bloods,81,[56.0991 + _offset_door,5.71729,0]], + [_cone,0,[60.3545 + _offset_door,5.86768,0]], + [_cone,0,[60.3755 + _offset_door,9.47217,0]], + [selectRandom _portable_light,101,[61.1982 + _offset_door,3.28906,0]], + [selectRandom _portable_light,37,[60.7373 + _offset_door,11.856,0]], + [selectRandom _bloods,131,[61.9722 + _offset_door,5.49609,0]], + [selectRandom _body_bags,332,[62.4473 + _offset_door,0.76416,0]], + [selectRandom _bloods,94,[62.3799 + _offset_door,8.66309,0]], + [selectRandom _bloods,0,[65.3276 + _offset_door,1.97803,0]], + [selectRandom _medicals,0,[65.4448 + _offset_door,1.52734,0]], + [selectRandom _first_aid_kits,0,[65.6187 + _offset_door,0.109863,0]], + [selectRandom btc_type_power,223,[63.9292 + _offset_door,14.8687,0]], + [selectRandom (btc_type_barrel + btc_type_canister),0,[66.4707 + _offset_door,0.0717773,0]] +]; +for "_i" from -_number_of_fences to _number_of_fences do { + _composition_pattern pushBack [_fence, 0, [_i * _distance_between_fences, _offset, 0]]; + _composition_pattern pushBack [_fence, 0, [_i * _distance_between_fences, -_offset, 0]]; + if !(_i isEqualTo 1) then { + _composition_pattern pushBack [_fence, 90, [ _offset, _i * _distance_between_fences, 0]]; + }; + _composition_pattern pushBack [_fence, 90, [ -_offset, _i * _distance_between_fences, 0]]; + if (random 1 > 0.7) then { + _composition_pattern pushBack [selectRandom _signs, 180, [_i * _distance_between_fences, _offset - 1, 0]]; + _composition_pattern pushBack [selectRandom _signs, 0, [_i * _distance_between_fences, -_offset + 1, 0]]; + _composition_pattern pushBack [selectRandom _signs, 270, [ _offset - 1, _i * _distance_between_fences, 0]]; + _composition_pattern pushBack [selectRandom _signs, 90, [ -_offset + 1, _i * _distance_between_fences, 0]]; + }; +}; - - -private _composition_pattern = [ - [selectRandom _bloods,81,[56.0991,5.71729,0]], - [_fence,180,[-0.100586,59.6567,0]], - [_fence,89,[59.9312,0.149414,0]], - [_fence,0,[0.0664063,-60.0156,0]], - [_fence,89,[-60.0195,-0.0229492,0]], - [_fence,180,[7.91162,59.6299,0]], - [_fence,180,[-8.0874,59.7124,0]], - [_fence,89,[59.9341,-7.6,0]], - [_fence,89,[-60.0166,-8.01172,0]], - [_fence,0,[8.05518,-60.0176,0]], - [_fence,0,[-7.94678,-60.0425,0]], - [_fence,89,[-60.0454,7.99023,0]], - [_cone,0,[60.3545,5.86768,0]], - [selectRandom _signs,270.59,[60.3721,7.92432,0]], - [_cone,0,[60.3755,9.47217,0]], - [selectRandom _signs,91,[-59.6802,-13.3745,0]], - [selectRandom _portable_light,101,[61.1982,3.28906,-4.76837e-007]], - [_fence,180,[15.9023,59.5737,0]], - [selectRandom _portable_light,37,[60.7373,11.856,0]], - [_fence,89,[59.9214,15.2153,0]], - [_fence,180,[-16.1187,59.7456,0]], - [_fence,89,[59.9521,-15.8672,0]], - [_fence,89,[-59.9985,-16.0396,0]], - [_fence,0,[-15.9355,-60.0405,0]], - [_fence,0,[16.084,-60,0]], - [_fence,89,[-60.0488,15.9761,0]], - [selectRandom _bloods,131,[61.9722,5.49609,0]], - [_fence,0,[62.1094,3.81641,0]], - [selectRandom _body_bags,332,[62.4473,0.76416,0]], - [selectRandom _signs,0,[-18.8491,-60.0767,0]], - [selectRandom _bloods,94,[62.3799,8.66309,0]], - [_fence,0,[62.2251,11.064,0]], - [_fence,180,[23.9307,59.5342,0]], - [_fence,89,[59.9019,23.2441,0]], - [_fence,180,[-24.1079,59.8008,0]], - [_fence,89,[59.9541,-23.8569,0]], - [_fence,89,[-59.9966,-24.0293,0]], - [_fence,0,[24.0728,-60.002,0]], - [_fence,0,[-23.9644,-60.0581,0]], - [_fence,89,[-60.0684,24.0049,0]], - [selectRandom _signs,92,[-59.7461,24.9878,0]], - [selectRandom _bloods,0,[65.3276,1.97803,0]], - [selectRandom _medicals,0,[65.4448,1.52734,0]], - [selectRandom _first_aid_kits,0,[65.6187,0.109863,0]], - [selectRandom btc_type_power,223,[63.9292,14.8687,0]], - [selectRandom (btc_type_barrel + btc_type_canister),0,[66.4707,0.0717773,0]], - [_fence,180,[31.9204,59.4849,0]], - [_fence,89,[59.9033,31.2363,0]], - [_fence,89,[59.9731,-31.8613,0]], - [_fence,180,[-32.1099,59.8413,0]], - [_fence,89,[-59.9775,-32.0337,0]], - [_fence,0,[-31.9531,-60.0562,0]], - [_fence,0,[32.0781,-59.9858,0]], - [_fence,89,[-60.0669,31.9971,0]], - [_fence,89,[59.8833,39.2388,0]], - [_fence,180,[39.9248,59.4414,0]], - [selectRandom _signs,0,[39.7676,-59.7939,0]], - [_fence,89,[59.9727,-39.8521,0]], - [_fence,180,[-40.0981,59.8965,0]], - [_fence,89,[-59.978,-40.0244,0]], - [_fence,0,[40.0669,-59.9878,0]], - [_fence,0,[-39.9585,-60.0723,0]], - [_fence,89,[-60.0869,39.9995,0]], - [selectRandom _signs,89.7217,[-59.5522,-43.2207,0]], - [_fence,89,[59.8828,47.2271,0]], - [_fence,180,[47.9146,59.3901,0]], - [_fence,89,[59.9937,-47.8809,0]], - [_fence,89,[-59.957,-48.0532,0]], - [_fence,0,[-47.9473,-60.0703,0]], - [_fence,180,[-48.1284,59.9307,0]], - [_fence,0,[48.0957,-59.9702,0]], - [_fence,89,[-60.0874,47.9878,0]], - [_fence,89,[59.9077,55.2588,0]], - [_fence,180,[55.9414,59.3506,0]], - [_fence,89,[59.9932,-55.8696,0]], - [_fence,89,[-59.9575,-56.042,0]], - [_fence,0,[56.0845,-59.9722,0]], - [_fence,0,[-55.9761,-60.0879,0]], - [_fence,180,[-56.1167,59.9863,0]], - [_fence,89,[-60.1089,56.0181,0]], - [selectRandom _signs,353,[59.5278,-59.5898,0]] -]; private _composition_objects = [_pos, selectRandom [0, 90, 180, 270], _composition_pattern] call btc_fnc_create_composition; - private _mines = []; for "_i" from 1 to (5 + round random 5) do { private _type = "ATMine"; From 51e7b935ed6e38a2b2a22f825f4752eb0b20fd7c Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Mon, 15 Jan 2018 12:10:45 +0100 Subject: [PATCH 5/7] migrating to mission.sqf --- .../core/def/mission.sqf | 22 +++++-- .../core/fnc/side/mines.sqf | 61 ++++++++----------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf index e610fec70..53749263b 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf @@ -72,6 +72,9 @@ if (!isMultiplayer) then {btc_debug_log = true;btc_debug = true;}; if (isServer) then { btc_final_phase = false; + private _allclass = ("true" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; + _allclass = _allclass select {getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2}; + //City btc_city_radius = _p_city_radius; btc_city_blacklist = [];//NAME FROM CFG @@ -147,6 +150,18 @@ if (isServer) then { btc_type_mines = ["APERSMine","APERSBoundingMine","APERSTripMine"]; btc_type_power = ["WaterPump_01_sand_F","WaterPump_01_forest_F","Land_PressureWasher_01_F","Land_DieselGroundPowerUnit_01_F","Land_JetEngineStarter_01_F","Land_PowerGenerator_F","Land_PortableGenerator_01_F"]; btc_type_cord = ["Land_ExtensionCord_F"]; + btc_type_cones = ["Land_RoadCone_01_F", "RoadCone_F"]; + btc_type_fences = ["Land_PlasticNetFence_01_long_F", "RoadBarrier_F", "TapeSign_F"]; + btc_type_portable_light = ["Land_PortableLight_double_F", "Land_PortableLight_single_F"]; + btc_type_first_aid_kits = ["Land_FirstAidKit_01_open_F", "Land_FirstAidKit_01_closed_F"]; + btc_type_body_bags = _allclass select { + (_x isKindOf "Land_Bodybag_01_base_F") || + (_x isKindOf "Land_Bodybag_01_empty_base_F") || + (_x isKindOf "Land_Bodybag_01_folded_base_F") + }; + btc_type_signs = _allclass select {_x isKindOf "Land_Sign_Mines_F"}; + btc_type_bloods = _allclass select {_x isKindOf "Blood_01_Base_F"}; + btc_type_medicals = _allclass select {_x isKindOf "MedicalGarbage_01_Base_F"}; //Vehs btc_vehicles = [btc_veh_1,btc_veh_2,btc_veh_3,btc_veh_4,btc_veh_5,btc_veh_6,btc_veh_7,btc_veh_8,btc_veh_9,btc_veh_10,btc_veh_11,btc_veh_12,btc_veh_13,btc_veh_14,btc_veh_15]; @@ -243,6 +258,9 @@ btc_respawn_marker = "respawn_west"; if (isServer) then { #define REARM_TURRET_PATHS [[-1], [0], [0,0], [0,1], [1], [2], [0,2]] + private _allclass = ("true" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; + _allclass = _allclass select {getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2}; + _btc_rearming_vehicles = [btc_vehicles + btc_helo,[]] call btc_fnc_find_veh_with_turret; private _btc_rearming_magazines = []; { @@ -252,10 +270,6 @@ if (isServer) then { _btc_rearming_magazines pushBack _magazines; } forEach _btc_rearming_vehicles; - - private _allclass = ("true" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; - _allclass = _allclass select {(getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2)}; - _btc_rearming_static = [ //"Static" diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf index c4e127cf2..db4495489 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf @@ -13,7 +13,7 @@ btc_side_assigned = true;publicVariable "btc_side_assigned"; [4, _pos, _city getVariable "name"] remoteExec ["btc_fnc_task_create", 0]; -btc_side_jip_data = [4,_pos,_city getVariable "name"]; +btc_side_jip_data = [4, _pos, _city getVariable "name"]; private _distance_between_fences = 8.1; private _number_of_fences = 3 + floor random 4; @@ -33,54 +33,45 @@ _marker setmarkertype "hd_flag"; _marker setMarkerSize [0.6, 0.6]; //// Randomise composition \\\\ -private _cone = selectRandom ["Land_RoadCone_01_F", "RoadCone_F"]; -private _fences = ["Land_PlasticNetFence_01_long_F", "RoadBarrier_F", "TapeSign_F"]; +private _cone = selectRandom btc_type_cones; +private _fences = + btc_type_fences; _fences pushBack _cone; private _fence = selectRandom _fences; -private _portable_light = ["Land_PortableLight_double_F", "Land_PortableLight_single_F"]; -private _first_aid_kits = ["Land_FirstAidKit_01_open_F", "Land_FirstAidKit_01_closed_F"]; - -private _allclass = ("true" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; -_allclass = _allclass select {getNumber(configfile >> "CfgVehicles" >> _x >> "scope") isEqualTo 2}; -private _body_bags = _allclass select { - (_x isKindOf "Land_Bodybag_01_base_F") || - (_x isKindOf "Land_Bodybag_01_empty_base_F") || - (_x isKindOf "Land_Bodybag_01_folded_base_F") -}; -private _signs = _allclass select {_x isKindOf "Land_Sign_Mines_F"}; -private _bloods = _allclass select {_x isKindOf "Blood_01_Base_F"}; -private _medicals = _allclass select {_x isKindOf "MedicalGarbage_01_Base_F"}; private _offset_door = - 60 + _offset; private _composition_pattern = [ - [selectRandom _bloods,81,[56.0991 + _offset_door,5.71729,0]], + [selectRandom btc_type_bloods,81,[56.0991 + _offset_door,5.71729,0]], [_cone,0,[60.3545 + _offset_door,5.86768,0]], [_cone,0,[60.3755 + _offset_door,9.47217,0]], - [selectRandom _portable_light,101,[61.1982 + _offset_door,3.28906,0]], - [selectRandom _portable_light,37,[60.7373 + _offset_door,11.856,0]], - [selectRandom _bloods,131,[61.9722 + _offset_door,5.49609,0]], - [selectRandom _body_bags,332,[62.4473 + _offset_door,0.76416,0]], - [selectRandom _bloods,94,[62.3799 + _offset_door,8.66309,0]], - [selectRandom _bloods,0,[65.3276 + _offset_door,1.97803,0]], - [selectRandom _medicals,0,[65.4448 + _offset_door,1.52734,0]], - [selectRandom _first_aid_kits,0,[65.6187 + _offset_door,0.109863,0]], + [selectRandom btc_type_portable_light,101,[61.1982 + _offset_door,3.28906,0]], + [selectRandom btc_type_portable_light,37,[60.7373 + _offset_door,11.856,0]], + [selectRandom btc_type_bloods,131,[61.9722 + _offset_door,5.49609,0]], + [selectRandom btc_type_body_bags,332,[62.4473 + _offset_door,0.76416,0]], + [selectRandom btc_type_bloods,94,[62.3799 + _offset_door,8.66309,0]], + [selectRandom btc_type_bloods,0,[65.3276 + _offset_door,1.97803,0]], + [selectRandom btc_type_medicals,0,[65.4448 + _offset_door,1.52734,0]], + [selectRandom btc_type_first_aid_kits,0,[65.6187 + _offset_door,0.109863,0]], [selectRandom btc_type_power,223,[63.9292 + _offset_door,14.8687,0]], [selectRandom (btc_type_barrel + btc_type_canister),0,[66.4707 + _offset_door,0.0717773,0]] ]; for "_i" from -_number_of_fences to _number_of_fences do { - _composition_pattern pushBack [_fence, 0, [_i * _distance_between_fences, _offset, 0]]; - _composition_pattern pushBack [_fence, 0, [_i * _distance_between_fences, -_offset, 0]]; + _composition_pattern append [ + [_fence, 0, [_i * _distance_between_fences, -_offset, 0]], + [_fence, 0, [_i * _distance_between_fences, _offset, 0]], + [_fence, 90, [ -_offset, _i * _distance_between_fences, 0]] + ]; if !(_i isEqualTo 1) then { _composition_pattern pushBack [_fence, 90, [ _offset, _i * _distance_between_fences, 0]]; }; - _composition_pattern pushBack [_fence, 90, [ -_offset, _i * _distance_between_fences, 0]]; if (random 1 > 0.7) then { - _composition_pattern pushBack [selectRandom _signs, 180, [_i * _distance_between_fences, _offset - 1, 0]]; - _composition_pattern pushBack [selectRandom _signs, 0, [_i * _distance_between_fences, -_offset + 1, 0]]; - _composition_pattern pushBack [selectRandom _signs, 270, [ _offset - 1, _i * _distance_between_fences, 0]]; - _composition_pattern pushBack [selectRandom _signs, 90, [ -_offset + 1, _i * _distance_between_fences, 0]]; + _composition_pattern append [ + [selectRandom btc_type_signs, 180, [_i * _distance_between_fences, _offset - 1, 0]], + [selectRandom btc_type_signs, 0, [_i * _distance_between_fences, -_offset + 1, 0]], + [selectRandom btc_type_signs, 270, [ _offset - 1, _i * _distance_between_fences, 0]], + [selectRandom btc_type_signs, 90, [ -_offset + 1, _i * _distance_between_fences, 0]] + ]; }; }; @@ -93,15 +84,15 @@ for "_i" from 1 to (5 + round random 5) do { private _m_pos = [_pos, _area_size - 10] call btc_fnc_randomize_pos; _mines pushBack createMine [_type, _m_pos, [], 0]; - if (selectRandom [true, false]) then { + if (random 1 > 0.8) then { _m_pos = [_pos, _area_size - 10] call btc_fnc_randomize_pos; - private _s = createVehicle [selectRandom _signs, _m_pos, [], 10, "CAN_COLLIDE"]; + private _s = createVehicle [selectRandom btc_type_signs, _m_pos, [], 10, "CAN_COLLIDE"]; _s setDir random 360; _composition_objects pushBack _s; }; }; -waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || ({_x distance _pos < 200} count playableUnits > 0))}; +waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || ({_x distance _pos < 100} count playableUnits > 0))}; private _closest = [_city,btc_city_all select {!(_x getVariable ["active",false])}, false] call btc_fnc_find_closecity; for "_i" from 1 to (round random 2) do { From d4120563ee654f223ba67dfefcb25782736f99a8 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Tue, 16 Jan 2018 14:47:11 +0100 Subject: [PATCH 6/7] FIX: composition follow terrain shape --- .../core/fnc/common/create_composition.sqf | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/common/create_composition.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/common/create_composition.sqf index d99cc8f7b..abed384d4 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/common/create_composition.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/common/create_composition.sqf @@ -1,25 +1,19 @@ -private ["_pos","_setdir","_array","_type","_dir","_rel_pos","_rel_x","_rel_y","_rel_z","_pos_z","_pos_x","_pos_y","_obj","_pos_obj"]; +params ["_pos", "_setdir", "_array"]; +_pos params ["_pos_x", "_pos_y", ["_pos_z", 0]]; -_pos = _this select 0; -//// Direction parameter is align with compass \\\\ -_setdir = -(_this select 1); -_array = _this select 2; -_pos_x = _pos select 0; -_pos_y = _pos select 1; -_pos_z = 0;if (count _pos > 2) then {_pos_z = _pos select 2;}; _array apply { - _type = _x select 0; - //// Determine direction function of setdir \\\\ - _dir = ((_x select 1) - _setdir); - _rel_pos = _x select 2; - _rel_x = _rel_pos select 0; - _rel_y = _rel_pos select 1; - _rel_z = _rel_pos select 2; + _x params ["_type", "_dir", "_rel_pos"]; + _rel_pos params ["_rel_x", "_rel_y", ["_rel_z", 0]]; + //// Determine position function of setdir \\\\ - _pos_obj = [(_pos_x + _rel_x*cos(_setdir) - _rel_y*sin(_setdir)),(_pos_y + _rel_y*cos(_setdir) + _rel_x*sin(_setdir)),(_pos_z + _rel_z)]; - _obj = createVehicle [_type, _pos_obj, [], 0, "CAN_COLLIDE"]; - _obj setDir _dir; - _obj setPos _pos_obj; + private _final = [_pos_x + _rel_x*cos(_setdir) - _rel_y*sin(- _setdir), _pos_y + _rel_y*cos(_setdir) + _rel_x*sin(- _setdir)]; + _final pushBack (_pos_z + _rel_z + getTerrainHeightASL _final); + private _obj = createVehicle [_type, ASLToATL _final, [], 0, "CAN_COLLIDE"]; + //// Determine direction function of setdir \\\\ + _obj setDir (_dir + _setdir); + + _obj setVectorUp surfaceNormal position _obj; + _obj setPosWorld getPosWorld _obj; _obj; }; From a14512f6c97f6b960dec0772cb9fd392b4751907 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Tue, 16 Jan 2018 15:37:34 +0100 Subject: [PATCH 7/7] Add: Land_PlasticNetFence_01_long_d_F --- =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf index c8a88fce4..db9fb98cf 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf @@ -148,7 +148,7 @@ if (isServer) then { btc_type_power = ["WaterPump_01_sand_F","WaterPump_01_forest_F","Land_PressureWasher_01_F","Land_DieselGroundPowerUnit_01_F","Land_JetEngineStarter_01_F","Land_PowerGenerator_F","Land_PortableGenerator_01_F"]; btc_type_cord = ["Land_ExtensionCord_F"]; btc_type_cones = ["Land_RoadCone_01_F", "RoadCone_F"]; - btc_type_fences = ["Land_PlasticNetFence_01_long_F", "RoadBarrier_F", "TapeSign_F"]; + btc_type_fences = ["Land_PlasticNetFence_01_long_F", "Land_PlasticNetFence_01_long_d_F", "RoadBarrier_F", "TapeSign_F"]; btc_type_portable_light = ["Land_PortableLight_double_F", "Land_PortableLight_single_F"]; btc_type_first_aid_kits = ["Land_FirstAidKit_01_open_F", "Land_FirstAidKit_01_closed_F"]; btc_type_body_bags = _allclass select {