Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private ["_box1", "_box2", "_box3", "_box4", "_box4_1", "_box5", "_box6", "_box7", "_box8", "_box9", "_box14", "_box16", "_FFA_LHOUSEV", "_FFA_HOUSES", "_housev", "_i", "_nBuilding", "_dirVector", "_objVector", "_center", "_type", "_house", "_hcenter", "_px", "_py", "_FFA_CHOUSEV"];
FFA_CLOSEHOUSE=["Land_HouseV_1I1","Land_HouseV_1I2","Land_HouseV_2L","Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1",
"Land_houseV_2T1","Land_houseV_2T2","Land_HouseV_1T","Land_HouseV_2I","Land_HouseV_1I4","Land_HouseV_1I3","Land_HouseV_1L2","Land_HouseV2_03B","Land_HouseV2_03",
"Land_HouseV2_01A","Land_HouseV2_01B","Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05","Land_SS_hangar","Land_A_Office02","Land_A_Hospital",
"Land_Ind_Workshop01_03","Land_Ind_Pec_03b","Land_Ind_Pec_03a","Land_Ind_Pec_02","Land_Ind_SawMill"];
if (isServer) then
{
_box1=[["Land_HouseV_1I1","Land_HouseV_1I2"],["Land_i_Stone_Shed_V2_F","Land_i_Stone_Shed_V3_F"]];
_box2=[["Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1"],["Land_i_Stone_HouseBig_V2_F","Land_i_Stone_HouseBig_V3_F","Land_i_House_Small_01_V1_F","Land_i_House_Small_01_V2_F","Land_i_House_Small_01_V3_F"]];
_box3=[["Land_houseV_2T2"],["Land_i_House_Small_02_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_02_V2_F","Land_i_Shop_02_V3_F","Land_i_House_Small_02_V2_F","Land_i_House_Small_02_V3_F"]];
_box4=[["Land_houseV_2T1"],["Land_i_House_Small_02_V1_F","Land_i_House_Small_02_V2_F","Land_i_House_Small_02_V3_F"]];
_box4_1=[["Land_HouseV_2L"],["Land_Sara_domek05"]];
_box5=[["Land_HouseV_2I","Land_HouseV_1I4","Land_HouseV_1I3","Land_HouseV_1L2"],["Land_i_House_Big_01_V1_F","Land_i_House_Big_01_V2_F","Land_i_House_Big_01_V3_F"]];
_box6=[["Land_HouseV_1T","Land_HouseV2_03B","Land_HouseV2_01A","Land_HouseV2_01B"],["Land_i_Stone_HouseSmall_V2_F","Land_i_Stone_HouseSmall_V2_F","Land_i_Shop_01_V1_F","Land_i_House_Big_02_V1_F","Land_i_House_Big_02_V2_F","Land_i_House_Big_02_V3_F"]];
_box7=[["Land_HouseV2_03"],["Land_i_Barracks_V2_F"]];
_box8=[["Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05"],["Land_i_House_Big_01_V1_F","Land_i_House_Big_01_V2_F","Land_i_House_Big_01_V3_F"/* ,"Land_Unfinished_Building_02_F" */]];
_box9=[["Land_A_Hospital","Land_A_Office02","Land_Ind_SawMill"],["Land_Offices_01_V1_F"]];
_box14=[["Land_Ind_Workshop01_03"],["Land_Ind_Workshop01_04"]];
_box16=[[ "Land_Ind_Pec_03b","Land_Ind_Pec_02","Land_Ind_Pec_03a"],["Land_Offices_01_V1_F"]];
_FFA_LHOUSEV=[];
_FFA_HOUSES=[];
_FFA_LHOUSEV=nearestObjects [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"),["house"],15000];
for "_i" from 0 to (count _FFA_LHOUSEV)-1 do
{
_housev=_FFA_LHOUSEV select _i;
if ((typeof _housev) in FFA_CLOSEHOUSE) then
{
_FFA_HOUSES pushBack _housev;
};
};
for "_i" from 0 to (count _FFA_HOUSES)-1 do
{
_nBuilding =_FFA_HOUSES select _i;
_dirVector = vectorDir _nBuilding;
_objVector = vectorUp _nBuilding;
_center = boundingCenter _nBuilding;
_pos = ASLtoATL getPosASL _nBuilding;
call {
if ((typeof _nBuilding) =="Land_Ind_Pec_03a") exitwith { _pos set [0,(_pos select 0)-2]; _pos set [1,(_pos select 1)-4];};
if ((typeof _nBuilding) =="Land_Ind_Pec_02") exitwith { _pos set [0,(_pos select 0)-7];};
};
_pos set [2,0];
_nBuilding hideObject true;
_type="";
call{
if ((typeof _nBuilding) in (_box1 select 0)) exitwith {_type=(_box1 select 1) select (floor random (count (_box1 select 1)));};
if ((typeof _nBuilding) in (_box2 select 0)) exitwith {_type=(_box2 select 1) select (floor random (count (_box2 select 1)));};
if ((typeof _nBuilding) in (_box3 select 0)) exitwith {_type=(_box3 select 1) select (floor random (count (_box3 select 1)));};
if ((typeof _nBuilding) in (_box4 select 0)) exitwith {_type=(_box4 select 1) select (floor random (count (_box4 select 1)));};
if ((typeof _nBuilding) in (_box4_1 select 0)) exitwith {_type=(_box4_1 select 1) select (floor random (count (_box4_1 select 1)));};
if ((typeof _nBuilding) in (_box5 select 0)) exitwith {_type=(_box5 select 1) select (floor random (count (_box5 select 1)));};
if ((typeof _nBuilding) in (_box6 select 0)) exitwith {_type=(_box6 select 1) select (floor random (count (_box6 select 1)));};
if ((typeof _nBuilding) in (_box7 select 0)) exitwith {_type=(_box7 select 1) select (floor random (count (_box7 select 1)));};
if ((typeof _nBuilding) in (_box8 select 0)) exitwith {_type=(_box8 select 1) select (floor random (count (_box8 select 1)));};
if ((typeof _nBuilding) in (_box9 select 0)) exitwith {_type=(_box9 select 1) select (floor random (count (_box9 select 1)));};
if ((typeof _nBuilding) in (_box14 select 0)) exitwith {_type=(_box14 select 1) select (floor random (count (_box14 select 1)));};
if ((typeof _nBuilding) in (_box16 select 0)) exitwith {_type=(_box16 select 1) select (floor random (count (_box16 select 1)));};
};
_house = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
_hcenter = boundingCenter _house;
_house setdir (getdir _nBuilding);
_px= (_hcenter select 0) - (_center select 0);
_py= (_hcenter select 1) - (_center select 1);
if ((typeof _house) !="Land_Offices_01_V1_F") then {
_house setposatl [((getposatl _house)select 0) - _px,((getposatl _house) select 1) - _py,(getposatl _house) select 2];
};
call {
if ((typeof _house) in (_box4_1 select 1) && ((typeof _nBuilding) in (_box4_1 select 0))) exitwith {_house setdir ((getdir _nBuilding)-90);};
if ((typeof _house) in (_box16 select 1) && ((typeof _nBuilding) in (_box16 select 0))) exitwith {_house setdir ((getdir _nBuilding)+90);};
if ((typeof _house) =="Land_i_Shop_01_V1_F") exitwith {_house setdir ((getdir _nBuilding)-90);};
};
};
};
if(!isServer || local player)then
{
waitUntil{(player==player)};
waitUntil{alive player};
waitUntil{local player};
_FFA_CHOUSEV=[];
_FFA_CHOUSEV=nearestObjects [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"),["house"],15000];
for "_i" from 0 to (count _FFA_CHOUSEV)-1 do
{
_housev=_FFA_CHOUSEV select _i;
if ((typeof _housev) in FFA_CLOSEHOUSE) then
{
_housev hideObject true;
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment