There is another huge multi-part building in Arma 3, which also has sliding doors, 4 of them actually – Airport Terminal. So I thought might as well make a function to spawn and automate it. And good job I did this because I’ve learned that there could be several different centers in a model and that getPos could be very different from getPosATL even if the object is at z=0 in both cases. I will probably make a separate blog post about it, but for now here is how to build Airport Terminal:
KK_fnc_buildAirportTerminal = {
private ["_fnc","_tr","_main","_side"];
_fnc = {
{
_tr = createTrigger [
"EmptyDetector",
_side modelToWorld _x
];
_tr setVariable ["parent", _side];
_tr setTriggerArea [5, 5, 0, false];
_tr setTriggerActivation ["ANY", "PRESENT", true];
_tr setTriggerStatements [
"this",
format [
"
(thisTrigger getVariable 'parent')
animate ['Door_%1A_move', 1];
(thisTrigger getVariable 'parent')
animate ['Door_%1B_move', 1];
", _forEachIndex + 7
],
format [
"
(thisTrigger getVariable 'parent')
animate ['Door_%1A_move', 0];
(thisTrigger getVariable 'parent')
animate ['Door_%1B_move', 0];
", _forEachIndex + 7
]
];
_side setVariable [format [
"bis_disabled_Door_%1",
_forEachIndex + 7
], 1, true];
} forEach _this;
};
_main = createVehicle ["Land_Airport_center_F", [0,0,0], [], 0, "NONE"];
_main setDir (_this select 0);
_main setPosATL (_this select 1);
_side = createVehicle ["Land_Airport_left_F", [0,0,0], [], 0, "NONE"];
_side attachTo [_main, [19.6722,-4.61768,4.04246]];
detach _side;
[
[-0.62,-15.16,-7],
[-0.62,15.16,-7]
] call _fnc;
_side = createVehicle ["Land_Airport_right_F", [0,0,0], [], 0, "NONE"];
_side attachTo [_main, [-19.5177,-4.61768,4.04246]];
detach _side;
[
[0.62,-15.16,-7],
[0.62,15.16,-7]
] call _fnc;
};
The above function will build the Terminal wherever you want, even in the mid air if you wish and automate the sliding doors. To call it use similar script passing [dir, pos] arguments to it:
[45, player modelToWorld [0, 50, 0.25]] call KK_fnc_buildAirportTerminal;
And just in case you want to automate existing Altis International Airport, use this piece of code:
call {
if (!isDedicated || worldName != "Altis") exitWith {};
private ["_fnc","_tr","_side"];
_fnc = {
{
_tr = createTrigger [
"EmptyDetector",
_side modelToWorld _x
];
_tr setVariable ["parent", _side];
_tr setTriggerArea [5, 5, 0, false];
_tr setTriggerActivation ["ANY", "PRESENT", true];
_tr setTriggerStatements [
"this",
format [
"
(thisTrigger getVariable 'parent')
animate ['Door_%1A_move', 1];
(thisTrigger getVariable 'parent')
animate ['Door_%1B_move', 1];
", _forEachIndex + 7
],
format [
"
(thisTrigger getVariable 'parent')
animate ['Door_%1A_move', 0];
(thisTrigger getVariable 'parent')
animate ['Door_%1B_move', 0];
", _forEachIndex + 7
]
];
_side setVariable [format [
"bis_disabled_Door_%1",
_forEachIndex + 7
], 1, true];
} forEach _this;
};
_side = [14619,16810,0] nearestObject "Land_Airport_left_F";
[
[-0.62,-15.16,-7],
[-0.62,15.16,-7]
] call _fnc;
_side = [14587,16776,0] nearestObject "Land_Airport_right_F";
[
[0.62,-15.16,-7],
[0.62,15.16,-7]
] call _fnc;
};
All code if for the use on dedicated server.
Enjoy,
KK