Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////
- // ElcaGarage v0.1 //
- // //
- // USE: Write this in the garage init //
- // null = [this] execVM "GarageInit.sqf"; //
- // //
- //////////////////////////////////////////////////////////////
- // VARIABLES
- _veh = _this select 0;
- _veh_type = (typeOf _veh);
- if (isnil "Elca_Variables") then
- {
- Elca_Variables = true;
- Action_Priority = 20;
- Max_Speed = 10;
- Max_Alt = 2;
- Max_Distance = 3;
- //Black screen during in or out of garage
- Black_Screen = true;
- //Usage of doors and animation
- //Doors = false
- Supported_Vehicles_SMALL = ["C_Quadbike_01_F", "C_Scooter_Transport_01_F"];
- Supported_Vehicles_MID = ["C_Offroad_01_F", "C_SUV_01_F", "C_Offroad_02_unarmed_F","C_Rubberboat","C_Van_01_fuel_F","B_GEN_Offroad_01_gen_F"];
- Supported_Vehicles_BIG = ["C_Truck_02_transport_F","C_Truck_02_fuel_F"];
- Supported_Vehicles_ALL = Supported_Vehicles_SMALL + Supported_Vehicles_MID + Supported_Vehicles_BIG;
- };
- //
- if (isnil "Elca_Functions") then
- {
- Elca_Functions = true;
- dev_trying = // Ignore
- {
- _blocking = [];
- {
- hint "New object found!";
- _blocking = _blocking + [_x];
- _arrow_1 = "Sign_Arrow_Large_Blue_F" createVehicle (_x modelToWorld [0,0,2]);
- sleep 2;
- _pos = getPos _x;
- _bbr = boundingBoxReal _x;
- _p1 = [_bbr select 0 select 0, _bbr select 0 select 1];
- _p2 = [_bbr select 1 select 0, _bbr select 1 select 1];
- hint str _p1;
- _arrow_2 = "Sign_Arrow_Blue_F" createVehicle _p1;
- sleep 5;
- hint str _p2;
- _arrow_3 = "Sign_Arrow_Blue_F" createVehicle (getPos _p2);
- sleep 5;
- {
- deleteVehicle _x;
- } forEach [_arrow_1,_arrow_2,_arrow_3];
- } forEach nearestObjects [q1, Supported_Vehicles_ALL, 20, true];
- while {true} do
- {
- sleep (random [5,10,2]);
- {
- if !(_x in nearestObjects [q1, Supported_Vehicles_ALL, 20, true]) then
- {
- _blocking = _blocking - [_x];
- };
- } forEach (_blocking);
- {
- hint "New object found!";
- _blocking = _blocking + [_x];
- _arrow_1 = "Sign_Arrow_Large_Blue_F" createVehicle (_x modelToWorld [0,0,2]);
- sleep 2;
- _pos = getPos _x;
- _bbr = boundingBoxReal _x;
- _p1 = [_bbr select 0 select 0, _bbr select 0 select 1];
- _p2 = [_bbr select 1 select 0, _bbr select 1 select 1];
- hint str _p1;
- _arrow_2 = "Sign_Arrow_Blue_F" createVehicle (getPos _p1);
- sleep 5;
- hint str _p2;
- _arrow_3 = "Sign_Arrow_Blue_F" createVehicle (getPos _p2);
- sleep 5;
- {
- deleteVehicle _x;
- } forEach [_arrow_1,_arrow_2,_arrow_3];
- } forEach nearestObjects [q1, Supported_Vehicles_ALL, 20, true];
- hint str (count _blocking);
- };
- };
- Elca_fnc_movement =
- {
- if (_obj distance _pos1 < Max_Distance) then
- {
- move_pos = _pos3;
- } else {
- if (_obj distance _pos2 < Max_Distance) then
- {
- move_pos = _pos4;
- } else {
- if (_obj distance _pos3 < (Max_Distance + 2)) then
- {
- move_pos = _pos1;
- } else {
- if (_obj distance _pos4 < (Max_Distance + 2)) then
- {
- move_pos = _pos2;
- } else { hint "Error in Elca_fnc_movement" };
- }
- }
- };
- if (Black_Screen) then {
- cutText ["","BLACK FADED",1];
- _obj setPos move_pos;
- sleep 1;
- cutText [" ","BLACK IN",1];
- } else {
- _obj setPos move_pos;
- };
- };
- Elca_move =
- {
- _obj = _this select 0;
- _kind = _this select 1;
- switch (_kind) do
- {
- case 1:
- {
- _pos1 = pad1 modelToWorld [0,-2.3,0];
- _pos2 = pad2 modelToWorld [0,-2.3,0];
- _pos3 = pad1 modelToWorld [0,2,0];
- _pos4 = pad2 modelToWorld [0,2,0];
- call Elca_fnc_movement;
- };
- case 2:
- {
- _pos1 = pad1 modelToWorld [0,-4,0];
- _pos2 = pad2 modelToWorld [0,-4,0];
- _pos3 = pad1 modelToWorld [0,4,0];
- _pos4 = pad2 modelToWorld [0,4,0];
- call Elca_fnc_movement;
- };
- case 3:
- {
- _pos1 = pad1 modelToWorld [0,-5.5,0];
- _pos2 = pad2 modelToWorld [0,-5.5,0];
- _pos3 = pad1 modelToWorld [0,4,0];
- _pos4 = pad2 modelToWorld [0,4,0];
- call Elca_fnc_movement;
- };
- };
- };
- };
- if (_veh_type in Supported_Vehicles_SMALL) then
- {
- _cond_1 = "((((_target getRelDir pad1) <= 40) OR ((_target getRelDir pad1) >= 320)) OR (((_target getRelDir pad1) <= 220) AND ((_target getRelDir pad1) >= 140))) AND (_target distance (pad1 modelToWorld [0,-2.3,0]) < Max_Distance) AND ((speed _target) <= Max_Speed) AND (((getPos _target) select 2) <= Max_Alt) AND ((driver _target == player) OR (vehicle player == player))";
- _cond_2 = "((((_target getRelDir pad2) <= 40) OR ((_target getRelDir pad2) >= 320)) OR (((_target getRelDir pad2) <= 220) AND ((_target getRelDir pad2) >= 140))) AND (_target distance (pad2 modelToWorld [0,-2.3,0]) < Max_Distance) AND ((speed _target) <= Max_Speed) AND (((getPos _target) select 2) <= Max_Alt) AND ((driver _target == player) OR (vehicle player == player))";
- _cond_3 = "(_target distance (pad1 modelToWorld [0,2,0]) < 3) OR (_target distance (pad2 modelToWorld [0,2,0]) < 3) AND ((driver _target == player) OR (vehicle player == player)) AND !((_target distance (pad1 modelToWorld [0,-2.3,0]) < Max_Distance) OR (_target distance (pad2 modelToWorld [0,-2.3,0]) < Max_Distance))";
- _veh addAction [
- "<t color=""#7FFF00"">Enter left garage</t>",
- {
- [_this select 0, _this select 3] spawn Elca_move;
- },1,Action_Priority,true,true,"",_cond_1,3];
- _veh addAction [
- "<t color=""#7FFF00"">Enter right garage</t>",
- {
- [_this select 0, _this select 3] spawn Elca_move;
- },1,Action_Priority,true,true,"",_cond_2,3];
- _veh addAction [
- "<t color=""#FF0000"">Exit garage</t>",
- {
- [_this select 0,_this select 3] spawn Elca_move;
- },1,5,true,true,"",_cond_3,3];
- };
- if (_veh_type in Supported_Vehicles_MID) then
- {
- _cond_1 = "((((_target getRelDir pad1) <= 15) OR ((_target getRelDir pad1) >= 345)) OR (((_target getRelDir pad1) <= 195) AND ((_target getRelDir pad1) >= 165))) AND (_target distance (pad1 modelToWorld [0,-4,0]) < Max_Distance) AND ((speed _target) <= Max_Speed) AND (((getPos _target) select 2) <= Max_Alt) AND ((driver _target == player) OR (vehicle player == player))";
- _cond_2 = "((((_target getRelDir pad2) <= 15) OR ((_target getRelDir pad2) >= 345)) OR (((_target getRelDir pad2) <= 195) AND ((_target getRelDir pad2) >= 165))) AND (_target distance (pad2 modelToWorld [0,-4,0]) < Max_Distance) AND ((speed _target) <= Max_Speed) AND (((getPos _target) select 2) <= Max_Alt) AND ((driver _target == player) OR (vehicle player == player))";
- _cond_3 = "(_target distance (pad1 modelToWorld [0,3.2,0]) < 3) OR (_target distance (pad2 modelToWorld [0,3.2,0]) < 3) AND ((driver _target == player) OR (vehicle player == player)) AND !((_target distance (pad1 modelToWorld [0,-4,0]) < Max_Distance) OR (_target distance (pad2 modelToWorld [0,-4,0]) < Max_Distance))";
- _veh addAction [
- "<t color=""#7FFF00"">Enter left garage</t>",
- {
- [_this select 0, _this select 3] spawn Elca_move;
- },2,Action_Priority,true,true,"",_cond_1,3];
- _veh addAction [
- "<t color=""#7FFF00"">Enter right garage</t>",
- {
- [_this select 0, _this select 3] spawn Elca_move;
- },2,Action_Priority,true,true,"",_cond_2,3];
- _veh addAction [
- "<t color=""#FF0000"">Exit garage</t>",
- {
- [_this select 0,_this select 3] spawn Elca_move;
- },2,5,true,true,"",_cond_3,3];
- };
- if (_veh_type in Supported_Vehicles_BIG) then
- {
- _cond_1 = "((((_target getRelDir pad1) <= 10) OR ((_target getRelDir pad1) >= 350)) OR (((_target getRelDir pad1) <= 190) AND ((_target getRelDir pad1) >= 170))) AND (_target distance (pad1 modelToWorld [0,-5.5,0]) < Max_Distance) AND ((speed _target) <= Max_Speed) AND (((getPos _target) select 2) <= Max_Alt) AND ((driver _target == player) OR (vehicle player == player))";
- _cond_2 = "((((_target getRelDir pad2) <= 10) OR ((_target getRelDir pad2) >= 350)) OR (((_target getRelDir pad2) <= 190) AND ((_target getRelDir pad2) >= 170))) AND (_target distance (pad2 modelToWorld [0,-5.5,0]) < Max_Distance) AND ((speed _target) <= Max_Speed) AND (((getPos _target) select 2) <= Max_Alt) AND ((driver _target == player) OR (vehicle player == player))";
- _cond_3 = "(_target distance (pad1 modelToWorld [0,4,0]) < 4) OR (_target distance (pad2 modelToWorld [0,4,0]) < 4) AND ((driver _target == player) OR (vehicle player == player)) AND !((_target distance (pad1 modelToWorld [0,-4,0]) < Max_Distance) OR (_target distance (pad2 modelToWorld [0,-4,0]) < Max_Distance))";
- _veh addAction [
- "<t color=""#7FFF00"">Enter left garage</t>",
- {
- [_this select 0, _this select 3] spawn Elca_move;
- },3,Action_Priority,true,true,"",_cond_1,5];
- _veh addAction [
- "<t color=""#7FFF00"">Enter right garage</t>",
- {
- [_this select 0, _this select 3] spawn Elca_move;
- },3,Action_Priority,true,true,"",_cond_2,5];
- _veh addAction [
- "<t color=""#FF0000"">Exit garage</t>",
- {
- [_this select 0,_this select 3] spawn Elca_move;
- },3,5,true,true,"",_cond_3,5];
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement