Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //NUP\NUP_flagCapture\functions\NUP_fnc_initSafezone.sqf
- if !(isServer) exitWith {};
- // Check if sidesArray already exists and initialize if not
- if (isNil "sidesArray") then {
- sidesArray = [East, West, Civilian, Independent];
- };
- // Ensure there are sides in the array before proceeding
- if !(count sidesArray > 0) exitWith {};
- params
- [
- ["_logic", objNull, [objNull]],
- ["_markerSize", [250, 140], [[]], 2]
- ];
- // Randomly select a side
- _side = sidesArray call BIS_fnc_selectRandom;
- diag_log format ["_side: %1", _side];
- _flagSide = "Flag_White_F";
- _szMarkerColor = "ColorBlack";
- _spawnName = "HQ";
- // Define flag color based on side
- switch (_side) do
- {
- case east:
- {
- _flagSide = "Flag_Red_F";
- _szMarkerColor = "ColorOPFOR";
- _spawnName = "Opfor HQ";
- };
- case west:
- {
- _flagSide = "Flag_Blue_F";
- _szMarkerColor = "ColorBLUFOR";
- _spawnName = "Blufor HQ";
- };
- case civilian:
- {
- _flagSide = "Flag_FD_Purple_F";
- _szMarkerColor = "ColorCivilian";
- _spawnName = "Civilian HQ";
- };
- case independent:
- {
- _flagSide = "Flag_Green_F";
- _szMarkerColor = "ColorIndependent";
- _spawnName = "Indepdendent HQ";
- };
- };
- // Create safezone marker
- _safezoneMarker = createMarker [format ["safezoneMarker_%1", _side], getPosATL _logic];
- _safezoneMarker setMarkerShape "ELLIPSE";
- _safezoneMarker setMarkerSize _markerSize;
- _safezoneMarker setMarkerDir 0;
- _safezoneMarker setMarkerBrush "Solid";
- _safezoneMarker setMarkerColor "colorBlack";
- _safezoneMarker setMarkerAlpha 0.85;
- // Create respawn marker
- _respawnMarker = createMarker [format ["respawn_%1", _side], getPosATL _logic];
- _respawnMarker setMarkerType "b_hq";
- _respawnMarker setMarkersize [1, 1];
- _respawnMarker setMarkerAlpha 1;
- _respawnMarker setMarkerColor _szMarkerColor;
- _respawnMarker setMarkerText format ["%1",_spawnName];
- // Spawn flag
- _flag = createVehicle[_flagSide, getPosATL _logic, [], 0, "CAN_COLLIDE"];
- _flag allowDamage false;
- _flag setVariable[ "NUP_respawnMarker", _respawnMarker, true ];
- _flag setVariable[ "NUP_safezoneMarker", _safezoneMarker, true ];
- // Remove selected side from the array
- sidesArray = sidesArray - [_side];
- // Debugging
- diag_log str allMapMarkers;
- diag_log format ["_logic: %1", _logic];
- _baseEntry1 = objNull;
- _baseEntry2 = objNull;
- _baseExit1 = objNull;
- _baseExit2 = objNull;
- //Initialize Elevators
- _syncedobjs = synchronizedObjects _logic;
- {
- if (toLower str _x find "base_exit_1_" == 0) then
- {
- _baseExit1 = _x;
- }
- } forEach _syncedobjs;
- _syncedobjs = synchronizedObjects _logic;
- {
- if (toLower str _x find "base_exit_2" == 0) then
- {
- _baseExit2 = _x;
- }
- } forEach _syncedobjs;
- _syncedobjs = synchronizedObjects _logic;
- {
- if (toLower str _x find "base_entry_1" == 0) then
- {
- _baseEntry1 = _x;
- }
- } forEach _syncedobjs;
- _syncedobjs = synchronizedObjects _logic;
- {
- if (toLower str _x find "base_entry_2" == 0) then
- {
- _baseEntry2 = _x;
- }
- } forEach _syncedobjs;
- // Log the names of the objects assigned to variables
- diag_log format["logic instance: %1", _logic];
- diag_log format["_baseExit1: %1", _baseExit1];
- diag_log format["_baseExit1 position: %1", getPosATL _baseExit1];
- diag_log format["_baseExit2: %1", _baseExit2];
- diag_log format["_baseExit2 position: %1", getPosATL _baseExit2];
- diag_log format["_baseEntry1: %1", _baseEntry1];
- diag_log format["_baseEntry1 position: %1", getPosATL _baseEntry1];
- diag_log format["_baseEntry2: %1", _baseEntry2];
- diag_log format["_baseEntry2 position: %1", getPosATL _baseEntry2];
- [
- params ["_baseExit1", "_baseEntry1"];
- _baseExit1, // Object the action is attached to
- "Exit to Helipads", // Title of the action
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa", // Icon Idle
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa", // Icon Progress
- "_this distance player < 1", // Condition for the action to be shown
- "_this distance player < 1", // Condition for the action to progress
- {}, // Code executed when action starts (leave blank)
- {}, // Code executed on every progress tick (leave blank)
- {
- [0, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- sleep 0.5;
- player setPosATL (getPosATL _baseEntry2);
- [1, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- }, // Code executed on completion
- {}, // Code executed on interruption (leave blank)
- [], // Arguments passed to the scripts as _this select 3 (empty array)
- 6, // Action duration in seconds
- 0, // Priority
- false, // Remove on completion
- false // Show in unconscious state
- ] remoteExec ["BIS_fnc_holdActionAdd", 0, _baseExit1]; // MP-compatible implementation
- [
- params ["_baseExit2", "_baseEntry2"];
- _baseExit2, // Object the action is attached to
- "Exit to Vehicle Lot", // Title of the action
- "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_exit_CA.paa", // Icon Idle
- "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_exit_CA.paa", // Icon Progress
- "_this distance player < 1", // Condition for the action to be shown
- "_this distance player < 1", // Condition for the action to progress
- {}, // Code executed when action starts (leave blank)
- {}, // Code executed on every progress tick (leave blank)
- {
- [0, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- sleep 0.5;
- player setPosATL (getPosATL _baseEntry2);
- [1, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- }, // Code executed on completion
- {}, // Code executed on interruption (leave blank)
- [], // Arguments passed to the scripts as _this select 3 (empty array)
- 6, // Action duration in seconds
- 0, // Priority
- false, // Remove on completion
- false // Show in unconscious state
- ] remoteExec ["BIS_fnc_holdActionAdd", 0, _baseExit2]; // MP-compatible implementation
- [
- params ["_baseEntry1", "_baseExit1"];
- _baseEntry1, // Object the action is attached to
- "", // Title of the action
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa", // Icon Idle
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa", // Icon Progress
- "_this distance player < 1", // Condition for the action to be shown
- "_this distance player < 1", // Condition for the action to progress
- {}, // Code executed when action starts (leave blank)
- {}, // Code executed on every progress tick (leave blank)
- {
- [0, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- sleep 0.5;
- // Set the player position to the new position
- player setPosATL (getPosATL _baseExit1);
- [1, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- }, // Code executed on completion
- {}, // Code executed on interruption (leave blank)
- [], // Arguments passed to the scripts as _this select 3 (empty array)
- 6, // Action duration in seconds
- 0, // Priority
- false, // Remove on completion
- false // Show in unconscious state
- ] remoteExec ["BIS_fnc_holdActionAdd", 0, _baseEntry1]; // MP-compatible implementation
- [
- params ["_baseEntry2", "_baseExit2"];
- _baseEntry2, // Object the action is attached to
- "Enter Base", // Title of the action
- "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_exit_CA.paa", // Icon Idle
- "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_exit_CA.paa", // Icon Progress
- "_this distance player < 1", // Condition for the action to be shown
- "_this distance player < 1", // Condition for the action to progress
- {}, // Code executed when action starts (leave blank)
- {}, // Code executed on every progress tick (leave blank)
- {
- [0, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- sleep 0.5;
- // Set the player position to the new position
- player setPosATL (getPosATL _baseEexit2);
- [1, "BLACK", 1, 1] spawn BIS_fnc_fadeEffect;
- }, // Code executed on completion
- {}, // Code executed on interruption (leave blank)
- [], // Arguments passed to the scripts as _this select 3 (empty array)
- 6, // Action duration in seconds
- 0, // Priority
- false, // Remove on completion
- false // Show in unconscious state
- ] remoteExec ["BIS_fnc_holdActionAdd", 0, _baseEntry2]; // MP-compatible implementation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement