08: Door Script - 14aag/mission_template GitHub Wiki

Door teleport. This allows you to create a point of entry and exit allowing the players to teleport back and forth on any object in arma (Can be buggy with some due to centre points of certain objects). Can be used for tunnel entrances or entry to buildings that would otherwise not have access etc.

The below goes into your XEH_preInit.sqf file.

efn_common_fnc_teleport = {
	params ["_target", "_direction"];
	player setPosASL (getPosASL _target);
	player setDir _direction;
	};

efn_common_fnc_doorAction = {
	params ["_target", "_caller", "_actionId", "_arguments"];
	_arguments params ["_target", "_direction", "_enterText", "_targetText"];
	titleText [_enterText, "BLACK", 1];
	[efn_common_fnc_teleport, [_target, _direction], 2] call CBA_fnc_waitAndExecute;
	[{titleText [_this#0, "BLACK IN", 0];}, [_targetText], 2.5] call CBA_fnc_waitAndExecute;
	};

efn_common_fnc_door = {
	params ["_door", "_target", "_direction", "_enterText", "_targetText"];
	_door addAction ["USE DOOR", efn_common_fnc_doorAction, [_target, _direction, _enterText, _targetText], 5, true, true, "", "", 3];
};

You then add this to the init of target objects of your choice. this = the selected object, target = variable name of where you want to teleport, 275 = the compass direction you end up facing, Entering/Building = the text that will display when teleporting.

[this, target, 275, "ENTERING", "BUILDING"] call efn_common_fnc_door;