text stringlengths 0 929k |
|---|
_this select n (Optional): ANY - additional parameters |
Returns: |
NOTHING |
*/ |
//--- Display log message |
private ["_msg","_fnc_error_exit"]; |
_fnc_error_exit = true; |
_msg = _this;//_this param [0,""]; |
_msg call bis_fnc_errorMsg; |
//--- Display script map |
if !(isnil "_fnc_scriptMap") then { |
private "_fnc_scriptMapText"; |
_fnc_scriptMapText = "EXIT"; |
{ |
_fnc_scriptMapText = _fnc_scriptMapText + " >> " + _x; |
} foreach _fnc_scriptMap; |
["%1",_fnc_scriptMapText] call bis_fnc_error; |
}; |
//--- Disable all functions |
/* |
{ |
missionnamespace setvariable [_x,{}]; |
} foreach (uinamespace getvariable "BIS_functions_list"); |
*/ |
//--- End loading sceen to prevent freezing the game |
endloadingscreen; |
//--- Terminate EVERYTHING |
//--- (breaking out from non-existing scope does the trick) |
breakout "#all"; |
<|endoftext|> |
/* |
File: spawnVehicle.sqf |
Author: Joris-Jan van 't Land |
Description: |
Function to spawn a certain vehicle type with all crew (including turrets). |
The vehicle can either become part of an existing group or create a new group. |
Parameter(s): |
_this select 0: desired position (Array). |
_this select 1: desired azimuth (Number). |
_this select 2: type of the vehicle (String). |
_this select 3: side or existing group (Side or Group). |
_this select 4: (optional) force precise position (Bool, default: true). |
Returns: |
Array: |
0: new vehicle (Object). |
1: all crew (Array of Objects). |
2: vehicle's group (Group). |
*/ |
//Validate parameter count |
if ((count _this) < 4) exitWith {debugLog "Log: [spawnVehicle] Function requires at least 4 parameters!"; []}; |
private ["_pos", "_azi", "_type", "_param4", "_grp", "_side", "_newGrp","_precisePosition"]; |
_pos = _this select 0; |
_azi = _this select 1; |
_type = _this select 2; |
_param4 = _this select 3; |
_precisePosition = _this param [4,true,[true]]; |
//Determine if an actual group was passed or a new one should be created. |
if ((typeName _param4) == (typeName sideEnemy)) then |
{ |
_side = _param4; |
_grp = createGroup _side; |
_newGrp = true; |
} |
else |
{ |
_grp = _param4; |
_side = side _grp; |
_newGrp = false; |
}; |
//Validate parameters |
if ((typeName _pos) != (typeName [])) exitWith {debugLog "Log: [spawnVehicle] Position (0) must be an Array!"; []}; |
if ((typeName _azi) != (typeName 0)) exitWith {debugLog "Log: [spawnVehicle] Azimuth (1) must be a Number!"; []}; |
if ((typeName _type) != (typeName "")) exitWith {debugLog "Log: [spawnVehicle] Type (2) must be a String!"; []}; |
if ((typeName _grp) != (typeName grpNull)) exitWith {debugLog "Log: [spawnVehicle] Group (3) must be a Group!"; []}; |
private ["_sim", "_veh", "_crew"]; |
_sim = getText(configFile >> "CfgVehicles" >> _type >> "simulation"); |
switch (tolower _sim) do { |
case "soldier": { |
_veh = _grp createunit [_type,_pos,[],0,"none"]; |
}; |
case "airplanex"; |
case "helicopterrtd"; |
case "helicopterx": { |
//Make sure aircraft start at a reasonable height. |
if (count _pos == 2) then {_pos set [2,0];}; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.