Initial Github upload of all components

This commit is contained in:
Ghostrider [GRG] 2022-07-31 14:58:38 -04:00
parent a4d637daca
commit 0b1ef2ccdc
294 changed files with 28605 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,2 @@
diag_log format["About called at %1",diag_tickTime];

View File

@ -0,0 +1,23 @@
/*
Returns the builing containing an object or objNull
By Ghostrider-GRG-
Copyright 2020
*/
params["_u",["_category","House"]];
private _pos = getPosASL _u;
private _building = objNull;
private _surfacesAbove = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) + 100],_u,_u,true,10];
{
if ((_x select 2) isKindOf _category && !(_x isEqualTo _u)) exitWith {_building = (_x select 2)};
} forEach _surfacesAbove;
if (_building isEqualTo objNull) then
{
private _surfacesBelow = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) - 10],_u,_u,true,100];
{
if ((_x select 2) isKindOf _category && !(_x isEqualTo _u)) exitWith {_building = (_x select 2)};
} forEach _surfacesBelow;
};
_building

View File

@ -0,0 +1,75 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_building","_center"];
private _pos = getPosATL _building;
private _garrisonedBuildings = missionNamespace getVariable["blck_garrisonedBuildings",[]];
private _count = 0;
private _staticsText = [];
private _unitsText = [];
private _buildingGarrisonATL = [];
private _configuredStatics = [];
private _configuredUnits = [];
private _statics = nearestObjects[getPosATL _building,["StaticWeapon"],sizeOf (typeOf _building)];
private _units = nearestObjects[getPosATL _building,["Man"],sizeOf (typeOf _building)] select {(vehicle _x) isEqualTo _x};
private _lineBreak = toString [10];
{
if !(_x in _configuredStatics) then
{
private _isInside = [_x] call blck3DEN_fnc_isInside;
private _container = [_x] call blck3DEN_fnc_buildingContainer;
if (_isInside && (_container isEqualTo _building)) then
{
_configuredStatics pushBackUnique _x;
_staticsText pushBack [format['%1',typeOf _x],(getPosATL _x) vectorDiff (_pos),getDir _x];
};
};
} forEach _statics;
_staticsText joinString _lineBreak;
// Since this is run from the editor we do not have to worry about units running off from their original locations
{
if !(_x in _configuredUnits) then
{
private _isInside = [_x] call blck3DEN_fnc_isInside;
private _container = [_x] call blck3DEN_fnc_buildingContainer;
if (_isInside && (_container isEqualTo _building)) then
{
_configuredUnits pushBackUnique _x;
_unitsText pushBack [(getPosATL _x) vectorDiff (_pos),getDir _x];
};
};
} forEach _units;
_unitsText joinString _lineBreak;
if !((_staticsText isEqualTo []) && (_unitsText isEqualTo [])) then
{
private _allowDamage = (_building get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_building get3DENAttribute "enableSimulation") select 0;
diag_log format["_configureGarrisonATL: _building %1 | damage %2 | simulation %3",_allowDamage,_enableSimulation];
_buildingGarrisonATL = [
format["%1",
typeOf _building],
(getPosATL _building) vectorDiff _center,
getDir _building,
_allowDamage,
_enableSimulation,
_staticsText,
_unitsText
];
};
private "_return";
if (_buildingGarrisonATL isEqualTo []) then
{
_return = [];
} else {
_return = [_buildingGarrisonATL,_configuredStatics,_configuredUnits];
};
_return

View File

@ -0,0 +1,18 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
private _marker = create3DENEntity ["object","Sign_Arrow_Large_Yellow_F",getPos _object];
private _markerPos = getPos _object;
private _bbr = boundingBoxReal _object;
_p1 = _bbr select 0;
_p2 = _bbr select 1;
_height = abs ((_p2 select 2) - (_p1 select 2));
_marker setPosATL [_markerPos select 0, _markerPos select 1, (_markerPos select 2) + _height];
_object setVariable ["marker",_marker];
true

View File

@ -0,0 +1,20 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
private _marker = create3DENEntity ["object","Sign_Arrow_Large_Green_F",getPos _object];
private _markerPos = getPos _object;
private _bbr = boundingBoxReal _object;
_p1 = _bbr select 0;
_p2 = _bbr select 1;
_height = abs ((_p2 select 2) - (_p1 select 2));
_marker setPosATL [_markerPos select 0, _markerPos select 1, (_markerPos select 2) + _height];
_object setVariable ["marker",_marker];
true

View File

@ -0,0 +1,13 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_message"];
// As found in fn_3DENExportTerrainBuilder.sqf
//private _message = ["this is ","an array"];
private _lineBreak = toString [10];
uiNameSpace setVariable ["Display3DENCopy_data", ["missionName.sqf", _message joinString _lineBreak]];
(findDisplay 313) createdisplay "Display3DENCopy";

View File

@ -0,0 +1,30 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_state"];
all3DENEntities params ["_objects"];
_objects = _objects select {_x getVariable["garrisoned",false]};
missionNameSpace setVariable["blck_displayGarrisonMarkerOn",_state];
{
if (_state) then // if the request was to show the markers then ....
{
private _marker = _x getVariable["marker",""];
diag_log format["_x = %1 | _marker = %2",_x,_marker];
if (_marker isEqualto "") then
{
[_x] call blck3DEN_fnc_createGarrisonMarker;
[_x] call blck3DEN_fnc_setEventHandlers;
};
} else {
blck_displayGarrisonMarkerOn = false;
if !(_x getVariable["marker",""] isEqualTo "") then
{
[_x] call blck3DEN_fnc_removeMarker;
};
};
} forEach _objects;

View File

@ -0,0 +1,27 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_state"];
all3DENEntities params ["_objects"];
_objects = _objects select {_x getVariable ["lootVehicle",false]};
missionNamespace setVariable["blck_displayLootMarkerOn",_state];
{
if (_state) then // if the request was to show the markers then ....
{
if (_x getVariable["marker",""] isEqualto "") then
{
[_x] call blck3DEN_fnc_createLootMarker;
[_x] call blck3DEN_fnc_setEventHandlers;
};
} else {
if !(_x getVariable["marker",""] isEqualTo "") then
{
[_x] call blck3DEN_fnc_removeMarker;
};
};
} forEach _objects;

View File

@ -0,0 +1,10 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_end"];
missionNamespace setVariable["blck_endMessage",_end];
systemChat format["End Message set to %1",_end];

View File

@ -0,0 +1,7 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_3DENobject","_center"];

View File

@ -0,0 +1,29 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _objects = get3DENSelected "object";
private "_message";
diag_log format["getGarrisonInfo: _object = %1",format["%1",_object]];
if (_objects isEqualTo []) then
{
_message = "No Buildings Selected";
} else {
if (count _objects == 1) then
{
if ((_objects select 0) getVariable["garrisoned",false]) then
{
_message = format["Building %1 IS Garrisoned",typeOf (_objects select 0)];
} else {
_message = format["Building %1 is NOT Garrisoned",typeOf (_objects select 0)];
};
} else {
_message = format["Select a single building then try again"];
};
};
systemChat _message;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

@ -0,0 +1,31 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car" || (typeOf _x) isKindOf "Ship" || (typeOf _x) isKindOf "ThingX"};
private "_message";
if (_objects isEqualTo []) then
{
_message = "No Cars/Ships/ThingX Selected";
} else {
if (count _objects == 1) then
{
if ((_objects select 0) getVariable["lootvehicle",false]) then
{
_message = format["Vehicle %1 IS a Loot Vehicle",typeOf (_objects select 0)];
} else {
_message = format["Vehicle %1 is NOT a Loot Vehicle",typeOf (_objects select 0)];
};
} else {
_message = format["% Vehicles Selected. Select a single vehicle then try again",count _objects];
};
};
systemChat _message;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

@ -0,0 +1,11 @@
private _objects = get3DENSelected "object" select {((typeOf _x) isKindOf "House") && [_x] call BIS_fnc_isBuildingEnterable};
private _lines = [];
private _lineBreak = toString [10];
{
_message pushBack format["Garrison Flag for Building type %1 at %2 = %3",typeOf _x,getPosATL _x,_x getVariable["garrisoned",false]];
} forEach _objects;
uiNameSpace setVariable ["Display3DENCopy_data", ["garrisonedBuildings.sqf", _lines joinString _lineBreak]];
(findDisplay 313) createdisplay "Display3DENCopy";

View File

@ -0,0 +1,11 @@
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car"};
private _lines = [];
private _lineBreak = toString [10];
{
_message pushBack format["Loot Vehicle Flag for Vehicle type %1 at %2 = %3",typeOf _x,getPosATL _x,_x getVariable["garrisoned",false]];
} forEach _objects;
uiNameSpace setVariable ["Display3DENCopy_data", ["lootVehicles.sqf", _lines joinString _lineBreak]];
(findDisplay 313) createdisplay "Display3DENCopy";

View File

@ -0,0 +1,7 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
diag_log format["Help called at %1",diag_tickTime];

View File

@ -0,0 +1,19 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
missionNamespace setVariable["blck_difficulty",getText(configFile >> "CfgBlck3DEN" >> "configs" >> "defaultMissionDifficulty")];
diag_log format["Initilization: blck_difficulty set to %1",blck_difficulty];
missionNamespace setVariable["blck_lootTiming",getText(configFile >> "CfgBlck3DEN" >> "configs" >> "defaultLootcrateSpawnTiming")];
missionNamespace setVariable["blck_loadTiming",getText(configFile >> "CfgBlck3DEN" >> "configs" >> "defaultLootcrateLoadTiming")];
missionNamespace setVariable["blck_endState",getText(configFile >> "CfgBlck3DEN" >> "configs" >> "defaultMissionEndState")];
missionNamespace setVariable["blck_startMessage","TODO: Add a start message"];
missionNamespace setVariable["blck_endMessage","TODO: Add an end message"];
missionNamespace setVariable["blck_missionLocations","random"];
missionNameSpace setVariable["blck_displayGarrisonMarkerOn",false];
missionNamespace setVariable["blck_displayLootMarkerOn",false];
diag_log format["Mission Attributes Initialized for blckeagls at time %1",diag_tickTime];

View File

@ -0,0 +1,11 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _u = _this select 0;
private _isInfantry = if ((_u isKindOf "Man") && (vehicle _u) isEqualTo _u) then {true} else {false};
_isInfantry

View File

@ -0,0 +1,38 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_u",["_category","House"]];
private _pos = getPosASL _u;
private _above = lineIntersects [_pos, [_pos select 0, _pos select 1, (_pos select 2) + 100],_u];
private _below = lineintersects [_pos, [_pos select 0, _pos select 1, (_pos select 2) - 2],_u];
//diag_log format["_fn_isInside: _u %1 | _category = %5 | typeOf _u %4 | _above %2 | _below %3 ",_u,_above,_below,typeOf _u, _category];
// If there is something above or below the object do a quick double-check to make sure there is a building there and not something else.
if (_above) then // test if any surfaces above are from buildingPos
{
private _surfacesAbove = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) + 100],_u,_u,true,100];
_above = false;
{
//diag_log format["_fn_isInside: _x = %2 | typeOf _x = %3",_x,_x select 2,typeOf (_x select 2)];
if ((_x select 2) isKindOf _category) then {_above = true};
}forEach _surfacesAbove;
};
if (_below) then
{
private _surfacesBelow = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) - 10],_u,_u,true,100];
_above = false;
{
//diag_log format["_fn_isInside: _x = %2 | typeOf _x = %3",_x,_x select 2,typeOf (_x select 2)];
if ((_x select 2) isKindOf _category) then {_above = true};
}forEach _surfacesBelow;
};
private _isInside = if (_above || _below) then {true} else {false};
//diag_log format["_fn_isInside: _isInside = %1",_isInside];
_isInside

View File

@ -0,0 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_timing"];
missionNamespace setVariable["blck_loadTiming",_timing];
systemChat format["Mission Load Crates Timing set to %1",_timing];

View File

@ -0,0 +1,13 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
if !(_object getVariable["marker",""] isEqualTo "") then
{
private _marker = _object getVariable["marker",""];
private _markerPos = getPosATL _object;
_marker setPosATL[_markerPos select 0, _markerPos select 1, (_markerPos select 2) + sizeOf _object];
};

View File

@ -0,0 +1,28 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
switch (true) do
{
case ((typeOf _object) isKindOf "ThingX" && blck_displayLootMarkerOn): {
if !(_object getVariable["lootVehicle",""] isEqualTo "") then
{
[_object] call blck3DEN_fnc_createLootMarker;
[_object] call blck3DEN_fnc_setEventHandlers;
};
};
case ((typeOf _object) isKindOf "House" && blck_displayGarrisonMarkerOn): {
if !(_object getVariable["garrisoned",""] isEqualTo "") then
{
[_object] call blck3DEN_fnc_createGarrisonMarker;
[_object] call blck3DEN_fnc_setEventHandlers;
};
};
};

View File

@ -0,0 +1,12 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
if !(_object getvariable["marker",""] isEqualTo "") then
{
[_object] call blck3DEN_fnc_removeMarker;
_object setVariable ["marker",nil];
};

View File

@ -0,0 +1,18 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
private _marker = _object getVariable["marker",""];
if !(_marker isEqualTo "") then
{
private _id = get3DENEntityID _marker;
delete3DENEntities [_id];
_object setVariable["marker",nil];
};
true

View File

@ -0,0 +1,10 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_mode"];
missionNamespace setVariable["blck_endState",_mode];
systemChat format["Mission End State updated to %1",_mode];

View File

@ -0,0 +1,13 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_difficulty"];
missionNamespace setVariable["blck_difficulty",_difficulty];
private _m = format["Mission Difficulty updated to %1",_difficulty];
systemChat _m;
diag_log _m;

View File

@ -0,0 +1,14 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
_object removeAllEventHandlers "UnregisteredFromWorld3DEN";
_object removeAllEventHandlers "RegisteredToWorld3DEN";
_object removeAllEventHandlers "Dragged3DEN";
_object addEventHandler ["Dragged3DEN",{_this call blck3DEN_fnc_onDrag;}];
_object addEventHandler ["UnregisteredFromWorld3DEN",{_this call blck3DEN_fnc_onUnregister;}];
_object addEventHandler ["RegisteredToWorld3DEN", {_this call blck3DEN_fnc_onRegistered;}];

View File

@ -0,0 +1,47 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_state"];
private _markersStateON = missionNamespace getVariable["blck_displayGarrisonMarkerOn",false];
[false] call blck3DEN_fnc_displayGarrisonMarkers;
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "House"};
private "_message";
if (_objects isEqualTo []) exitWith
{
_message = "Select one or more buildings to configure";
systemChat _message;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;
};
{
if ([_x] call BIS_fnc_isBuildingEnterable) then
{
_x setVariable["garrisoned",_state];
_message = format["building of type %1 had garrison state set to %2",typeOf _x,_state];
systemChat _message;
diag_log _message;
if (blck_displayGarrisonMarkerOn) then
{
[_x] call blck3DEN_fnc_createGarrisonedMarker;
[_x] call blck3DEN_fnc_setEventHandlers;
};
} else {
_message = format["Object type %1 ignored: only enterable buildings can be garrisoned",typeOf _x];
systemChat _message;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;
};
} forEach _objects;
_message = format["Garrison State of %1 buildings updated to %2",count _objects,_state];
systemChat _message;
if (_markersStateON) then
{
[true] call blck3DEN_fnc_displayGarrisonMarkers;
};
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

@ -0,0 +1,49 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
sets a flag stored through setVariable for each selected object that meets the filter criteria
only objects of type "Car"or "ThingX" are allowed.
*/
params["_state"];
private _markerStateON = missionNameSpace getVariable["blck_displayLootMarkerOn",false];
[false] call blck3DEN_fnc_displayLootMarkers;
private "_message";
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car" || (typeOf _x) isKindOf "Ship"}; //
if (_objects isEqualTo []) exitWith
{
_message = "Select one or more vehicles or items of type ThingX to configure";
systemChat _message;
};
{
if ((typeOf _x) isKindOf "Car" || (typeOf _x) isKindOf "Ship") then
{
_x setVariable["lootvehicle",_state];
if (blck_displayLootMarkerOn && _state) then
{
[_x] call blck3DEN_fnc_createLootMarker;
[_x] call blck3DEN_fnc_setEventHandlers;
} else {
if !(_state) then
{
[_x] call blck3DEN_fnc_removeLootMarker;
};
};
_message = format["Vehicle type %1 set to Loot Vehicle = %1",typeOf _x,_state];
systemChat _message;
diag_log _message;
} else {
_message = format["Object with type %1 ignored:: only objects of type Car can be used as loot vehicles",typeOf _x];
diag_log _message;
systemChat _message;
};
} forEach _objects;
if (_markerStateON) then
{
[true] call blck3DEN_fnc_displayLootMarkers;
};
_message = format["Loot Vehicle State of %1 objects updated to %2",count _objects,_state];
systemChat _m;

View File

@ -0,0 +1,14 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_mode"];
switch (_mode) do
{
case "random": {missionNamespace setVariable["blck_missionLocations","random"]};
case "fixed": {missionNamespace setVariable["blck_missionLocations","fixed"]};
};
systemChat format["Mission Locations updated to %1",_mode];

View File

@ -0,0 +1,10 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_timing"];
missionNamespace setVariable["blck_lootTiming",_timing];
systemChat format["Loot Chest Spawn Timing updated to %1",_timing];

View File

@ -0,0 +1,10 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_start"];
missionNamespace setVariable["blck_startMessage",_start];
systemChat format["Start Message set to %1",_start];

View File

@ -0,0 +1,14 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _objects = get3DENSelected "object";
private _markers select {(typeOf _x) = _markerType};
{
};
_m = "Update Objects Called";
diag_log _m;
systemChat _m;

View File

@ -0,0 +1,18 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_mode"];
private _header = format["%4Mission.sqf generated:: blckeagls 3DEN Plugin Version %1 : Build %2 : Build Date %3",
getNumber(configFile >> " CfgBlck3DEN" >> "CfgVersion" >> "version"),
getNumber(configFile >> "CfgBlck3DEN" >> "CfgVersion" >> "build"),
getText(configFile >> "CfgBlck3DEN" >> "CfgVersion" >> "date"),
_mode
];
diag_log _header;
_header

View File

@ -0,0 +1,11 @@
all3DENEntities params ["_objects"];
{
diag_log format [
"classname %1 | position %2 | direction %3 | isSimple = %4",
(_x get3DENAttribute "ItemClass") select 0,
(_x get3DENAttribute "position") select 0,
((_x get3DENAttribute "rotation") select 0) select 2,
(_x get3DENAttribute "objectIsSimple") select 0
];
} forEach _objects;

View File

@ -0,0 +1,6 @@
_parameter = 0;
_ok = "Multiplayer" set3DENMissionAttribute ["respawn",15];
_parameter = "Multiplayer" get3DENMissionAtrribute "respawn";
systemChat format["_parameter = %1",_parameter];

View File

@ -0,0 +1,129 @@
/*
Dynamic Mission Generated
Using 3DEN Plugin for blckeagls
dynamicMission.sqf generated:: blckeagls 3DEN Plugin Version 0 : Build 2 : Build Date 08/15/20
By Ghostrider-GRG-
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#include "\q\addons\custom_server\Missions\privateVars.sqf";
_defaultMissionLocations = [];
_markerType = ["mil_box",[1,1],"<null>"];
_markerColor = "ColorRed";
_startMsg = "TODO: Change approiately";
_endMsg = "TODO: Change Appropriately";
_markerMissionName = "Stay Away";
_crateLoot = blck_BoxLoot_Blue;
_lootCounts = blck_lootCountsBlue;
_garrisonedBuilding_ATLsystem = [
["Land_Unfinished_Building_01_F",[0,0,0],0,true,true,
[["B_HMG_01_high_F",[-2.19922,0.837891,3.61188],0],
["B_static_AA_F",[-2.34766,3.85352,6.80866],0]],
[
[[0.96875,-1.99023,0.27216],0],
[[-3.74219,0.279297,0.136929],0]]
],
["Land_Unfinished_Building_01_F",[0,0,0],0,true,true,[["B_HMG_01_F",[-1.87305,5.36523,3.86831],0]],[[[-2.46289,-1.18555,3.68233],0],[[-1.72656,3.4668,6.88683],0]]]
];
_missionLandscape = [
["Land_u_Shed_Ind_F",[-29.123,-8.11914,-33.866],0,true,true],
["Land_Shed_08_brown_F",[-15.1465,25.9961,-33.871],0,true,true],
["Land_Shed_02_F",[26.5762,78.6641,-33.8547],0,true,true],
["Land_Wreck_AFV_Wheeled_01_F",[-5.21289,-20.9434,-33.8297],0,true,true]
];
_simpleObjects = [
];
_missionLootVehicles = [
];
_missionPatrolVehicles = [
["B_Truck_01_mover_F",[24.084,13.5703,-33.8635],0,75,75],
["B_MRAP_01_hmg_F",[3.02539,16.2363,-33.8629],0,75,75],
["B_HMG_01_F",[46.9961,45.3984,-29.9977],0,75,75],
["B_GMG_01_F",[-5.16211,-5.00586,-33.8644],0,75,75],
["B_Heli_Light_01_dynamicLoadout_F",[-6.61523,8.89844,-33.864],0,75,75],
["B_T_Boat_Transport_01_F",[18.582,44.1055,-33.8654],0,75,75],
["B_HMG_01_high_F",[30.6055,0.525391,-30.1961],0,75,75],
["B_static_AA_F",[30.457,3.54102,-26.9993],0,75,75]
];
_submarinePatrolParameters = [
];
_airPatrols = [
["B_Heli_Light_01_dynamicLoadout_F",[-6.61523,8.89844,-33.864],0,1000,1000]
];
_missionEmplacedWeapons = [
["B_HMG_01_F",[46.9961,45.3984,-29.9977],0],
["B_GMG_01_F",[-5.16211,-5.00586,-33.8644],0],
["B_HMG_01_high_F",[30.6055,0.525391,-30.1961],0],
["B_static_AA_F",[30.457,3.54102,-26.9993],0]
];
_missionGroups = [
[[30.0605,46.2383,-33.8646],3,6,"Blue",30,45],
[[5.66602,-8.33398,-33.8665],3,6,"Blue",30,45],
[[47.1426,43.5,-26.9792],3,6,"Blue",30,45],
[[46.4063,38.8477,-30.1837],3,6,"Blue",30,45],
[[19.9512,-4.41797,-29.7975],3,6,"Blue",30,45],
[[29.0625,-0.0332031,-33.6711],3,6,"Blue",30,45],
[[33.7734,-2.30273,-33.5358],3,6,"Blue",30,45]
];
_scubaGroupParameters = [
];
_missionLootBoxes = [
["Box_IND_Wps_F",[10.7441,1.8418,-33.8658],_crateLoot,_lootCounts,0],
["Box_AAF_Equip_F",[13.2188,7.31445,-33.8656],_crateLoot,_lootCounts,0],
["Box_IND_AmmoOrd_F",[14.9844,13.168,-33.8657],_crateLoot,_lootCounts,0],
["Box_IND_WpsLaunch_F",[10.1504,-2.12109,-33.8658],_crateLoot,_lootCounts,0]
];
/*
Use the parameters below to customize your mission - see the template or blck_configs.sqf for details about each them
*/
_chanceHeliPatrol = blck_chanceHeliPatrolBlue;
_noChoppers = blck_noPatrolHelisBlue;
_missionHelis = blck_patrolHelisBlue;
_chancePara = blck_chanceParaBlue;
_noPara = blck_noParaBlue;
_paraTriggerDistance = 400;
_paraSkill = 'Blue';
_chanceLoot = 0.0;
_paraLoot = blck_BoxLoot_Blue;
_paraLootCounts = blck_lootCountsBlue;
_missionLandscapeMode = "precise";
_uniforms = blck_SkinList;
_headgear = blck_headgear;
_vests = blck_vests;
_backpacks = blck_backpacks;
_sideArms = blck_Pistols;
_spawnCratesTiming = "atMissionSpawnGround";
_loadCratesTiming = "atMissionSpawn";
_endCondition = "allKilledOrPlayerNear";
_minNoAI = blck_MinAI_Blue;
_maxNoAI = blck_MaxAI_Blue;
_noAIGroups = blck_AIGrps_Blue;
_noVehiclePatrols = blck_SpawnVeh_Blue;
_noEmplacedWeapons = blck_SpawnEmplaced_Blue;
_minNoAI = blck_MinAI_Blue;
_maxNoAI = blck_MaxAI_Blue;
_noAIGroups = blck_AIGrps_Blue;
_noVehiclePatrols = blck_SpawnVeh_Blue;
_noEmplacedWeapons = blck_SpawnEmplaced_Blue;
#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf";

View File

@ -0,0 +1,424 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
#define oddsOfGarrison 0.67
#define maxGarrisonUnits 4
objectAtMissionCenter = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "objectAtMissionCenter");
blck_minAI = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "minAI");
blck_maxAI = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxAI");
minPatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "minPatroRadius");
maxPatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxPatrolRadius");
maxVehiclePatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxVehiclePatrolRadius");
aircraftPatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "aircraftPatrolRadius");
garisonMarkerObject = "Sign_Sphere100cm_F";
oddsOfGarison = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "oddsOfGarison");
maxGarrisonStatics = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxGarrisonStatics");
typesGarrisonStatics = getArray(configFile >> "CfgBlck3DEN" >> "configs" >> "typesGarrisonStatics");
blck_MissionDifficulty = missionNamespace getVariable["blck_difficulty",getText(configFile >> "CfgBlck3DEN" >> "configs" >> "defaultMissionDifficulty")];
lootVehicleVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "lootVehicleVariableName");
buildingPosGarrisonVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "buildingPosGarrisonVariableName");
buildingATLGarrisionVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "buildingATLGarrisionVariableName");
CENTER = [0,0,0];
diag_log format["Dynamic Export called at %1",diag_tickTime];
diag_log format["With blck_MissionDifficulty = %1",blck_MissionDifficulty];
/*
Set Default Values Where not Defined using Menu Commands
*/
if (isNil "blck_dynamicStartMessage") then
{
blck_dynamicStartMessage = "TODO: Change approiately";
};
if (isNil "blck_dynamicEndMessage") then
{
blck_dynamicEndMessage = "TODO: Change Appropriately";
};
if (isNil "blck_dynamicCrateLoot") then
{
blck_dynamicCrateLoot = format["_crateLoot = blck_BoxLoot_%1;",blck_MissionDifficulty];
};
if (isNil "blck_dynamicCrateLootCounts") then {
blck_dynamicCrateLootCounts = format["_lootCounts = blck_lootCounts%1;",blck_MissionDifficulty];
};
if (isNil "blck_dynamicmarkerMissionName") then
{
blck_dynamicmarkerMissionName = "TODO: Update appropriately";
};
if (isNil "blck_spawnCratesTiming") then
{
blck_spawnCratesTiming = missionNamespace getVariable["blck_lootTiming","atMissionStartGround"];
};
if (isNil "blck_loadCratesTiming") then
{
blck_loadCratesTiming = missionNamespace getVariable["blck_loadTiming","atMissionStart"];
};
if (isNil "blck_missionEndCondition") then
{
blck_missionEndCondition = missionNamespace getVariable["blck_endState","allUnitsKilled"];
};
/*
Look for an object defined in CfgBlck3DEN \ configs \ that marks the center of the mission
and set the coords of the center if such an object is found
*/
all3DENEntities params ["_objects","_groups","_triggers","_systems","_waypoints","_markers","_layers","_comments"];
private _centerMarkers = _objects select {(typeOf _x) isEqualTo objectAtMissionCenter};
diag_log format["_centerMarkers = %1",_centerMarkers];
if !(_centerMarkers isEqualTo []) then
{
CENTER = getPosATL (_centerMarkers select 0);
diag_log format["CENTER defined by object %1 typeOf %2",_centerMarker,typeOf (_centerMarkers select 0)];
} else {
diag_log format["<WARNING> No object marking the center of the mission was found: using a flashing road cone or flag is recommended",getText(configFile >> "CfgVehicles" >> objectAtMissionCenter >> "displayName")];
diag_log format["Place such an object or a marker to ensure the mission is accurately stored and spawned"];
};
private["_m1","_markerPos","_markerType","_markerShape","_markerColor","_markerText","_markerBrush","_markerSize","_markerAlpha"];
/*
pull info on the first marker found
*/
if !(_markers isEqualTo []) then
{
_m1 = _markers select 0;
_markerType = (_m1 get3DENAttribute "itemClass") select 0;
//_markerShape = (_m1 get3DENAttribute "markerType") select 0;
_markerColor = (_m1 get3DENAttribute "baseColor") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
if !(_markerText isEqualTo "") then {blck_dynamicmarkerMissionName = _markerText};
_markerBrush = (_m1 get3DENAttribute "brush") select 0;
_markerPos = (_m1 get3DENAttribute "position") select 0;
_markerSize = (_m1 get3DENAttribute "size2") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
/*
use the coordinates of that marker as mission center of no object demarkating the center is found
*/
if ((isNil "CENTER") || (CENTER isEqualTo [0,0,0])) then {
CENTER = _markerPos;
diag_log format["Position of marker %1 used for position of CENTER = %2",_m1,CENTER];
};
if (count _markers > 1) then
{
diag_log format["<WARNING> More than one marker was found; only the first marker was processed"];
};
} else {
_markerType = "ELLIPSE";
//_markerShape = "ELLIPSE";
_markerSize = "[250,250]";
_markerColor = "COLORRED";
_markerBrush = "SOLID";
if !(_objects isEqualTo []) then
{
CENTER = getPosATL (_objects select 0);
} else {
CENTER = getPos (_objects select 0);
};
diag_log format["<WARNING> No marker was found, using default values and position for mission center position"];
};
if (CENTER isEqualTo [0,0,0]) then
{
CENTER = getPosATL (_staticObjects select 0);
};
diag_log format["CENTER = %1",CENTER];
private _garisonedBuildings = [];
private _garisonedStatics = [];
private _garisonedUnits = [];
private _landscape = _objects select{
!((_x get3DENAttribute "objectIsSimple") select 0) &&
((typeOf _x) isKindOf "Static" || ( (typeOf _x) isKindOf "ThingX")) &&
!((typeOf _x) isKindOf "ReammoBox_F") &&
!(_x getVariable["isLootContainer",false]) &&
!((typeOf _x) isKindOf "Helper_Base_F")
};
private _garisonedPos = [];
diag_log format["_exportDynamic (152): count _landscape = %1",count _landscape];
for "_i" from 1 to (count _landscape) do
{
if (isNull _building) exitWith {};
private _building = _landscape deleteAt 0;
if (_building getVariable["garrisoned",false]) then
{
private _allowDamage = (_building get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_building get3DENAttribute "enableSimulation") select 0;
diag_log format["_exportDynamic-garisonedPos: _building %1 | damage %2 | simulation %3",_building,_allowDamage,_enableSimulation];
/*
// From blck_fnc_garrisonBuilding_RelPosSystem
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
*/
_garisonedPos pushBack format[' ["%1",%2,%3,%4,%5,%6,%7,%8,%9]',
typeOf _building,
(getPosATL _building) vectorDiff CENTER,
getDir _building,
_allowDamage,
_enableSimulation,
oddsOfGarrison,
maxGarrisonStatics,
typesGarrisonStatics,
maxGarrisonUnits];
} else {
_landscape pushBack _building;
};
};
private _garrisonATL = [];
diag_log format["_exportDynamic (169): count _landscape = %1",count _landscape];
for "_i" from 1 to (count _landscape) do
{
if (isNull _building) exitWith {};
private _building = _landscape deleteAt 0;
_atl = [_building,CENTER] call blck3DEN_fnc_configureGarrisonATL;
if (_atl isEqualTo []) then {
_landscape pushBack _building;
} else {
_garrisonATL pushBack (format[" %1",_atl select 0]);
_garisonedBuildings pushBack _building;
_garisonedStatics append (_atl select 1);
_garisonedUnits append (_atl select 2);
};
};
diag_log format["_garrisonATL = %1",_garrisonATL];
diag_log format["_exportDynamic (185): count _landscape = %1",count _landscape];
private _missionLandscape = [];
for "_i" from 1 to (count _landscape) do
{
private _building = _landscape deleteAt 0;
if (isNull _building) exitWith {};
if !(_building getVariable["marker",false]) then
{
private _allowDamage = (_building get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_building get3DENAttribute "enableSimulation") select 0;
diag_log format["typeOf _x = %1 | damage = %2 | simulation = %3",typeOf _building,_allowDamage,_enableSimulatoin];
_missionLandscape pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _building,(getPosATL _building) vectorDiff CENTER,getDir _building, _allowDamage,_enableSimulation];
};
};
private _simpleObjects = _objects select {(_x get3DENAttribute "objectIsSimple") select 0};
diag_log format["_simpleObjects = %1",_simpleObjects];
private _missionSimpleObjects = [];
{
private _object = format[' ["%1",%2,%3]',
(_x get3DENAttribute "ItemClass") select 0,
((_x get3DENAttribute "position") select 0) vectorDiff CENTER,
((_x get3DENAttribute "rotation") select 0) select 2
];
diag_log format["_object = %1",_object];
_missionSimpleObjects pushBack _object;
} forEach _simpleObjects;
private _missionLootVehicles = [];
private _lootVehicles = _objects select {
((typeOf _x) isKindOf "AllVehicles") &&
!((typeOf _x) isKindOf "Man") &&
(_x getVariable["lootvehicle",false])
};
diag_log format["_lootVehicles = %1",_lootVehicles];
{
_missionLootVehicles pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER, '_crateLoot','_lootCounts',getDir _x];
} forEach _lootVehicles;
_missionPatrolVehicles = [];
private _patrolVehicles = _objects select {
(((typeOf _x) isKindOf "Car") || ((typeOf _x) isKindOf "Tank") || ((typeOf _x) isKindOf "Ship")) &&
!((typeOf _x) isKindOf "SDV_01_base_F") &&
!(_x getVariable["lootvehicle",false])
};
diag_log format["_patrolVehicles = %1",_patrolVehicles];
{
_missionPatrolVehicles pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x,maxVehiclePatrolRadius,maxVehiclePatrolRadius];
}forEach _patrolVehicles;
private _subPatrols = [];
private _subs = _objects select {
((typeOf _x) isKindOf "SDV_01_base_F") &&
!(_x in _lootVehicles)
};
diag_log format["_subs = %1",_subs];
{
_subPatrols pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x,maxVehiclePatrolRadius,maxVehiclePatrolRadius];
} forEach _subs;
private _airPatrols = [];
private _airVehicles = _objects select {
((typeOf _x) isKindOf "Air")
};
diag_log format["_airVehicles = %1",_airvehicles];
{
_airPatrols pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x,aircraftPatrolRadius,aircraftPatrolRadius];
} forEach _airVehicles;
private _staticWeapons = [];
private _statics = _objects select {
((typeOf _x) isKindOf "StaticWeapon") &&
!(_x in _garisonedStatics)
};
diag_log format["_statics = %1",_statics];
{
_staticWeapons pushBack format[' ["%1",%2,%3]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x];
} forEach _statics;
private _infantry = _units select {
!(surfaceIsWater (getPos _x)) &&
!(_x in _garisonedUnits)
};
diag_log format["_garisonedUnits = %1",_garisonedUnits];
diag_log format["_infantry = %1",_infantry];
private _units = [];
{
{
if (vehicle _x isEqualTo _x) then {_units pushBack _x};
} forEach (units _x);
} forEach _groups;
_infantryGroups = [];
{
_infantryGroups pushBack format[' [%1,%2,%3,"%4",%5,%6]',(getPosATL _x) vectorDiff CENTER,blck_minAI,blck_maxAI,blck_MissionDifficulty,minPatrolRadius,maxPatrolRadius];
} forEach _units;
private _scuba = _units select {
(surfaceIsWater (getPos _x)) &&
!([_x] call blck3DEN_fnc_isInside)
// checck _x get3EDENAtribute "name" != "garrison";
};
diag_log format["_scuba = %1",_scuba];
private _scubaGroups = [];
{
_scubaGroups pushBack format[' [%1,%2,%3,"%4",%5,%6]',(getPosATL _x) vectorDiff CENTER,blck_minAI,blck_maxAI,blck_MissionDifficulty,minPatrolRadius,maxPatrolRadius];
} forEach _scuba;
private _lootContainers = [];
private _ammoBoxes = _objects select { // "ReammoBox_F"
(((typeOf _x) isKindOf "ReammoBox") || ((typeOf _x) isKindOf "ReammoBox_F"))
};
diag_log format["_ammoBoxes = %1",_ammoboxes];
{
_lootContainers pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER, '_crateLoot','_lootCounts',getDir _x];
}forEach _ammoBoxes;
private _missionCoords = [];
if (toLower(missionNamespace getVariable["blck_missionLocations","random"]) isEqualTo "fixed") then
{
_missionCoords pushBack CENTER;
};
private _lines = [];
private _lineBreak = toString [10];
_lines pushBack "/*";
_lines pushBack " Dynamic Mission Generated";
_lines pushBack " Using 3DEN Plugin for blckeagls";
_lines pushBack format[" %1",['dynamic'] call blck3DEN_fnc_versionInfo];
_lines pushBack " By Ghostrider-GRG-";
_lines pushBack "*/";
_lines pushBack "";
_lines pushBack '#include "\q\addons\custom_server\Configs\blck_defines.hpp";';
_lines pushBack '#include "\q\addons\custom_server\Missions\privateVars.sqf";';
_lines pushBack "";
_lines pushBack format["_defaultMissionLocations = %1;",_missionCoords];
_lines pushBack format["_markerType = %1",format['["%1",%2,"%3"];',_markerType,_markerSize,_markerBrush]];
_lines pushBack format['_markerColor = "%1";',_markerColor];
_lines pushBack format['_startMsg = "%1";',blck_dynamicStartMessage];
_lines pushBack format['_endMsg = "%1";',blck_dynamicEndMessage];
_lines pushBack format['_markerMissionName = "%1";',blck_dynamicmarkerMissionName];
_lines pushBack format['_crateLoot = blck_BoxLoot_%1;',blck_MissionDifficulty];
_lines pushBack format['_lootCounts = blck_lootCounts%1;',blck_MissionDifficulty];
_lines pushBack "";
_lines pushBack "_garrisonedBuildings_BuildingPosnSystem = [";
_lines pushBack (_garisonedPos joinString (format[",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_garrisonedBuilding_ATLsystem = [";
_lines pushBack (_garrisonATL joinString (format[",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLandscape = [";
_lines pushback (_missionLandscape joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_simpleObjects = [";
_lines pushback (_missionSimpleObjects joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLootVehicles = [";
_lines pushBack (_missionLootVehicles joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionPatrolVehicles = [";
_lines pushback (_missionPatrolVehicles joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_submarinePatrolParameters = [";
_lines pushback (_subPatrols joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_airPatrols = [";
_lines pushback (_airPatrols joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionEmplacedWeapons = [";
_lines pushback (_staticWeapons joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionGroups = [";
_lines pushback (_infantryGroups joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_scubaGroupParameters = [";
_lines pushback (_scubaGroups joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLootBoxes = [";
_lines pushback (_lootContainers joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "/*";
_lines pushBack " Use the parameters below to customize your mission - see the template or blck_configs.sqf for details about each them";
_lines pushBack "*/";
_lines pushBack format["_chanceHeliPatrol = blck_chanceHeliPatrol%1;",blck_MissionDifficulty];
_lines pushBack format["_noChoppers = blck_noPatrolHelis%1;",blck_MissionDifficulty];
_lines pushBack format["_missionHelis = blck_patrolHelis%1;",blck_MissionDifficulty];
_lines pushBack format["_chancePara = blck_chancePara%1;",blck_MissionDifficulty];
_lines pushBack format["_noPara = blck_noPara%1;",blck_MissionDifficulty];
_lines pushBack format["_paraTriggerDistance = 400;"];
_lines pushBack format["_paraSkill = '%1';",blck_MissionDifficulty];
_lines pushBack format["_chanceLoot = 0.0;"];
_lines pushBack format["_paraLoot = blck_BoxLoot_%1;",blck_MissionDifficulty];
_lines pushBack format["_paraLootCounts = blck_lootCounts%1;",blck_MissionDifficulty];
_lines pushBack format['_missionLandscapeMode = "precise";'];
_linse pushBack "_useMines = blck_useMines;";
_lines pushBack "_uniforms = blck_SkinList;";
_lines pushBack "_headgear = blck_headgear;";
_lines pushBack "_vests = blck_vests;";
_lines pushBack "_backpacks = blck_backpacks;";
_lines pushBack "_sideArms = blck_Pistols;";
_lines pushBack format['_spawnCratesTiming = "%1";',blck_spawnCratesTiming];
_lines pushBack format['_loadCratesTiming = "%1";',blck_loadCratesTiming];
_lines pushBack format['_endCondition = "%1";',blck_missionEndCondition];
_lines pushBack format["_minNoAI = blck_MinAI_%1;",blck_MissionDifficulty];
_lines pushBack format["_maxNoAI = blck_MaxAI_%1;",blck_MissionDifficulty];
_lines pushBack format["_noAIGroups = blck_AIGrps_%1;",blck_MissionDifficulty];
_lines pushBack format["_noVehiclePatrols = blck_SpawnVeh_%1;",blck_MissionDifficulty];
_lines pushBack format["_noEmplacedWeapons = blck_SpawnEmplaced_%1;",blck_MissionDifficulty];
_lines pushBack format["_minNoAI = blck_MinAI_%1;",blck_MissionDifficulty];
_lines pushBack format["_maxNoAI = blck_MaxAI_%1;",blck_MissionDifficulty];
_lines pushBack format["_noAIGroups = blck_AIGrps_%1;",blck_MissionDifficulty];
_lines pushBack format["_noVehiclePatrols = blck_SpawnVeh_%1;",blck_MissionDifficulty];
_lines pushBack format["_noEmplacedWeapons = blck_SpawnEmplaced_%1;",blck_MissionDifficulty];
_lines pushBack "_submarinePatrols = 0; // Default number of submarine patrols at pirate missions";
_lines pushBack "_scubaPatrols = 0; // Default number of scuba diver patrols at pirate missions";
_lines pushBack "";
_lines pushBack '#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf";';
diag_log ["dynamic"] call blck3EDEN_fnc_versionInfo;
uiNameSpace setVariable ["Display3DENCopy_data", ["dynamicMission.sqf", _lines joinString _lineBreak]];
(findDisplay 313) createdisplay "Display3DENCopy";

View File

@ -0,0 +1,305 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
objectAtMissionCenter = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "objectAtMissionCenter");
blck_minAI = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "minAI");
blck_maxAI = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxAI");
minPatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "minPatroRadius");
maxPatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxPatrolRadius");
maxVehiclePatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxVehiclePatrolRadius");
aircraftPatrolRadius = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "aircraftPatrolRadius");
oddsOfGarison = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "oddsOfGarison");
maxGarrisonStatics = getNumber(configFile >> "CfgBlck3DEN" >> "configs" >> "maxGarrisonStatics");
typesGarrisonStatics = getArray(configFile >> "CfgBlck3DEN" >> "configs" >> "typesGarrisonStatics");
blck_MissionDifficulty = missionNamespace getVariable["blck_difficulty",getText(configFile >> "CfgBlck3DEN" >> "configs" >> "defaultMissionDifficulty")];
lootVehicleVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "lootVehicleVariableName");
buildingPosGarrisonVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "buildingPosGarrisonVariableName");
buildingATLGarrisionVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "buildingATLGarrisionVariableName");
{
diag_log format["param %1 = %2",_forEachIndex,_x];
} forEach [
objectAtMissionCenter,
blck_minAI,
blck_maxAI,
minPatrolRadius,
maxPatrolRadius,
maxVehiclePatrolRadius,
aircraftPatrolRadius,
oddsOfGarison,
maxGarrisonStatics,
typesGarrisonStatics,
blck_MissionDifficulty,
lootVehicleVariableName,
buildingPosGarrisonVariableName,
buildingATLGarrisionVariableName
];
CENTER = [0,0,0];
diag_log format["Static Mission Export called at %1",diag_tickTime];
diag_log format["With blck_MissionDifficulty = %1",blck_MissionDifficulty];
/*
Set Default Values Where not Defined using Menu Commands
*/
if (isNil "blck_dynamicCrateLoot") then
{
blck_dynamicCrateLoot = format["_crateLoot = blck_BoxLoot_%1;",blck_MissionDifficulty];
};
if (isNil "blck_dynamicCrateLootCounts") then {
blck_dynamicCrateLootCounts = format["_lootCounts = blck_lootCounts%1;",blck_MissionDifficulty];
};
/*
Look for an object defined in CfgBlck3DEN \ configs \ that marks the center of the mission
and set the coords of the center if such an object is found
*/
private _centerMarkers = allMissionObjects objectAtMissionCenter;
diag_log format["_centerMarkers = %1",_centerMarkers];
if !(_centerMarkers isEqualTo []) then
{
CENTER = getPosATL (_centerMarkers select 0);
diag_log format["CENTER defined by object %1 typeOf %2",_centerMarker,typeOf (_centerMarkers select 0)];
} else {
diag_log format["<WARNING> No object marking the center of the mission was found: using a flashing road cone or flag is recommended",getText(configFile >> "CfgVehicles" >> objectAtMissionCenter >> "displayName")];
diag_log format["Place such an object or a marker to ensure the mission is accurately stored and spawned"];
};
all3DENEntities params ["_objects","_groups","_triggers","_systems","_waypoints","_markers","_layers","_comments"];
private _units = [];
{
{
if (vehicle _x isEqualTo _x) then {_units pushBack _x};
} forEach (units _x);
} forEach _groups;
private["_m1","_markerPos","_markerType","_markerShape","_markerColor","_markerText","_markerBrush","_markerSize","_markerAlpha","_missionCenter"];
/*
pull info on the first marker found
*/
if !(_markers isEqualTo []) then
{
_m1 = _markers select 0;
_markerType = (_m1 get3DENAttribute "itemClass") select 0;
//_markerShape = (_m1 get3DENAttribute "markerType") select 0;
_markerColor = (_m1 get3DENAttribute "baseColor") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
if !(_markerText isEqualTo "") then {blck_dynamicmarkerMissionName = _markerText};
_markerBrush = (_m1 get3DENAttribute "brush") select 0;
_markerPos = (_m1 get3DENAttribute "position") select 0;
_markerSize = (_m1 get3DENAttribute "size2") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
/*
use the coordinates of that marker as mission center of no object demarkating the center is found
*/
} else {
_markerType = "mil_square";
//_markerShape = "";
_markerSize = [0,0];
_markerColor = "COLORRED";
_markerBrush = "";
diag_log format["<WARNING> No marker was found, using default values and position for mission center position"];
};
diag_log format["_m1 = %1 | _type = %2 | _shape = %3 | _size = %4 | _color = %5 | _brush = %6 | _text = %7",_m1,_markerType,_markerShape,_markerSize,_markerColor,_markerBrush,_markerText];
private _garisonedBuildings = [];
private _garisonedStatics = [];
private _garisonedUnits = [];
private _landscape = _objects select{
!((_x get3DENAttribute "objectIsSimple") select 0) &&
((typeOf _x) isKindOf "Static") &&
!((typeOf _x) isKindOf "Helper")
};
diag_log format["CENTER = %1 | _landscape = %2","ignored",_landscape];
private _missionLandscape = [];
{
private _allowDamage = (_x get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_x get3DENAttribute "enableSimulation") select 0;
_missionLandscape pushBack format[' ["%1",%2,%3,%4]',typeOf _x,(getPosATL _x),[vectorDir _x,vectorUp _x], [_allowDamage,_enableSimulation]];
}forEach _landscape;
private _simpleObjects = _objects select {(_x get3DENAttribute "objectIsSimple") select 0};
diag_log format["_simpleObjects = %1",_simpleObjects];
private _missionSimpleObjects = [];
{
_missionSimpleObjects pushBack format[' ["%1",%2,%3]',
(_x get3DENAttribute "ItemClass") select 0,
((_x get3DENAttribute "position") select 0),
((_x get3DENAttribute "rotation") select 0) select 2
];
} forEach _simpleObjects;
private _missionLootVehicles = [];
private _lootVehicles = _objects select {
((typeOf _x) isKindOf "AllVehicles") &&
!((typeOf _x) isKindOf "Man") &&
(_x get3DENAttribute "name" isEqualTo lootVehicleVariableName)
};
diag_log format["_lootVehicles = %1",_lootVehicles];
{
_missionLootVehicles pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x), [vectorDir _x,vectorUp _x],'_crateLoot','_lootCounts'];
} forEach _lootVehicles;
_missionPatrolVehicles = [];
private _patrolVehicles = _objects select {
(((typeOf _x) isKindOf "Car") || ((typeOf _x) isKindOf "Tank") || ((typeOf _x) isKindOf "Ship")) &&
!((typeOf _x) isKindOf "SDV_01_base_F") &&
!(_x in _lootVehicles)
};
diag_log format["_patrolVehicles = %1",_patrolVehicles];
{
_missionPatrolVehicles pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x,maxVehiclePatrolRadius,600,-1];
}forEach _patrolVehicles;
private _subPatrols = [];
private _subs = _objects select {
((typeOf _x) isKindOf "SDV_01_base_F") &&
!(_x in _lootVehicles)
};
diag_log format["_subs = %1",_subs];
{
_subPatrols pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x),getDir _x,maxVehiclePatrolRadius,600,-1];
} forEach _subs;
private _airPatrols = [];
private _airVehicles = _objects select {
(typeOf _x) isKindOf "Air"
};
diag_log format["_airVehicles = %1",_airvehicles];
{
_airPatrols pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x),getDir _x,aircraftPatrolRadius,900,-1];
} forEach _airVehicles;
private _staticWeapons = [];
private _statics = _objects select {
((typeOf _x) isKindOf "StaticWeapon") &&
!(_x in _garisonedStatics)
};
diag_log format["_statics = %1",_statics];
{
_staticWeapons pushBack format[' ["%1",%2,%3]',typeOf _x,(getPosATL _x),getDir _x,0,-1];
} forEach _statics;
private _infantry = _units select {
!(surfaceIsWater (getPos _x)) &&
!(_x in _garisonedUnits)
};
diag_log format["_infantry = %1",_infantry];
_infantryGroups = [];
{
_infantryGroups pushBack format[' [%1,%2,%3,"%4",%5,%6]',(getPosATL _x),blck_minAI,blck_maxAI,blck_MissionDifficulty,maxPatrolRadius,600,-1];
} forEach _units;
private _scuba = _units select {
(surfaceIsWater (getPos _x)) &&
!(_x in _garisonedUnits)
// checck _x get3EDENAtribute "name" != "garrison";
};
diag_log format["_scuba = %1",_scuba];
private _scubaGroups = [];
{
_scubaGroups pushBack format[' [%1,%2,%3,"%4",%5,%6]',(getPosATL _x),blck_minAI,blck_maxAI,blck_MissionDifficulty,maxPatrolRadius,600,-1];
} forEach _scuba;
private _lootContainers = [];
private _ammoBoxes = _objects select {
(((typeOf _x) isKindOf "ReammoBox") || ((typeOf _x) isKindOf "ReammoBox_F"))
};
diag_log format["_ammoBoxes = %1",_ammoboxes];
{
_lootContainers pushBack format[' ["%1",%2,%3,%4,%5,%6]',typeOf _x,(getPosATL _x), [vectorDir _x,vectorUp _x],[true,true],'_crateLoot','_lootCounts'];
}forEach _ammoBoxes;
private _lines = [];
private _lineBreak = toString [10];
_lines pushBack "/*";
_lines pushBack " Static Mission Generated";
_lines pushBack " Using 3DEN Plugin for blckeagls";
_lines pushBack format[" %1",['dynamic'] call blck3DEN_fnc_versionInfo];
_lines pushBack " By Ghostrider-GRG-";
_lines pushBack "*/";
_lines pushBack "";
_lines pushBack '#include "\q\addons\custom_server\Configs\blck_defines.hpp";';
_lines pushBack '#include "privateVars.sqf";';
_lines pushBack "";
_lines pushBack format["_missionCenter = %1;",_markerPos];
if !(_markerBrush isEqualTo "") then
{
_lines pushBack format["_markerType = %1",format['["%1",%2,%3];',_markerType,_markerSize,_markerBrush]];
} else {
_lines pushBack format["_markerType = %1",format['"%1",%2',_markerType,_markerSize]];
};
_lines pushBack format['_markerColor = "%1";',_markerColor];
_lines pushBack format['_markerMissionName = "%1";',blck_dynamicmarkerMissionName];
_lines pushBack format['_crateLoot = blck_BoxLoot_%1;',blck_MissionDifficulty];
_lines pushBack format['_lootCounts = blck_lootCounts%1;',blck_MissionDifficulty];
_lines pushBack "";
_lines pushBack "_missionLandscape = [";
_lines pushback (_missionLandscape joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_simpleObjects = [";
_lines pushback (_missionSimpleObjects joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLootVehicles = [";
_lines pushBack (_missionLootVehicles joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_vehiclePatrolParameters = [";
_lines pushback (_missionPatrolVehicles joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_submarinePatrolParameters = [";
_lines pushback (_subPatrols joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_airPatrols = [";
_lines pushback (_airPatrols joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionEmplacedWeapons = [";
_lines pushback (_staticWeapons joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_aiGroupParameters = [";
_lines pushback (_infantryGroups joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_aiScubaGroupParameters = [";
_lines pushback (_scubaGroups joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLootBoxes = [";
_lines pushback (_lootContainers joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "/*";
_lines pushBack " Use the parameters below to customize your mission - see the template or blck_configs.sqf for details about each them";
_lines pushBack "*/";
_linse pushBack "_useMines = blck_useMines;";
_lines pushBack "_uniforms = blck_SkinList;";
_lines pushBack "_headgear = blck_headgear;";
_lines pushBack "_vests = blck_vests;";
_lines pushBack "_backpacks = blck_backpacks;";
_lines pushBack "_sideArms = blck_Pistols;";
_lines pushBack "";
_lines pushBack '#include "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_initializeMission.sqf"; ';
diag_log ["static"] call blck3EDEN_fnc_versionInfo;
uiNameSpace setVariable ["Display3DENCopy_data", ["staticMission.sqf", _lines joinString _lineBreak]];
(findDisplay 313) createdisplay "Display3DENCopy";

View File

@ -0,0 +1,62 @@
_cb = "";
//////////////////
// *** OPTIONAL ****
// Place a marker over your mission and configure it as you would like to to appear in the tame.
// The marker configuration will be included in the output of this script.
// Note ** Only the first marker placed will be processed **
// Configure Marker
/////////////////
/*
_markerType = ["ELIPSE",[175,175],"GRID"];
_markerType = ["mil_triangle",[0,0]];
*/
diag_log format["<< ---- START %1 ---- >>",diag_tickTime];
_allmkr = allMapMarkers;
diag_log format["_allmkr = %1",_allmkr];
if (count _allmkr == 0) then
//if !(typeName _mk isEqualTo "STRING") then
{
hint "No Marker Found, no Marker Definitions Will Be generated";
uiSleep 5;
} else {
_mk = _allmkr select 0;
diag_log format["_mk = %1",_mk];
systemChat format["marker shape = %1",markerShape _mk];
systemChat format["marker type = %1",markerType _mk];
systemChat format["marker size = %1",markerSize _mk];
systemChat format["markerColor = %1",markerColor _mk];
systemChat format["marker brush = %1",markerBrush _mk];
//systemChat
switch (toUpper(markerShape _mk)) do
{
case "ELLIPSE": {
_cb = _cb + format['_markerType = ["%1",%2,"%3"];%4',toUpper(MarkerShape _mk),getMarkerSize _mk,toUpper(markerBrush _mk),endl];
};
case "RECTANGLE": {
_cb = _cb + format['_markerType = ["%1",%2,"%3"];%4',toUpper(MarkerShape _mk),getMarkerSize _mk,toUpper(markerBrush _mk),endl];
};
case "ICON": {
_cb = _cb + format['_markerType = ["%1"];%2',getMarkerType _mk,endl];
};
};
_cb = _cb + format['_markerColor = "%1";%2',markerColor _mk,endl];
_cb = _cb + format['_markerLabel = "%1";%2',MarkerText _mk,endl];
_cb = _cb + format["%1%1",endl];
};
///////////////////
// All done, notify the user and copy the output to the clipboard
///////////////////
_msg = "Marker Data organzied, formated and copied to the Clipboard";
hint _msg;
systemChat _msg;
systemChat format["_cb has %1 characters",count _cb];
copyToClipboard _cb;
diag_log "DONE";

View File

@ -0,0 +1 @@
CENTER = getPos player;

View File

@ -0,0 +1,81 @@
/*
Mission Template by Ghostrider [GRG]
Mission Compositions by Bill prepared for ghostridergaming
Copyright 2016
Last modified 3/20/17
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#include "\q\addons\custom_server\Missions\privateVars.sqf";
//diag_log "[blckeagls] Spawning Green Mission with template = default";
_crateLoot = blck_BoxLoot_Green;
_lootCounts = blck_lootCountsGreen;
_startMsg = "An enemy research center was sighted in a nearby sector! Check the Green marker on your map for the location!";
_endMsg = "The Sector at the Green Marker is under survivor control!";
_markerMissionName = "Research Center";
_missionLandscapeMode = "precise"; // acceptable values are "none","random","precise"
//////////
// Past the output of the script here
//////////
// The lines below define additional variables you may wish to configure.
// Change _useMines to true/false below to enable mission-specific settings.
_useMines = blck_useMines;
_minNoAI = blck_MinAI_Green;
_maxNoAI = blck_MaxAI_Green;
_noAIGroups = blck_AIGrps_Green;
_noVehiclePatrols = blck_SpawnVeh_Green;
_noEmplacedWeapons = blck_SpawnEmplaced_Green;
_minNoAI = blck_MinAI_Blue; // Setting this in the mission file overrides the defaults such as blck_MinAI_Blue
_maxNoAI = blck_MaxAI_Blue; // Setting this in the mission file overrides the defaults
_noAIGroups = blck_AIGrps_Blue; // Setting this in the mission file overrides the defaults
_noVehiclePatrols = blck_SpawnVeh_Blue; // Setting this in the mission file overrides the defaults
_noEmplacedWeapons = blck_SpawnEmplaced_Blue; // Setting this in the mission file overrides the defaults
// Change _useMines to true/false below to enable mission-specific settings.
_useMines = blck_useMines; // Setting this in the mission file overrides the defaults
_uniforms = blck_SkinList; // Setting this in the mission file overrides the defaults
_headgear = blck_headgear; // Setting this in the mission file overrides the defaults
_vests = blck_vests;
_backpacks = blck_backpacks;
_weaponList = ["blue"] call blck_fnc_selectAILoadout;
_sideArms = blck_Pistols;
_chanceHeliPatrol = blck_chanceHeliPatrolBlue; // Setting this in the mission file overrides the defaults
_noChoppers = blck_noPatrolHelisBlue;
_missionHelis = blck_patrolHelisBlue;
_chancePara = blck_chanceParaBlue; // Setting this in the mission file overrides the defaults
_noPara = blck_noParaBlue; // Setting this in the mission file overrides the defaults
_paraTriggerDistance = 400; // Distance from mission at which a player triggers these reinforcements and any supplemental loot. // To have paras spawn at the time the mission spawns with/without accompanying loot set this to 0.
_paraSkill = "red"; // Choose any skill you like; bump up skill or add AI to justify more valuable loot.
_chanceLoot = 0.0;
_paraLoot = blck_BoxLoot_Blue;
_paraLootCounts = blck_lootCountsRed; // Throw in something more exotic than found at a normal blue mission.
_spawnCratesTiming = blck_spawnCratesTiming; // Choices: "atMissionSpawnGround","atMissionEndGround","atMissionEndAir".
// Crates spawned in the air will be spawned at mission center or the position(s) defined in the mission file and dropped under a parachute.
// This sets the default value but can be overridden by defining _spawnCrateTiming in the file defining a particular mission.
_loadCratesTiming = blck_loadCratesTiming; // valid choices are "atMissionCompletion" and "atMissionSpawn";
// Pertains only to crates spawned at mission spawn.
// This sets the default but can be overridden for specific missions by defining _loadCratesTiming
// Examples:
// To spawn crates at mission start loaded with gear set blck_spawnCratesTiming = "atMissionSpawnGround" && blck_loadCratesTiming = "atMissionSpawn"
// To spawn crates at mission start but load gear only after the mission is completed set blck_spawnCratesTiming = "atMissionSpawnGround" && blck_loadCratesTiming = "atMissionCompletion"
// To spawn crates on the ground at mission completion set blck_spawnCratesTiming = "atMissionEndGround" // Note that a loaded crate will be spawned.
// To spawn crates in the air and drop them by chutes set blck_spawnCratesTiming = "atMissionEndAir" // Note that a loaded crate will be spawned.
_endCondition = blck_missionEndCondition; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"
// Setting this in the mission file overrides the defaults
//_timeOut = -1;
#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf";

View File

@ -0,0 +1,59 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Parts of config.cpp were derived from the Exile_3EDEN editor plugin
* and is licensed as follows:
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
#include "defines.h"
class CfgBlck3DEN
{
class configs
{
objectAtMissionCenter = "RoadCone_L_F";
minAI = 3;
maxAI = 6;
minPatroRadius = 30;
maxPatrolRadius = 45;
maxVehiclePatrolRadius = 75;
aircraftPatrolRadius = 1000;
oddsOfGarison = 0.67;
maxGarrisonStatics = 3;
typesGarrisonStatics = [];
defaultMissionDifficulty = "Blue";
defaultLootcrateSpawnTiming = "atMissionSpawnGround";
defaultLootcrateLoadTiming = "atMissionSpawn";
defaultMissionEndState = "allKilledOrPlayerNear";
// Enter the string shown here under Atributes\Variable Name
// to demarcate this vehicle as a loot vehicle
lootVehicleVariableName = "lootVehicle";
// Enter the string shown here under Atributes\Variable Name
// To indicate that a garrison should be placed at standard Arma
// building positions
buildingPosGarrisonVariableName = "pos";
// Enter the string shown here under Atributes\Variable Name
// To indicate that a garrison should be placed using setPosATL
// relative to the spawn position of the building
buildingATLGarrisionVariableName = "atl";
aiRespawnTime = 600; // respawn time for infantry
vehicleRespawnTime = 900; // respawn time for vehicle patrols
aircraftRespawnTime = 1200; // respawn time for aircraft patrols
};
/****************************************
DO NOT TOUCH ANYTHING BELOW THIS LINE
*****************************************/
class CfgVersion
{
version = 1.0;
build = 8;
date = "10/05/20";
};
};

View File

@ -0,0 +1,491 @@
// defines.h
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
Parts of defines.h were derived from the Exile_3EDEN editor plugin
* and is licensed as follows:
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
/*
**************************************
DO NOT CHANGE ANYTHING BELOW THIS LINE
**************************************
*/
class CfgPatches
{
class blckeagls_3den
{
requiredVersion = 0.1;
requiredAddons[] = {3DEN};
units[] = {};
weapons[] = {};
magazines[] = {};
ammo[] = {};
};
};
///////////////////////////////////////////////////////////////////////////////
class CfgFunctions
{
class blck3DEN
{
class Export
{
file = "3EDEN_plugin\Export";
class exportDynamic {};
class exportStatic {};
};
class Core
{
file = "3EDEN_plugin\Core";
class about {};
class buildingContainer {};
class configureGarrisonATL {};
class createLootMarker {};
class createGarrisonMarker {};
class display {};
class displayGarrisonMarkers {};
class displayLootMarkers {};
class getGarrisonInfo {};
class getLootVehicleInfo {};
class isInside {};
class loadCratesTiming {};
class onDrag {};
class onRegistered {};
class onUnregister {};
class removeMarker {};
class setDifficulty {};
class setCompletionMode {}
class setGarrison {};
class setLootVehicle {};
class setSpawnLocations {};
class spawnCratesTiming {};
class versionInfo {};
};
};
};
///////////////////////////////////////////////////////////////////////////////
class ctrlCombo;
class ctrlCheckbox;
class ctrlCheckboxes;
class ctrlEdit;
class cfg3DEN
{
class EventHandlers
{
class blckeagls
{
OnMissionLoad = "call blck3DEN_fnc_initializeAttributes";
OnMissionNew = "call blck3DEN_fnc_initializeAttributes";
//onHistoryChange = "call blck3DEN_fnc_updateObjects";
};
};
class Attributes
{
class Default;
class Title: Default
{
class Controls
{
class Title;
};
};
class Combo: Title
{
class Controls: Controls
{
class Title: Title {};
class Value: ctrlCombo {};
};
};
};
class Mission
{
};
class Object
{
class AttributeCategories
{
};
};
};
class CfgVehicles
{
};
class ctrlMenuStrip;
class ctrlMenu;
class display3DEN
{
class Controls
{
class MenuStrip: ctrlMenuStrip
{
class Items
{
items[] += {"Blackeagls"};
class Blackeagls
{
text = "Blackeagls";
items[] = {
"blckAbout3EDENPlugin",
"blckSeparator",
"blckMissionDifficulty",
"blckMissionCompletionMode",
"lootSpawnTiming",
"loadCratesTiming",
"blckSeparator",
//"blckMissionMessages",
"blckMissionLocation",
"blckSeparator",
"blck_setGarrison",
//"blck_getGarrisonInfo",
//"blck_getMissionGarrisonInfo",
"blckSeparator",
"blck_markLootVehicle",
//"blck_getLootVehicleInfo",
//"blck_getMissionLootVehicleInfo",
"blckSeparator",
"blckSaveStaticMission",
"blckSaveDynamicMission",
"blckSeparator",
"blck3EDENPluginHelp"
};
};
class blckAbout3EDENPlugin
{
text = "3EDEN Plugin Version 1.0 for BlckEagls by Ghostrider-GRG-";
action = "call blck3EDEN_fnc_about";
};
class blckSeparator
{
value = 0;
};
class blck_setDifficulty
{
text = "Set Mission Difficulty";
items[] = {
"difficulty_blue"
};
};
class difficulty_blue
{
text = "Easy (Blue)";
action = "['Blue'] call blck3DEN_fnc_setDifficulty";
};
class blck_setLootSpawnTime
{
text = "Set Lootcrate Spawn Timing";
action = "edit3DENMissionAttributes 'lootSpawnTime'";
};
class blckMissionDifficulty
{
text = "Set Mission Difficulty";
items[] = {
"blckDifficultyBlue",
"blckDifficultyRed",
"blckDifficutlyGreen",
"blckDifficultyOrange"
};
};
class blckDifficultyBlue
{
text = "Set Mission Difficutly to EASY (Blue)";
action = "['Blue'] call blck3DEN_fnc_setDifficulty;";
value = "Blue";
};
class blckDifficultyRed
{
text = "Set Mission Difficulty to MEDIUM (Red)";
action = "['Red'] call blck3DEN_fnc_setDifficulty;";
value = "Red";
};
class blckDifficutlyGreen
{
text = "Set Mission Difficult To HARD (Green)";
action = "['Green'] call blck3DEN_fnc_setDifficulty;";
value = "Green";
};
class blckDifficultyOrange
{
text = "Set Mission Difficulty to Very HARD (Orange)";
action = "['Orange'] call blck3DEN_fnc_setDifficulty;";
value = "Orange";
};
class blckMissionCompletionMode
{
text = "Set the Criterial for Mission Completion";
items[] = {
"playerNear",
"allUnitsKilled",
"allKilledOrPlayerNear"
};
};
class allUnitsKilled
{
text = "All AI Dead";
toolTip = "Mission is complete only when All AI are Dead";
action = "['allUnitsKilled'] call blck3DEN_fnc_setCompletionMode;";
value = "allUnitsKilled";
};
class playerNear
{
text = "Player near mission center";
toolTip = "MIssion is Complete when a player reaches the mission center";
action = "['playerNear'] call blck3DEN_fnc_setCompletionMode;";
value = "playerNear";
};
class allKilledOrPlayerNear
{
text = "Units Dead / Player @ Center";
toolTip = "Mission is Complete when all units are dead or a player reaches mission center";
action = "['allKilledOrPlayerNear'] call blck3DEN_fnc_setCompletionMode;";
value = "allKilledOrPlayerNear";
};
class lootSpawnTiming
{
text = "Set timing for spawning loot chests";
items[] = {
"atMissionSpawnGround",
"atMissionSpawnAir",
"atMissionEndGround",
"atMissionEndAir"
};
};
class atMissionSpawnGround
{
text = "Crates are spawned on the ground at mission startup";
action = "['atMissionSpawnGround'] call blck3DEN_fnc_spawnCratesTiming;";
};
class atMissionSpawnAir
{
text = "Crates are spawned in the air at mission startup";
action = "['atMissionSpawnAir'] call blck3DEN_fnc_spawnCratesTiming;";
};
class atMissionEndGround
{
text = "Crates are spawned on the ground at mission completion";
action = "['atMissionEndGround'] call blck3DEN_fnc_spawnCratesTiming;";
};
class atMissionEndAir
{
text = "Crates are spawned in the air at mission completion";
action = "['atMissionEndAir'] call blck3DEN_fnc_spawnCratesTiming;";
};
class loadCratesTiming
{
text = "Set timing for loading crates";
items[] = {
"atMissionSpawn",
"atMissionCompletion"
};
};
class atMissionSpawn
{
text = "Load crates when the mission spawns";
action = "['atMissionSpawn'] call blck3DEN_fnc_loadCratesTiming";
};
class atMissionCompletion
{
text = "Load crates when the mission is complete";
action = "['atMissionCompletion'] call blck3DEN_fnc_loadCratesTiming";
};
class blckMissionLocation
{
text = "Toggle Random or Fixed Location";
toolTip = "Set whether mission spawns at random or fixed locations";
items[] = {
"blck_randomLocation",
"blck_fixedLocation"
};
};
class blck_randomLocation
{
text = "Spawn at Random Locations (Default)";
action = "['randm'] call blck3DEN_fnc_setSpawnLocations";
};
class blck_fixedLocation
{
text = "Always spawn at the same location";
toolTip = "Use to have mission respawn at same location";
action = "['fixed'] call blck3DEN_fnc_setSpawnLocations";
};
///////////////////////////////////////////////////////
class blck_setGarrison
{
text = "Garrisoned Building Settings";
toolTip = "Set garrison status of selected buildings";
items[] = {
"blck_setGarrisonedState",
"blck_getGarrisonInfo",
"blck_garrisonMarkers"
};
};
class blck_setGarrisonedState
{
items[] = {
"blck_isGarrisoned",
"blck_clearGarrisoned"
};
text = "Garrison Settings";
};
class blck_isGarrisoned
{
text = "Garrison Building";
toolTip = "Flag selected buildings to be garrisoned";
value = true;
action = "[true] call blck3DEN_fnc_setGarrison";
};
class blck_clearGarrisoned
{
text = "Remove Garrison";
toolTip = "Selected Buildings will Not be Garrisoned";
value = false;
action = "[false] call blck3DEN_fnc_setGarrison";
};
class blck_getGarrisonInfo
{
text = "Get Building Garrisoned Setting";
toolTip = "Get the selected buildings garrisoned flag";
action = "call blck3DEN_fnc_getGarrisonInfo";
};
class blck_garrisonMarkers
{
items[] = {
"blck_GarrisonMarkersOn",
"blck_GarrisonMarkersOff"
};
text = "Toggle markers over garrisoned buildings";
};
class blck_GarrisonMarkersOn
{
text = "Display Markers over Garrisoned Buildings";
action = "[true] call blck3DEN_fnc_displayGarrisonMarkers";
};
class blck_GarrisonMarkersOff
{
text = "Hide Markers over Garrisoned Buildings";
action = "[false] call blck3DEN_fnc_displayGarrisonMarkers";
};
///////////////////////////////////////////////////////////////
class blck_markLootVehicle
{
text = "Loot Vehicle Settings";
items[] = {
"blck_designateLootVehicleState",
"blck_getLootVehicleInfo",
"blck_displayLootMarkers"
};
};
class blck_designateLootVehicleState
{
items[] = {
"blck_setAsLootVehicle",
"blck_clearLootVehicleFlag"
};
text = "Loot Vehicle Settings";
};
class blck_clearLootVehicleFlag
{
text = "Clear Loot Vehicle Settings";
action = "[false] call blck3DEN_fnc_setLootVehicle";
};
class blck_setAsLootVehicle
{
text = "Desinate Loot Vehicle";
action = "[true] call blck3DEN_fnc_setLootVehicle";
};
class blck_getLootVehicleInfo
{
text = "Get setting for selected vehicle";
action = "call blck3DEN_fnc_getLootVehicleInfo";
};
class blck_displayLootMarkers
{
items[] = {
"blck_lootMarkersOn",
"blck_lootMarkersOff"
};
text = "Toggle Loot Vehicle Markers";
};
class blck_lootMarkersOn
{
text = "Mark Loot Vehicles / Objects";
action = "[true] call blck3DEN_fnc_displayLootMarkers";
};
class blck_lootMarkersOff
{
text = "Hide Markers of Loot Vehicles / Objects";
action = "[false] call blck3DEN_fnc_displayLootMarkers";
};
/////////////////////////////
class blckSaveStaticMission
{
text = "Save StaticMission";
action = "call blck3DEN_fnc_exportStatic";
picture = "\a3\3DEN\Data\Displays\Display3DEN\ToolBar\save_ca.paa";
};
class blckSaveDynamicMission
{
text = "Save Dynamic Mission";
action = "call blck3DEN_fnc_exportDynamic";
picture = "\a3\3DEN\Data\Displays\Display3DEN\ToolBar\save_ca.paa";
};
class Blck3EDENPluginHelp
{
text = "Help";
action = "call blck3DEN_fnc_Help";
//picture = "\a3\3DEN\Data\Displays\Display3DEN\ToolBar\save_ca.paa";
};
};
};
};
};
///////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,7 @@
Features:
Exports static or dynamic missions preformated in .sqf code. Simply paste the output of the editor into a new .sqf file, edit entires to refine mission parameters and add the name of the mission file to GMS_missionLists.
Captures simple objects, sets allow dammage and allow similation according to editor settings, and captures marker configurations.

1
GMS/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
addons\GMS

View File

@ -0,0 +1,97 @@
private _safepos = [getMarkerPos "center",0,14000,0,0,0.5,0];
private _validspot = false;
private "_position";
_fnc_nearWater = {
_result = false;
_position = _this select 0;
_radius = _this select 1;
for "_i" from 0 to 359 step 45 do {
//_checkposition = [(_position select 0) + (sin(_i)*_radius), (_position select 1) + (cos(_i)*_radius)];
//_checkposition2 = [(_position select 0) + (sin(_i)*_radius/2), (_position select 1) + (cos(_i)*_radius/2)];
_checkPosition = _position getPos[_radius, _i];
if (surfaceIsWater _checkposition) exitWith {
_result = true;
};
};
_result
};
while{!_validspot} do {
//uiSleep 1;
_validspot = true;
_position = _safepos call BIS_fnc_findSafePos;
if (count _position > 2) then {
_validspot = false;
};
if(_validspot) then {
if ([_position,500] call _fnc_nearWater) then {
_validspot = false;
};
};
if(_validspot) then {
_isflat = _position isFlatEmpty [20,0,0.5,100,0,false];
if (_isflat isequalto []) then {
_validspot = false;
};
};
if(_validspot) then {
{
if (_position distance _x < 1500) exitwith {
_validspot = false;
};
} foreach (missionnamespace getvariable ["GMS_ActiveMissionCoords",[]]);
};
// Check for near Bases
if(_validspot) then {
if (GMSCore_modtype isEqualTo "Epoch") then {
{
if (_position distance _x < 1000) exitwith {
_validspot = false;
};
} foreach (missionnamespace getvariable ["Epoch_PlotPoles",[]]);
}
else {
if (GMSCore_modtype isEqualTo "Exile") then {
{
if (_position distance _x < GMS_minDistanceToBases) exitwith {
_validspot = false;
};
} foreach (nearestObjects [GMS_mapCenter, ["Exile_Construction_Flag_Static"], GMS_mapRange + 25000]);
};
};
};
// Check for near Players
if(_validspot) then {
{
if (_position distance _x < GMS_minDistanceToPlayer) exitwith {
_validspot = false;
};
} foreach allplayers;
};
// Check for near locations
if (_validspot) then {
{
if (_position distance (_x select 0) < (_x select 1)) exitWith {
_validspot = false;
};
} forEach GMS_locationBlackList;
};
// Check for DMS missions
if (GMS_minDistanceFromDMS > 0 && {_validspot}) then
{
{
if (_position distance _x < GMS_minDistanceFromDMS) exitWith {
_validspot = false;
};
} forEach ([] call GMS_fnc_getAllDMSMarkers);
};
};
_position set [2, 0];
_position

View File

@ -0,0 +1,193 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
Notes: cosine acute angle = hypotenuse / opposite. We always know the opposite = 1/2 mapsize so if we pick a random angle, we can calculate distance to edge of map.
Thus, we can have a random direction, calculate distance to the map edge as cos(direction - east/south/west/north angle) * 1/2 mapsize. Then, we can use 1/2 the lenght of the hypotenuse as the search range.
In this way we can reduce the radius of the search by about 1/2 and ensure a wider range of terrain is selected.
However, if we use this approach, we risk having some missions spawn outside the map so much check for that.
It may be quicker just to pick a random angle and use 1/2 map size to search a position obtained by getPos[(1/2 mapSize),random(359)]; to pick that random seed location for the search.
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
if (isNil "GMS_locationBlackList") then {GMS_locationBlackList = []};
_fn_buildBlacklistedLocationsList = {
params["_minToBases","_minToPlayers","_minToMissions","_minToTowns","_minToRecentMissionLocation"];
/* locations of villages / cities / others already included in GMS_locationBlackList so we do not need to add it here. */
private _blacklistedLocs = +GMS_locationBlackList;
for '_i' from 1 to (count GMS_recentMissionCoords) do {
private _loc = GMS_recentMissionCoords deleteAt 0;
if (_loc select 1 < diag_tickTime) then
{
GMS_recentMissionCoords pushBack _loc;
};
};
{
_blacklistedLocs pushBack [_x,_minToMissions];
} forEach GMS_ActiveMissionCoords;
private _bases = [];
if (GMSCore_modtype isEqualTo "Epoch") then {_bases = nearestObjects[GMS_mapCenter, ["PlotPole_EPOCH"], GMS_mapRange + 25000]};
if (GMSCore_modtype isEqualTo "Exile") then {_bases = nearestObjects[GMS_mapCenter, ["Exile_Construction_Flag_Static"], GMS_mapRange + 25000]};
{
_blacklistedLocs pushBack [getPosATL _x,_minToBases];
} forEach _bases;
{
_blacklistedLocs pushBack [getPosATL _x,_minToPlayers];
} forEach allPlayers;
if (GMS_minDistanceFromDMS > 0) then
{
_blacklistedLocs append ([] call GMS_fnc_getAllDMSMarkers);
};
_blacklistedLocs
};
_fnc_nearWater = {
private _result = false;
private _coords = _this select 0;
private _radius = _this select 1;
for "_i" from 0 to 359 step 45 do {
//_checkposition = [(_coords select 0) + (sin(_i)*_radius), (_coords select 1) + (cos(_i)*_radius)];
//_checkposition2 = [(_coords select 0) + (sin(_i)*_radius/2), (_coords select 1) + (cos(_i)*_radius/2)];
//_checkPosition = _coords getPos[_radius, _i];
if (surfaceIsWater (_coords getPos[_radius, _i])) exitWith {
_result = true;
};
};
_result
};
private _minDistToBases = GMS_minDistanceToBases;
private _minDistToPlayers = GMS_minDistanceToPlayer;
private _minDistToTowns = GMS_minDistanceFromTowns;
private _mindistToMissions = GMS_MinDistanceFromMission;
private _minToRecentMissionLocation = 200;
private _keyDistances = [_minDistToBases,_minDistToPlayers,_minDistToTowns,_minToRecentMissionLocation];
private _coords = [];
//private _blacklistedLocations = [_minDistToBases,_minDistToPlayers,_minDistToTowns,_mindistToMissions,_minToRecentMissionLocation] call _fn_buildBlacklistedLocationsList;
private _count = 25;
private _flatCoords = [];
private _slope = 0.15;
private _searchDist = GMS_mapRange / 2;
private _timeIn = diag_tickTime;
private _validspot = false;
while { !_validspot} do
{
private _angle = random(359);
private _searchCenter = GMS_mapCenter getPos[_searchDist, random(359)];
_coords = [_searchCenter,0,_searchDist,10,0,_slope,0] call BIS_fnc_findSafePos;
if (_coords isEqualTo []) then
{
_count = _count - 1;
_slope = _slope + 0.02;
uiSleep 0.1; // to give the server a chance to handle other jobs for a moment
diag_log format["_findSafePosn: _count = %1 | _slope = %2 | _coords = %3",_count,_slope,_coords];
} else {
//uiSleep 1;
_validspot = true;
if (count _coords > 2) then {
_validspot = false;
};
if(_validspot) then {
if ([_coords,500] call _fnc_nearWater) then {
_validspot = false;
};
};
if(_validspot) then {
_isflat = _coords isFlatEmpty [20,0,0.5,100,0,false];
if (_isflat isequalto []) then {
_validspot = false;
};
};
if(_validspot) then {
{
if (_coords distance _x < GMS_MinDistanceFromMission) exitwith {
_validspot = false;
};
} foreach (GMS_ActiveMissionCoords);
};
// Check for near Bases
if(_validspot) then {
if (GMSCore_modtype isEqualTo "Epoch") then {
{
if (_coords distance _x < GMS_minDistanceToBases) exitwith {
_validspot = false;
};
} foreach (missionnamespace getvariable ["Epoch_PlotPoles",[]]);
}
else {
if (GMSCore_modtype isEqualTo "Exile") then {
{
if (_coords distance _x < GMS_minDistanceToBases) exitwith {
_validspot = false;
};
} foreach (nearestObjects [GMS_mapCenter, ["Exile_Construction_Flag_Static"], GMS_mapRange + 25000]);
};
};
};
// Check for near Players
if(_validspot) then {
{
if (_coords distance _x < GMS_minDistanceToPlayer) exitwith {
_validspot = false;
};
} foreach allplayers;
};
// Check for near locations
if (_validspot) then {
{
if (_coords distance (_x select 0) < (_x select 1)) exitWith {
_validspot = false;
};
} forEach GMS_locationBlackList;
};
// Check for DMS missions
if (GMS_minDistanceFromDMS > 0 && {_validspot}) then
{
{
if (_coords distance _x < GMS_minDistanceFromDMS) exitWith {
_validspot = false;
};
} forEach ([] call GMS_fnc_getAllDMSMarkers);
};
};
//diag_log format["_fnc_findSafePosn: _coords = %1 | _flatCoords = %2 | _searchCenter = %3 | _angle %4 | _count = %5 | _validSpot = %6",_coords,_flatCoords,_searchCenter,_angle,_count,_validspot];
};
if (_coords isEqualTo []) then
{
["Could not find a safe position for a mission, consider reducing values for minimum distances between missions and players, bases, other missions or towns","error"] call GMS_fnc_log;
} else {
_coords set[2, 0];
//diag_log format["_fnc_findSafePosn: _exit with _coords = %1 | time spent = %2",_coords,diag_tickTime - _timeIn];
};
_coords

View File

@ -0,0 +1,179 @@
// self explanatory. Checks to see if the position is in either a black listed location or near a player spawn.
// As written this relies on BIS_fnc_findSafePos to ensure that the spawn point is not on water or an excessively steep slope.
//
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _startTime = diag_tickTime;
private _minDistFromBases = GMS_minDistanceToBases;
private _minDistFromMission = GMS_MinDistanceFromMission;
private _minDistanceFromTowns = GMS_minDistanceFromTowns;
private _minDistanceFromPlayers = GMS_minDistanceToPlayer;
private _weightBlckList = 0.95;
private _weightBases = 0.9;
private _weightMissions = 0.8;
private _weightTowns = 0.7;
private _weightPlayers = 0.6;
private _weightRecentMissions = 0.6;
private _minDistanceRecentMissions = 500;
// remove any recent mission locations that have timed out
for "_i" from 1 to (count GMS_recentMissionCoords) do
{
if (_i > (count GMS_recentMissionCoords)) exitWith {};
private _oldMission = GMS_recentMissionCoords deleteAt 0;
if (diag_tickTime < ((_oldMission select 1) + 900)) then
{
GMS_recentMissionCoords pushBack _oldMission;
};
};
private _waterMode = 0;
private _shoreMode = 0;
private _maxGrad = GMS_maxGradient;
private _minObjDist = 30;
private _searchDist = GMS_mapRange / 2;
private _coords = [];
private _findNew = true;
private _tries = 0;
while {_coords isEqualTo []} do
{
_findNew = false;
_coords = [];
// [center, minDist, maxDist, objDist, waterMode, maxGrad, shoreMode, blacklistPos, defaultPos] call BIS_fnc_findSafePos
while {_coords isEqualTo [] && {_tries < 500}} do
{
private _searchCenter = GMS_mapCenter getPos[_searchDist, random(359)];
_coords = [_searchCenter,0,_searchDist,_minObjDist,_waterMode,_maxGrad,_shoreMode] call BIS_fnc_findSafePos;
_tries = _tries + 1;
//[format["_fnc_findSafePosn(57): _tries = %1 | _coords = %2",_tries,_coords]] call GMS_fnc_log;
};
{
//diag_log format["_fnc_findSafePosn(67): _recentMissionCoords %1 = %2",_forEachIndex,_x];
if (((_x select 0) distance2D _coords) < _minDistanceRecentMissions) then
{
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(68): too close to recent missions"]] call GMS_fnc_log};
};
}forEach GMS_recentMissionCoords;
//diag_log format["_fnc_findSafePosn (61): _coords = %1 | _tries = %2 | count GMS_locationBlackList = %1",_coords,_tries, count GMS_locationBlackList];
{
//diag_log format["_fnc_findSafePosn (77): location _x = %1",_x];
if ( ((_x select 0) distance2D _coords) < (_x select 1)) exitWith
{
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(77): too close to blacklisted position _coords = %1 | blacklisted pos = %2 | dist to blacklisted pos = %3",_coords,_x select 0, _x select 1]] call GMS_fnc_log};
};
} forEach GMS_locationBlackList;
if !(_findNew) then
{
{
if ( (_x distance2D _coords) < _minDistFromMission) exitWith
{
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(87): too close to active mission"]] call GMS_fnc_log};
};
} forEach GMS_ActiveMissionCoords;
};
if !(_findNew) then
{
private _poles = [];
if (GMSCore_modtype isEqualTo "Epoch") then {_poles = allMissionObjects "PlotPole_EPOCH"};
if (GMSCore_modtype isEqualTo "Exile") then {_poles = allMissionObjects "Exile_Construction_Flag_Static"};
//diag_log format["_fnc_findSafePosn: count _poles = %1 | _poles = %2",count _poles,_poles];
{
if ((_x distance2D _coords) < GMS_minDistanceToBases) then
{
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(98): too close to bases"]] call GMS_fnc_log};
};
}forEach _poles;
};
if !(_findNew) then
{
{
_townPos = [((locationPosition _x) select 0), ((locationPosition _x) select 1), 0];
if (_townPos distance2D _coords < GMS_minDistanceFromTowns) exitWith {
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(109): too close to towns/cities"]] call GMS_fnc_log};
};
} forEach GMS_townLocations;
};
if !(_findNew) then
{
{
if (isPlayer _x && {(_x distance2D _coords) < GMS_minDistanceToPlayer}) then
{
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(120): too close to player"]] call GMS_fnc_log};
};
}forEach playableUnits;
};
if !(_findNew) then
{
// test for water nearby
for [{_i=0}, {_i<360}, {_i=_i+20}] do
{
//_xpos = (_coords select 0) + sin (_i) * _dist;
//_ypos = (_coords select 1) + cos (_i) * _dist;
//_newPos = [_xpos,_ypos,0];
if (surfaceIsWater (_coords getPos[50,_i])) exitWith
{
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(137): too close to water"]] call GMS_fnc_log};
};
};
};
if !(_findNew) then {
_isflat = _coords isFlatEmpty [20,0,0.5,100,0,false];
if (_isflat isequalto []) then {
_findNew = true;
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(146): position NOT flat"]] call GMS_fnc_log};
} else {
if (GMS_debugLevel >= 3) then {[format["_findSafePosn(150): _coords changed from %1 to %2 (the flattest)",_coords,_isFlat]] call GMS_fnc_log};
_coords = ASLToATL _isFlat;
};
};
if (_findNew) then
{
_minDistFromMission = _minDistFromMission * _weightMissions;
_minDistFromBases = _minDistFromBases * _weightBases;
_minDistanceFromPlayers = _minDistanceFromPlayers * _weightPlayers;
_minDistanceFromTowns = _minDistanceFromTowns * _weightTowns;
_minDistanceRecentMissions = _minDistanceRecentMissions * _weightRecentMissions;
_coords = [];
};
//[format["_fnc_findSafePosn(140) end of cycle logging: _tries = %1 | _coords = %2 | _findNew = %3",_tries,_coords,_findNew]] call GMS_fnc_log;
};
if ((count _coords) > 2) then
{
private["_temp"];
_temp = [_coords select 0, _coords select 1];
_coords = _temp;
};
//[format["_fnc_findSafePosn(148) final logging: _elapsedTime %3 | _tries = %1 | _coords = %2",_tries,_coords,diag_tickTime - _startTime]] call GMS_fnc_log;
_coords;

View File

@ -0,0 +1,21 @@
/*
[_item,_crate] call GMS_addItemToCrate;
where
_crate is a container such as ammo box or vehicle
_item is a string or array.
If _item is a string then add 1 of that item to the container.
If _item is an array with 2 elements ["itemName",3] then assume that the first element is a string and is the name of the item, and the second is the number to add.
if _item is an array with 3 elements ["itemName",2,6] assume that the first element is the item name (string), the second the min # to add and the third the max # to add.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
_this call GMSCore_fnc_addItem;

View File

@ -0,0 +1,19 @@
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
GMS_serverFPS = diag_FPS;
publicVariable "GMS_serverFPS";

View File

@ -0,0 +1,22 @@
/*
call as [] call GMS_fnc_cleanEmptyGroups;
Deletes any empty groups and thereby prevents errors resulting from createGroup returning nullGroup.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _grp = allGroups;
for "_i" from 1 to (count _grp) do
{
private _g = _grp deleteAt 0;
if ((count units _g) isEqualTo 0) then {deleteGroup _g};
};

View File

@ -0,0 +1,27 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params ["_AIList",["_returnMode",0]];
private["_alive","_total","_return"];
_total = count _AIList;
_alive = {alive _x} count _AIList;
switch (_returnMode) do
{
case 0:{_return = (_alive / _total)};
case 1:{_return = [_alive,_total]};
};
_return

View File

@ -0,0 +1,64 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private "_markers";
params[
"_markerName", // the name used when creating the marker. Must be unique.
"_markerPos",
"_markerLabel", // Text used to label the marker
"_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
["_markerSize",[0,0]],
["_markerBrush","GRID"]
];
if (GMS_debugLevel > 3) then
{
private _pList =[
"_markerName", // the name used when creating the marker. Must be unique.
"_markerPos",
"_markerLabel",
"_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
"_markerSize",
"_markerBrush"
];
for "_i" from 0 to ((count _this) - 1) do
{
diag_log format["_fnc_createMarker: parameter %1 = %2",_pList select _i,_this select _i];
};
};
if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon ....
{
private _m = createMarker [GMS_missionMarkerRootName + _markerName,_markerPos];
_m setMarkerShape _markerType;
_m setMarkerColor _markerColor;
_m setMarkerBrush _markerBrush;
_m setMarkerSize _markerSize;
private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos];
_m2 setMarkerType "mil_dot";
_m2 setMarkerColor "ColorBlack";
_m2 setMarkerText _markerLabel;
_markers = [_m,_m2];
//diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers];
} else {
private _m = "";
private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos];
_m2 setMarkerType _markerType;
_m2 setMarkerColor _markerColor;
_m2 setMarkerText _markerLabel;
_markers = [_m,_m2];
//diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers];
};
_markers

View File

@ -0,0 +1,17 @@
/*
GMS_fnc_deleteMarker
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params[["_markerName",""]];
deleteMarker _markerName;
deleteMarker (_markerName + "label");

View File

@ -0,0 +1,36 @@
/*
GMS_fnc_findPositionsAlongARadius
Generates an array of equidistant positions along the circle of diameter _radius
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_locs","_startDir","_currentDir","_Arc","_dist","_newpos"];
params["_center","_num","_minDistance","_maxDistance"];
_locs = [];
_startDir = round(random(360));
_currentDir = _startDir;
_Arc = 360/_num;
for "_i" from 1 to _num do
{
_currentDir = _currentDir + _Arc;
_dist = round(_minDistance + (random(_maxDistance - _minDistance)));
_newpos = _center getPos [_dist, _currentDir];
_locs pushback _newpos;
};
_locs

View File

@ -0,0 +1,16 @@
/*
GMS_fnc_findRandomLocationWithinCircle
Params["_center","_min","_max"];
_center = center of the circle
_min = minimum distance from center of the position
_max = radius of the circle
private _pos
Return: _pos, the position generated
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_center","_min","_max"];
private _vector = random(359);
private _radius = _min + (_min + random(_max - _min));
private _pos = _center getPos[_radius,_vector];
_pos

View File

@ -0,0 +1,42 @@
/*
GMS_fnc_findShoreLocation
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_mapCenter","_waterPos","_priorUMSpositions","_maxDistance"];
private _evaluate = true;
while {_evaluate} do
{
_waterPos = [
GMS_mapCenter, // center of search area
2, // min distance to search
GMS_maxSeaSearchDistance, // max distance to search
0, // distance to nearest object
2, // water mode [2 = water only]
25, // max gradient
0 // shoreMode [0 = anywhere]
] call BIS_fnc_findSafePos;
if (((getTerrainHeightASL _waterPos) < -4) && (getTerrainHeightASL _waterPos) > -10) then
{
_evaluate = false;
};
};
//diag_log format["_findShoreLocation: _waterPos = %1",_waterPos];
_waterPos

View File

@ -0,0 +1,24 @@
/*
GMS_fnc_findWaterDepth
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_depth"];
params["_pos"];
_depth = (getTerrainHeightASL _pos);
_depth

View File

@ -0,0 +1,15 @@
/*
GMS_fnc_getAllBlckeaglsMarkers
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _blckMarkers = [GMS_missionMarkerRootName] call GMS_fnc_getAllMarkersOfSubtype;
_blckMarkers

View File

@ -0,0 +1,17 @@
/*
GMS_fnc_getAllDMSMarkers
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
#define DMS_missionMarkerRootName "DMS_MissionMarker"
private _dmsMarkers = [DMS_missionMarkerRootName] call GMS_fnc_getAllMarkersOfSubtype;
_dmsMarkers

View File

@ -0,0 +1,26 @@
/*
GMS_fnc_getAllMarkersOfSubtype
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
/*
Useful if you know the rootname for markers for a mission system to add these to black lists or other lists
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _subtype = _this;
private _end = (count _subtype) - 1;
private _m = [];
{
if ([_x,0,_end] call BIS_fnc_trimString isEqualTo _subtype) then {_m pushBack _x};
} forEach allMapMarkers;
_m

View File

@ -0,0 +1,12 @@
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_difficulty"];
//diag_log format["getIndexFromDifficult: _dificulty = %1 | typeName _difficulty = %2",_difficulty, typeName _difficulty];
private _return = 0;
switch(toLowerANSI(_difficulty)) do
{
case "red": {_return = 1};
case "green": {_return = 2};
case "orange": {_return = 3};
};
_return

View File

@ -0,0 +1,46 @@
/*
GMS_fnc_loadLootItemsFromArray
Depends on GMS_fnc_addItemToCrate
call as:
[_item,_crate] call GMS_fnc_loadLootFromItemsArray;
where
_crate is a container such as ammo box or vehicle
_loadout is an array containing either 2 or 3 elements. The first array is always an array of items to add. Items can be formated as ["item1","item1"], as [["item1",3],["item2",2]] or as [["item1",2,4],["item2",3,5]].
See GMSCore_fnc_addItemToCrate for information about the acceptable formates for the items "item1" ... "itemN".
The second and optional third element in the array specify the number of times the script will randomly select an item from the array of items and load it into the crate.
For example:
case 1: [["item1",...,"itemN"],6]; The script will randomly select from the array of item names 6 times and call the loot loader each time.
case 2: [["item1",...,"itemN"],6, 9]; As above except that an item will be selected a minimum of 6 and maximum of 9 times.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_loadout","_crate",["_addAmmo",0]];
if ((_loadout select 0) isEqualTo []) exitWith {};
{
private["_tries","_q","_item"];
_tries = 0;
_q = _x select 1; // this can be a number or array.
_tries = [_q] call GMSCore_fnc_getNumberFromRange;
for "_i" from 1 to _tries do
{
_item = selectRandom (_x select 0);
[_item,_crate,_addAmmo] call GMSCore_fnc_addItem;
};
}forEach _loadout;

View File

@ -0,0 +1,96 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_timer1sec","_timer5sec","_timer10Sec","_timer20sec","_timer5min","_timer5min"];
_timer2sec = diag_tickTime + 2;
_timer5sec = diag_tickTime + 5;
_timer10Sec = diag_tickTime + 10;
_timer20sec = diag_tickTime + 20;
_timer1min = diag_tickTime + 10;
_timer5min = diag_tickTime + 300;
while {true} do
{
uiSleep 1;
if (diag_tickTime > _timer2sec) then
{
[] spawn GMS_fnc_monitorSpawnedMissions;
if (GMS_showCountAliveAI) then
{
{
_x call GMS_fnc_updateMarkerAliveCount;
} forEach GMS_missionLabelMarkers;
};
_timer2sec = diag_tickTime + 2;
};
if (diag_tickTime > _timer5sec) then
{
_timer5sec = diag_tickTime + 5;
if (GMS_simulationManager isEqualTo GMS_useBlckeaglsSimulationManagement) then {[] call GMS_fnc_simulationMonitor};
[] call GMS_fnc_vehicleMonitor;
#ifdef GRGserver
[] call GMS_fnc_broadcastServerFPS;
#endif
};
if (diag_tickTime > _timer10Sec) then
{
_timer10Sec = diag_tickTime + 10;
[] call GMS_fnc_scanForPlayersNearVehicles;
[] call GMS_fnc_spawnNewMissions;
[] spawn GMS_fnc_monitorInitializedMissions;
};
if ((diag_tickTime > _timer1min)) then
{
_timer1min = diag_tickTime + 60;
[] call GMS_fnc_restoreHiddenObjects;
[] call GMS_fnc_groupWaypointMonitor;
[] call GMS_fnc_cleanupAliveAI;
};
if (diag_tickTime > _timer5min) then
{
private _clientID = if (clientOwner == 2) then {"server"} else {"Headless Client"};
[
format["Timstamp %1 | Running on %2 | Missions Running %2 | Vehicles %3 | Groups %4 | Missions Run %5 | Server FPS %6 | Server Uptime %7 Min",
diag_tickTime,
_clientID,
GMS_missionsRunning,
count GMS_monitoredVehicles,
count GMS_monitoredMissionAIGroups,
GMS_missionsRun,
diag_FPS,
floor(diag_tickTime/60)
]
] call GMS_fnc_log;
if (GMS_debugLevel > 0) then
{
private _activeScripts = diag_activeScripts;
[
format["count diag_activeSQFScripts %1 | Threads [spawned %2, execVM %3]",
count diag_activeSQFScripts,
_activeScripts select 0,
_activeScripts select 1
//GMS_activeMonitorThreads
]
] call GMS_fnc_log;
{
[format["file %1 | running %2",(_x select 1),(_x select 2)]] call GMS_fnc_log;
} forEach diag_activeSQFScripts;
};
[] call GMS_fnc_cleanEmptyGroups;
[GMS_landVehiclePatrols] call GMSCore_fnc_removeNullEntries;
[GMS_aircraftPatrols] call GMSCore_fnc_removeNullEntries;
_timer5min = diag_tickTime + 300;
};
};

View File

@ -0,0 +1,23 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_mArray","_count"];
_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"];
_textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) + (_size select 0), 0];
_MainMarker = createMarker ["ai_count" + _name, _textPos];
_MainMarker setMarkerShape "Icon";
_MainMarker setMarkerType "HD_Arrow";
_MainMarker setMarkerColor "ColorBlack";
_MainMarker setMarkerText format["% Alive",_count];
//_MainMarker setMarkerDir 37;

View File

@ -0,0 +1,23 @@
//This script sends Message Information to allplayers
/*
GMS_fnc_messagePlayers
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
if !(isServer) exitWith {};
params["_msg",["_players",allplayers]];
//[format["_messagePlayers - _msg = %1",_msg]] call GMS_fnc_log;
{
if (isPlayer _x) then {_msg remoteExec["GMS_fnc_handleMessage",(owner _x)]};
} forEach _players;

View File

@ -0,0 +1,31 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _fn_cleanup = {
private _m = _this;
uiSleep 350;
//[format["_fn_cleanup: deleting marker %1",_m]] call GMS_fnc_log;
deleteMarker _m;
};
//diag_log format["GMS_fnc_missionCompleteMarker:: _this = %1",_this];
private _location = _this select 0;
private _name = str(random(1000000)) + "MarkerCleared";
_m = createMarker [_name, _location];
_m setMarkerColor "ColorBlack";
_m setMarkerType "n_hq";
_m setMarkerText "Mission Cleared";
[_m, diag_tickTime + 30] call GMSCore_fnc_addToDeletionCue;
_m spawn _fn_cleanup;
//diag_log format["missionCompleteMarker complete script for _this = %1",_this];

View File

@ -0,0 +1,15 @@
/*
GMS_fnc_msgIED
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_killer"];
[["IED","",0,0],[_killer]] call GMS_fnc_MessagePlayers;

View File

@ -0,0 +1,31 @@
/*
GMS_fnc_nearestPlayers
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params[["_coords",[]],"_range"];
/*
{
diag_log format["_fnc_nearestPlayers: %1 = %2",_x, _this select _forEachIndex];
}forEach ["_coords", "_range"];
*/
if (_coords isEqualTo []) then
{
_coords = [0,0,0];
//diag_log format["[GMS] No value passed to GMS_fnc_nearestPlayers for _coords - default of [0,0,0] used"];
};
private _players = allPlayers select {(_x distance _coords) < _range};
//diag_log format["_fnc_nearestPlayers: _coords %1 | _range %2 | _return = %3",_coords,_range,_players];
_players

View File

@ -0,0 +1,31 @@
//////////////////////////////////////////////////////
// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects
/*
GMS_fnc_playerInRange
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params[["_coords",[0,0,0]],["_range",0],["_onFootOnly",false]];
private ["_result","_players"];
private "_players";
if (_onFootOnly) then
{
_players = allPlayers select {(vehicle _x) isEqualTo _x && {_x distance _coords < _range}};
} else {
_players = allPlayers select {(_x distance _coords) < _range};
};
private _result = if (_players isEqualTo []) then {false} else {true};
_result

View File

@ -0,0 +1,27 @@
//////////////////////////////////////////////////////
// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects
/*
GMS_fnc_playerInRangeArray
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_locations","_dist",["_onFootOnly",false]];
private _nearLocations = _locations select {[_x,_dist,_onFootOnly] call GMS_fnc_playerInRange};
//diag_log format["_fnc_playerInRangeArray: _locations = %1 | _dist = %2 | _nearLocations = %3",_locations,_dist,_nearLocations];
private _return = if (_nearLocations isEqualTo []) then {false} else {true};
_return
/*
{
_result = [_x,_dist,_onFootOnly] call GMS_fnc_playerInRange;
if (_result) exitWith {};
} forEach _locations;
_result

View File

@ -0,0 +1,27 @@
/*
GMS_fnc_restoreHiddenObjects
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
for "_i" from 1 to (count GMS_hiddenTerrainObjects) do
{
if (_i > (count GMS_hiddenTerrainObjects)) exitWith {};
private _el = GMS_hiddenTerrainObjects deleteAt 0;
_el params["_obj","_timeout"];
if (diag_tickTime > _timeOut) then
{
{_x hideObjectGlobal false} forEach _obj;
} else {
GMS_hiddenTerrainObjects pushBack _el;
};
};

View File

@ -0,0 +1,18 @@
/*
GMS_fnc_setDirUp
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_object","_dir"];
switch (typeName _dir) do
{
case "SCALAR": {_object setDir _dir};
case "ARRAY": {_object setVectorDirAndUp _dir};
};

View File

@ -0,0 +1,84 @@
/*
GMS_fnc_spawnMarker
Note: kept for backwards compatability with older parts of GMS like the static and dynamic loot spawns and spawns of map addons.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_GMS_fn_configureRoundMarker"];
_GMS_fn_configureRoundMarker = {
params["_name","_pos","_color","_text","_size","_labelType","_mShape","_mBrush"];
if ((_pos distance [0,0,0]) < 10) exitWith {};
private _marker = createMarker [_name, _pos];
_marker setMarkerColor _color;
_marker setMarkerShape "ELLIPSE";
_marker setMarkerBrush "Grid";
_marker setMarkerSize _size; //
if (count toArray(_text) > 0) then
{
switch (_labelType) do {
case "arrow":
{
_name = _name + "label";
private _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0];
private _arrowMarker = createMarker [_name, _textPos];
_arrowMarker setMarkerShape "Icon";
_arrowMarker setMarkerType "HD_Arrow";
_arrowMarker setMarkerColor "ColorBlack";
_arrowMarker setMarkerText _text;
//_marker setMarkerDir 37;
};
case "center":
{
_name = "label" + _name;
private _labelMarker = createMarker [_name, _pos];
_labelMarker setMarkerShape "Icon";
_labelMarker setMarkerType "mil_dot";
_labelMarker setMarkerColor "ColorBlack";
_labelMarker setMarkerText _text;
};
};
};
if (isNil "_labelMarker") then {_labelMarker = ""};
_marker
};
_GMS_fn_configureIconMarker = {
params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]];
//_name = "label" + _name;
private _marker = createMarker [_name, _pos];
_marker setMarkerShape "Icon";
_marker setMarkerType _icon;
_marker setMarkerColor _color;
_marker setMarkerText _text;
_marker
};
params["_mArray","_mBrush"];
private["_marker"];
_mArray params["_missionMarkerName","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerTypeInfo"];
_missionMarkerName = GMS_missionMarkerRootName + _missionMarkerName;
_markerTypeInfo params[["_mShape","mil_dot"],["_mSize",[0,0]],["_mBrush","GRID"]];
if (toUpper(_mShape) in ["ELLIPSE","RECTANGLE"]) then // not an Icon ....
{
if (isNil "_mBrush") then {_mBrush = "GRID"};
_marker = [_missionMarkerName,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _GMS_fn_configureRoundMarker;
} else {
_marker = [_missionMarkerName,_markerPos, _markerColor,_markerLabel,_mShape] call _GMS_fn_configureIconMarker;
};
if (isNil "_marker") then {_marker = ""};
_marker

View File

@ -0,0 +1,17 @@
/*
GMS_fnc_updateMarkerAliveCount
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_marker","_rootText","_missionAI"];
private _txtPrior = markerText _marker;
_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI];

View File

@ -0,0 +1,47 @@
/*
AI Mission for Epoch Mod for Arma 3
By Ghostrider
Functions used by the mission system.
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _functions = [
// General functions
["GMS_fnc_FindSafePosn","\GMS\Compiles\Functions\GMS_fnc_findSafePosn_4.sqf"],
// Player-related functions
["GMS_fnc_handlePlayerUpdates","\GMS\Compiles\Units\GMS_fnc_handlePlayerUpdates.sqf"],
// Mission-related functions
["GMS_fnc_garrisonBuilding_RelPosSystem","\GMS\Compiles\Missions\GMS_fnc_garrisonBuilding_relPosSystem.sqf"],
["GMS_fnc_spawnGarrisonInsideBuilding_ATL","\GMS\Compiles\Missions\GMS_fnc_spawnGarrisonInsideBuilding_ATL.sqf"],
["GMS_fnc_spawnGarrisonInsideBuilding_relPos","\GMS\Compiles\Missions\GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf"],
["GMS_fnc_addDyanamicUMS_Mission","\GMS\Compiles\Missions\GMS_fnc_addDynamicUMS_Mission.sqf"],
// Functions specific to vehicles, whether wheeled, aircraft or static
["GMS_fnc_configureMissionVehicle","\GMS\Compiles\Vehicles\GMS_fnc_configureMissionVehicle.sqf"],
["GMS_fnc_applyVehicleDamagePenalty","\GMS\Compiles\Vehicles\GMS_fnc_applyVehicleDamagePenalty.sqf"],
["GMS_fnc_handleVehicleGetOut","\GMS\Compiles\Vehicles\GMS_fnc_handleVehicleGetOut.sqf"],
// functions to support Units
["GMS_fnc_spawnHostage","\GMS\Compiles\Units\GMS_fnc_spawnHostage.sqf"],
["GMS_fnc_spawnLeader","\GMS\Compiles\Units\GMS_fnc_spawnLeader.sqf"],
["GMS_fnc_spawnCharacter","\GMS\Compiles\Units\GMS_fnc_spawnCharacter.sqf"],
["GMS_fnc_placeCharacterInBuilding","\GMS\Compiles\Units\GMS_fnc_placeCharacterInBuilding.sqf"]
];
{
_x params ["_name","_path"];
missionnamespace setvariable [_name,compileFinal preprocessFileLineNumbers _path];
} foreach _functions;

View File

@ -0,0 +1,56 @@
/*
AI Mission for Epoch Mod for Arma 3
For the Mission System originally coded by blckeagls
By Ghostrider
Functions and global variables used by the mission system.
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
if (GMS_debugLevel > 0) then {diag_log "[GMS] loading variables"};
GMS_minFPS = 12;
// radius within whih missions are triggered. The trigger causes the crate and AI to spawn.
GMS_TriggerDistance = 1500;
////////////////////////////////////////////////
// Do Not Touch Anything Below This Line
///////////////////////////////////////////////
GMS_townLocations = []; //nearestLocations [GMS_mapCenter, ["NameCity","NameCityCapital"], 30000];
GMS_ActiveMissionCoords = [];
GMS_recentMissionCoords = [];
GMS_monitoredVehicles = [];
GMS_livemissionai = [];
GMS_monitoredMissionAIGroups = []; // Used to track groups in active missions for whatever purpose
GMS_hiddenTerrainObjects = [];
GMS_missionsRunning = 0;
GMS_missionsRun = 0;
GMS_missionMarkerRootName = "GMS_marker";
DMS_missionMarkerRootName = "DMS_MissionMarker";
GMS_missionLabelMarkers = [];
GMS_mainThreadUpdateInterval = 60;
GMS_monitoring = false;
GMS_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/";
GMS_dynamicMissionsSpawned = 0;
GMS_missionData = [];
GMS_initializedMissionsList = [];
GMS_landVehiclePatrols = [];
GMS_aircraftPatrols = [];
GMS_blackListedLocations = []; // [ [marker, time]]
GMS_validEndStates = [allUnitsKilled, playerNear, allKilledOrPlayerNear,assetSecured];
GMS_validLootSpawnTimings = ["atMissionSpawnGround","atMissionSpawnAir","atMissionEndGround","atMissionEndAir"];
GMS_validLootLoadTimings = ["atMissionCompletion", "atMissionSpawn"];
GMS_skillsIndex_Blue = 0;
GMS_skillsIndex_Red = 1;
GMS_skillsIndex_Green = 2;
GMS_skillsIndex_Orange = 3;
if (GMS_debugLevel > 0) then {diag_log "[GMS] Variables Loaded"};

View File

@ -0,0 +1,20 @@
/*
Checks for groups that have not reached their waypoints within a proscribed period
and redirects them.
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_group","_maxTime","_radius"];
if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) then // || ( (getPos (leader)) distance2d (_group getVariable "patrolCenter") > _radius)) then
{
(leader _group) call GMS_fnc_setNextWaypoint;
};

View File

@ -0,0 +1,24 @@
/*
removes empty or null groups from GMS_monitoredMissionAIGroups
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
for "_i" from 0 to ((count GMS_monitoredMissionAIGroups) - 1) do
{
if (_i >= (count GMS_monitoredMissionAIGroups)) exitWith {};
_grp = GMS_monitoredMissionAIGroups deleteat 0;
if ({alive _x} count units _grp > 0) then
{
GMS_monitoredMissionAIGroups pushBack _grp;
} else {
if !(isNull _grp) then {deleteGroup _grp};
};
};

View File

@ -0,0 +1,31 @@
/*
[] call GMS_fnc_createGroup
Notes: Kept for backwards compatability with the static mission system if this is kept and not updated.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params[["_side",GMSCore_side],["_deleteWhenEmpty",true]];
// for information about the _deleteWhenEmpty parameter see: https://community.bistudio.com/wiki/createGroup
private _groupSpawned = createGroup [_side, true];
if (isNull _groupSpawned) exitWith{"ERROR:-> Null Group created by GMS_fnc_spawnGroup";};
if (GMS_simulationManager == GMS_useDynamicSimulationManagement) then
{
_groupSpawned enableDynamicSimulation true;
};
_groupSpawned setcombatmode "RED";
_groupSpawned setBehaviour "COMBAT";
_groupSpawned allowfleeing 0;
_groupSpawned setspeedmode "FULL";
_groupSpawned setFormation GMS_groupFormation;
_groupSpawned setVariable ["GMS_group",1];
_groupSpawned

View File

@ -0,0 +1,21 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
// TODO: not sure we need this - can we do the same thing in another script
private["_group","_wp"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;

View File

@ -0,0 +1,21 @@
/*
GMS_fnc_findNearestInfantryGroup
by Ghostrider
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_pos"];
private["_units"];
if (GMSCore_modtype isEqualTo "Epoch") then {_units = (nearestObjects[_pos,["I_Soldier_EPOCH"], 1000]) select {vehicle _x isEqualTo _x}};
if !(toLowerANSI(GMSCore_modtype) isEqualTo "epoch") then {_units = (nearestObjects[_pos ,["i_g_soldier_unarmed_f"], 1000]) select {vehicle _x isEqualTo _x}};
private _nearestGroup = group(_units select 0);
_nearestGroup

View File

@ -0,0 +1,47 @@
/*
Checks for groups that have not reached their waypoints within a proscribed period
and redirects them.
GMS_fnc_groupWaypointMonitor
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
// TODO: Test functionality of this
_fn_waypointComplete = {
private _group = _this select 0;
private _wp = currentWaypoint _group;
private _done = if (currentWaypoint _group) > (count (waypoints _group)) then {true} else {false};
_done
};
{
private["_timeStamp","_index","_unit","_soldierType"];
if ( !(_x isEqualTo grpNull) && ({alive _x} count (units _x) > 0) ) then
{
_timeStamp = _x getVariable ["timeStamp",0];
if (_timeStamp isEqualTo 0) then
{
_x setVariable["timeStamp",diag_tickTime];
};
_soldierType = _x getVariable["soldierType","null"];
switch (_soldierType) do
{
case "infantry": {[_x, 60] call GMS_fnc_checkgroupwaypointstatus;};
case "vehicle": {[_x, 90, 800] call GMS_fnc_checkgroupwaypointstatus;};
case "aircraft": {[_x, 90, 1000] call GMS_fnc_checkgroupwaypointstatus;};
};
};
} forEach GMS_monitoredMissionAIGroups;

View File

@ -0,0 +1,118 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
GMS_fnc_setNextWaypoint
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
TODO: Replaces changeToMoveWaypoint
and
Replaces changeToSADWaypoint
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_group","_wp","_index","_pattern","_mode","_arc","_dis","_wpPos"];
private _group = group _this;
private _leader = _this;
private _pos = _group getVariable "patrolCenter"; // Center of the area to be patroleld.
private _minDis = _group getVariable "minDis"; // minimum distance between waypoints
private _maxDis = _group getVariable "maxDis"; // maximum distance between waypoints
private _patrolRadius = _group getVariable "patrolRadius"; // radius of the area to be patrolled
private _wpMode = _group getVariable "wpMode"; // The default mode used when the waypoint becomes active https://community.bistudio.com/wiki/AI_Behaviour
private _wpTimeout = _group getVariable "wpTimeout"; // Here to alow you to have the game engine pause before advancing to the next waypoing. a timout of 10-20 sec is recommended for infantry and land vehicles, and 1 sec for aircraft
private _wpDir = _group getVariable "wpDir"; // Used to note the degrees along the circumference of the patrol area at which the last waypoint was positioned.
private _arc = _group getVariable "wpArc"; // Increment in degrees to be used when advancing the position of the patrol to the next position along the patrol perimeter
private _wp = [_group,0];
private _nearestEnemy = _leader findNearestEnemy (getPosATL _leader);
private _maxTime = _group getVariable["maxTime",300];
// Extricate stuck group.
if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) exitWith
{ // try to get unit to move and do antiStuck actions
_group setBehaviour "CARELESS"; // We need them to forget about enemies and move
_group setCombatMode "BLUE"; // We need them to disengage and move
private _vector = _wpDir + _arc + 180; // this should force units to cross back and forth across the zone being patrolled
_group setVariable["wpDir",_vector,true];
private _newWPPos = _pos getPos[_patrolRadius,_vector];
_wp setWaypointPosition [_newWPPos,0];
_wp setWaypointBehaviour "SAFE";
_wp setWaypointCompletionRadius 0;
_wp setWaypointTimeout _wpTimeout;
_wp setWaypointType "MOVE";
_group setCurrentWaypoint _wp;
//diag_log format["_fnc_setNextWaypoint[antiSticking]: _group = %1 | _newPos = %2 | waypointStatements = %3",_group,_newWPPos,waypointStatements _wp];
};
// Move when no enemies are nearby
if (isNull _nearestEnemy) then
{
// Use standard waypoint algorythms
/*
Have groups zig-zag back and forth their patrol area
Setting more relaxed criteria for movement and rules of engagement
*/
private _vector = _wpDir + _arc + 180; // this should force units to cross back and forth across the zone being patrolled
_group setVariable["wpDir",_vector,true];
_group setCombatMode "YELLOW";
private _newWPPos = _pos getPos[_patrolRadius,_vector];
_wp setWaypointPosition [_newWPPos,0];
_group setBehaviour "SAFE"; // no enemies detected so lets put the group in a relaxed mode
_wp setWaypointBehaviour "SAFE";
_wp setWaypointCombatMode "YELLOW";
_wp setWaypointCompletionRadius 0;
_wp setWaypointTimeout _wpTimeout;
_group setCurrentWaypoint _wp;
//diag_log format["_fnc_setNextWaypoint[no enemies]: _group = %1 | _newPos = %2 | waypointStatements = %3",_group,_newWPPos,waypointStatements _wp];
} else {
// move toward nearest enemy using hunting logic
// set mode to SAD / COMBAT
/*
_vector set to relative direction from leader to enemy +/- random adjustment of up to 33 degrees
_distance can be up to one patrol radius outside of the normal perimeter closer to enemy
_timout set to longer period
when coupled with SAD behavior should cause interesting behaviors
*/
// [point1, point2] call BIS_fnc_relativeDirTo
private _vector = ([_leader,_nearestEnemy] call BIS_fnc_relativeDirTo) + (random(33)*selectRandom[-1,1]);
_group setVariable["wpDir",_vector];
private ["_huntDistance"];
if ((leader _group) distance _nearestEnemy > (_patrolRadius * 2)) then
{
if (((leader _group) distance _pos) > (2 * _patrolRadius)) then
{
_huntdistance = 0;
} else {
_huntDistance = _patrolRadius;
};
} else {
_huntDistance = ((leader _group) distance _nearestEnemy) / 2;
};
private _newWPPos = _pos getPos[_huntDistance,_vector];
//diag_log format["_fnc_setextWaypoint: _pos = %1 | _patrolRadius = %5 | _newWPPos = %2 | _huntDistance = %3 | _vector = %4",_pos,_newWPPos,_huntDistance,_vector,_patrolRadius];
_wp setWaypointPosition [_newWPPos,0];
_wp setWaypointBehaviour"COMBAT";
_group setBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
_wp setWaypointType "SAD";
_wp setWaypointTimeout[30,45,60];
_wp setWaypointCompletionRadius 0;
_group setCurrentWaypoint _wp;
// Assume the same waypoint statement will be available
//diag_log format["_fnc_setNextWaypoint[enemies]t: _group = %1 | _newPos = %2 | _nearestEnemy = 54 | waypointStatements = %3",_group,_newWPPos,waypointStatements _wp,_nearestEnemy];
};

View File

@ -0,0 +1,87 @@
// Sets up waypoints for a specified group.
/*
GMS_fnc_setupWaypoints
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_dir","_arc","_noWp","_newpos","_wpradius","_wp"];
params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAFE"],["_soldierType","null"],["_patrolRadius",30],["_wpTimeout",[5.0,7.5,10]]];
_wp = [_group, 0];
if !(_soldierType isEqualTo "emplaced") then
{
_arc = 360/5;
_group setcombatmode "RED";
_group setBehaviour "SAFE";
_group setVariable["patrolCenter",_pos,true]; // Center of the area to be patroleld.
_group setVariable["minDis",_minDis,true]; // minimum distance between waypoints
_group setVariable["maxDis",_maxDis,true]; // maximum distance between waypoints
_group setVariable["timeStamp",diag_tickTime]; // used to check that waypoints are being completed
_group setVariable["wpRadius",0]; // Always set to 0 to force groups to move a bit
_group setVariable["patrolRadius",_patrolRadius,true]; // radius of the area to be patrolled
_group setVariable["wpMode",_mode,true]; // The default mode used when the waypoint becomes active https://community.bistudio.com/wiki/AI_Behaviour
_group setVariable["wpPatrolMode",_wpPatrolMode]; // Not used; the idea is to allow two algorythms: randomly select waypoints so groups move back and forth along the perimiter of the patrool area or sequenctioal, hoping along the perimeter
_group setVariable["wpTimeout",_wpTimeout,true]; // Here to alow you to have the game engine pause before advancing to the next waypoing. a timout of 10-20 sec is recommended for infantry and land vehicles, and 1 sec for aircraft
_group setVariable["wpDir",0,true]; // Used to note the degrees along the circumference of the patrol area at which the last waypoint was positioned.
_group setVariable["wpArc",_arc,true]; // Increment in degrees to be used when advancing the position of the patrol to the next position along the patrol perimeter
_group setVariable["soldierType",_soldierType]; // infantry, vehicle, air or emplaced. Note that there is no need to have more than one waypoint for emplaced units.
_dir = 0;
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = _pos getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius 0; //(_group getVariable["wpRadius",30]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "SAFE";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout _wpTimeout;
_group setCurrentWaypoint _wp;
#ifdef GMS_debugMode
_wp setWaypointStatements ["true","this call GMS_fnc_setNextWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call GMS_fnc_setNextWaypoint;"];
#endif
#ifdef GMS_debugMode
if (GMS_debugLevel >= 3) then
{
_marker = createMarker [format["GroupMarker%1",_group],_newPos];
_group setVariable["wpMarker",_marker,true];
_marker setMarkerColor "ColorBlue";
_marker setMarkerText format["%1 %2",(_group getVariable["soldierType","null"]),_group];
_marker setMarkerType "mil_triangle";
//diag_log format["_fnc_setupWaypoints: configuring weapoints for group %2 mobile patrol with _soldierType = %1",_solderType,_group];
diag_log format["_fnc_setupWaypoints: soldier type for mobile _group %1 set to %2",_group, (_group getVariable["soldierType","null"])];
diag_log format["_fnc_setupWaypoints: all variables for the group have been set for group %1",_group];
diag_log format["_fnc_setupWaypoints:: -- >> wpMode %1 _dir %2 _dis %3",_group getVariable["wpMode","random"], _dir, _dis];
diag_log format["_fnc_setupWaypoints:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_setupWaypoints:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_setupWaypoints:: -- >> Waypoint marker for group %1 have been configured as %2 with text set to %3",_group, _group getVariable "wpMarker", markerText (_group getVariable "wpMarker")];
};
#endif
} else {
_wp setWaypointType "SENTRY";
_wp setWPPos (getPos leader _group);
_wp setWaypointCompletionRadius 100;
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [1,1.1,1.2];
//_wp setWaypointTimeout [0.1,0.1100,0.1200];
_group setCurrentWaypoint _wp;
_group setVariable["soldierType",_soldierType,true];
#ifdef GMS_debugMode
_wp setWaypointStatements ["true","this call GMS_fnc_emplacedWeaponWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to an emplaced weapon Waypoint',group this];"];
if (GMS_debugLevel > 2) then {diag_log format["_fnc_setupWaypoints: configuring weapoints for group %2 for emplaced weapon with _soldierType = %1",_soldierType,_group];};
#else
_wp setWaypointStatements ["true","this call GMS_fnc_emplacedWeaponWaypoint;"];
#endif
};

View File

@ -0,0 +1,74 @@
/*
GMS_fnc_simulationMonitor
Managages simulation using blckeagls logic
By Ghostrider-GRG-
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
if (GMS_simulationManager isEqualTo GMS_simulationManagementOff) exitWith {};
if (GMS_simulationManager isEqualTo GMS_useDynamicSimulationManagement) exitWith
{
// wake groups up if needed.
{
private _group = _x;
private _nearplayer = [getPosATL (leader _group),GMS_simulationEnabledDistance] call GMS_fnc_nearestPlayers;
if !(_nearPlayer isEqualTo []) then
{
_group reveal [(_nearplayer select 0),(_group knowsAbout (_nearPlayer select 0)) + 0.001]; // Force simulation on
};
} forEach GMS_monitoredMissionAIGroups;
};
if (GMS_simulationManager isEqualTo GMS_useBlckeaglsSimulationManager) then
{
{
private _group = _x;
private _nearplayer = [getPosATL (leader _group),GMS_simulationEnabledDistance] call GMS_fnc_nearestPlayers;
if !(_nearplayer isEqualTo []) then
{
if !(simulationEnabled (leader _group)) then
{
{
_x enableSimulationGlobal true;
_x reveal [(_nearplayer select 0),(_group knowsAbout (_nearPlayer select 0)) + 0.001]; // Force simulation on
}forEach units _group;
};
}else{
if (simulationEnabled (leader _group)) then
{
{_x enableSimulationGlobal false} forEach units _group;
};
};
} forEach GMS_monitoredMissionAIGroups;
/*
{
// disable simulation once players have left the area.
private _nearPlayers = [getPosATL (_x),GMS_simulationEnabledDistance] call GMS_fnc_nearestPlayers;
if (simulationEnabled _x) then
{
if (_nearPlayers isEqualTo []) then
{
_x enableSimulationGlobal false;
};
} else {
if !(_nearPlayers isEqualTo []) then
{
_x enableSimulationGlobal true;
};
};
} forEach units GMS_graveyardGroup;
*/
};

View File

@ -0,0 +1,104 @@
/*
GMS_fnc_spawnGroup
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params[
["_pos",[-1,-1,1]],
["_numbertospawn",0],
["_skillLevel","red"],
["_areaDimensions",[]],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_weaponList",[]],
["_sideArms",[]],
["_scuba",false]
];
/*
{
diag_log format["_fn_spawnGroup: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
} forEach _this;
*/
if (_weaponList isEqualTo []) then {_weaponList = [_skillLevel] call GMS_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_skillLevel] call GMS_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_skillLevel] call GMS_fnc_selectAIUniforms};
if (_headGear isEqualTo []) then {_headGear = [_skillLevel] call GMS_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_skillLevel] call GMS_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_skillLevel] call GMS_fnc_selectAIBackpacks};
private _difficultyIndex = [_skillLevel] call GMS_fnc_getIndexFromDifficulty;
private _group = [
_pos,
_numberToSpawn,
GMSCore_side,
GMS_baseSkill,
(GMS_AIAlertDistance select _difficultyIndex),
(GMS_AIIntelligence select _difficultyIndex),
GMS_bodyCleanUpTimer,
-1, // max reloads
GMS_launcherCleanup,
GMS_removeNVG,
0.4, // min damage to heal,
1, // max heals
"SmokeShellRed",
[GMS_fnc_unitHit], // AI Hit Code
[GMS_fnc_unitKilled],
0.33, // chance garrison
false // isDrone Crew
] call GMSCore_fnc_spawnInfantryGroup;
_group setVariable["GMS_difficulty",_skillLevel];
//[format["GMS_fnc_spawnGroup: _group = %1",_group]] call GMS_fnc_log;
[_group] call GMSCore_fnc_setupGroupBehavior;
private _skills = missionNamespace getVariable[format["GMS_Skills%1",_skillLevel],GMS_SkillsRed];
[_group,_skills] call GMSCore_fnc_setupGroupSkills;
// TODO: Add Money if any should be added
private _gear = [
[
_weaponList,
GMS_chancePrimary,
GMS_chanceOpticsPrimary,
GMS_chanceMuzzlePrimary,
GMS_chancePointerPrimary,
GMS_blacklistedPrimaryWeapons
], // Just adding together all the subclasses of primary weaponss
[
_sideArms,
GMS_chanceSecondary,
GMS_chanceOpticsSecondary,
GMS_chanceMuzzleSecondary,
GMS_chancePointerSecondary,
GMS_blacklistedSecondaryWeapons
],
[GMS_explosives, GMS_chanceThowable],
[_headGear, GMS_chanceHeadgear],
[_uniforms, GMS_chanceUniform],
[_vests, GMS_chanceVest],
[_backpacks, GMS_chanceBackpack],
[GMS_launcherTypes, 1.0], // this is determined elsewhere for GMSAI
[GMS_NVG, 1.0], // this is determined elsewhere for GMSAI
[GMS_binocs,GMS_chanceBinoc],
[GMS_ConsumableItems, 1.0],
[GMS_medicalItems, 1.0],
[GMS_loot, 1.0]
];
[_group,_gear,GMS_launchersPerGroup,GMS_useNVG] call GMSCore_fnc_setupGroupGear;
if !(_areaDimensions isEqualTo []) then
{
[_group,[],[_pos,_areaDimensions],300,0.33] call GMSCore_fnc_initializeWaypointsAreaPatrol;
};
_group selectLeader ((units _group) select 0);
//[format["GMS_fnc_spawnGroup: _group = %1",_group]] call GMS_fnc_log;
_group

View File

@ -0,0 +1,33 @@
/*
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
//params["_pos"];
private["_UMS_mission","_waitTime","_mission","_pos"];
if (count GMS_dynamicUMS_MissionList == 0) exitWith
{
GMS_numberUnderwaterDynamicMissions = -1;
diag_log "No Dynamic UMS Missions Listed <spawning disabled>";
};
_UMS_mission = selectRandom GMS_dynamicUMS_MissionList;
_waitTime = (GMS_TMin_UMS) + random(GMS_TMax_UMS - GMS_TMin_UMS);
_mission = format["%1%2","Mafia Pirates",floor(random(1000000))];
_pos = call GMS_fnc_findShoreLocation;
#ifdef GMS_debugMode
if (GMS_debugLevel >= 2) then {diag_log format["_fnc_addDynamicUMS_Mission: GMS_dynamicUMS_MissionsRuning = %1 | GMS_missionsRunning = %2 | GMS_UMS_ActiveDynamicMissions = %3",GMS_dynamicUMS_MissionsRuning,GMS_missionsRunning,GMS_UMS_ActiveDynamicMissions]};;
#endif
GMS_UMS_ActiveDynamicMissions pushBack _pos;
GMS_missionsRunning = GMS_missionsRunning + 1;
GMS_dynamicUMS_MissionsRuning = GMS_dynamicUMS_MissionsRuning + 1;
//diag_log format["[GMS] UMS Spawner:-> waiting for %1",_waitTime];
uiSleep _waitTime;
//diag_log format["[GMS] UMS Spawner:-> spawning mission %1",_UMS_mission];
[_pos,_mission] call compileFinal preprocessFileLineNumbers format["q\addons\GMS\Missions\UMS\dynamicMissions\%1",_UMS_mission];

View File

@ -0,0 +1,68 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_center",
"_garrisonedBuilding_relPosSystem",
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_weaponList",[]],
["_sideArms",[]]
];
{
diag_log format["_fnc_garrisonBuilding_relPosSystem: _this %1 = %2",_forEachIndex,_this select _forEachIndex];
}forEach _this;
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call GMS_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call GMS_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call GMS_fnc_selectAIUniforms};
if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call GMS_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call GMS_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call GMS_fnc_selectAIBackpacks};
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
_group = [GMSCore_side,true] call GMS_fnc_createGroup;
if !(isNull _group) then
{
{
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_x params["_bldClassName","_bldRelPos","_bldDir","_allowDamage","_enableSimulation","_probabilityOfGarrision","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = GMS_staticWeapons};
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_buildingsSpawned pushBack _building;
_building setPosATL (_bldRelPos vectorAdd _center);
[_building, _bldDir] call GMS_fnc_setDirUp;
_staticsSpawned = [
_building,
_group,
_noStatics,
_typesStatics,
_noUnits,
_aiDifficultyLevel,
_uniforms,
_headGear,
_vests,
_backpacks,
"none",
_weaponList,
_sideArms
] call GMS_fnc_spawnGarrisonInsideBuilding_relPos;
}forEach _garrisonedBuilding_relPosSystem;
};
_return = [_group,_buildingsSpawned,_staticsSpawned];
_return

View File

@ -0,0 +1,183 @@
/*
Dynamic Mission Spawner (over-ground missions)
By Ghostrider GRG
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
#define delayTime 1
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_GMS_AllMissionAI","_assetKilledMsg","_enemyLeaderConfig",
"_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig",
"_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_GMS_AllMissionAI","_delayTime","_groupPatrolRadius","_simpleObjects",
"_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_paraSkill","_marker","_vehicleCrewCount",
"_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes","_airpatrols",
"_submarinePatrols","_scubaPatrols","_maxMissionRespawns"];
params["_markerName",["_aiDifficultyLevel","Red"]];
if (isNil "_markerLabel") then {_markerLabel = _markerMissionName};
if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""};
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_markerSize") then {_markerSize = []};
if (isNil "_endCondition") then {_endCondition = GMS_missionEndCondition}; // Options are allUnitsKilled, playerNear, allKilledOrPlayerNear};
if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = GMS_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionSpawnAir","atMissionEndGround","atMissionEndAir".
if (isNil "_loadCratesTiming") then {_loadCratesTiming = GMS_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []};
if (isNil "_missionGroups") then {_missionGroups = []};
if (isNil "_hostageConfig") then {_hostageConfig = []};
if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []};
if (isNil "_useMines") then {_useMines = GMS_useMines;};
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call GMS_fnc_selectAILoadout};
if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call GMS_fnc_selectAISidearms};
if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call GMS_fnc_selectAIUniforms};
if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call GMS_fnc_selectAIHeadgear};
if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call GMS_fnc_selectAIVests};
if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call GMS_fnc_selectAIBackpacks};
if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = [_aiDifficultyLevel] call GMS_fnc_selectChanceHeliPatrol};
if (isNil "_noChoppers") then {_noChoppers = [_aiDifficultyLevel] call GMS_fnc_selectNumberAirPatrols};
if (isNil "_chancePara") then {_chancePara = [_aiDifficultyLevel] call GMS_fnc_selecctChanceParatroops};
if (isNil "_missionHelis") then {_missionHelis = [_aiDifficultyLevel] call GMS_fnc_selectMissionHelis};
if (isNil "_noPara") then {_noPara = [_aiDifficultyLevel] call GMS_fnc_selectNumberParatroops};
if (isNil "_paraSkill") then {_paraSkill = _aiDifficultyLevel};
if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5};
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
if (isNil "_paraLoot") then {_paraLoot = GMS_BoxLoot_Green}; // Add diffiiculty based settings
if (isNil "_paraLootCounts") then {_paraLootCounts = GMS_lootCountsRed}; // Add difficulty based settings
if (isNil "_missionLootVehicles") then {_missionLootVehicles = []};
if (isNil "_garrisonedBuilding_ATLsystem") then {_garrisonedBuilding_ATLsystem = []};
if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_garrisonedBuildings_BuildingPosnSystem = []};
if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount};
if (isNil "_airpatrols") then {_airpatrols = []};
if (isNil "_submarinePatrols") then {_submarinePatrols = 0};
if (isNil "_submarinePatrolParameters") then {_submarinePatrolParameters = []};
if (isNil "_scubaPatrols") then {_scubaPatrols = 0};
if (isNil "_scubagroupparameters") then {_scubagroupparameters = []};
if (isNil "_markerMissionName") then {
diag_log format["_fnc_missionSpawner: _markerMissionName not defined, using default value"];
_markerMissionName = "Default Mission Name";
};
if (isNil "_noLootCrates") then {_noLootCrates = 1};
if (isNil "_lootCrates") then {_lootCrates = GMS_crateTypes};
if (isNil "_lootCratePositions") then {_lootCratePositions = []};
if (isNil "_isScubaMission") then {_isScubaMission = false};
if (isNil "_missionLootBoxes") then {_missionLootBoxes = []};
if (isNil "_defaultMissionLocations") then {_defaultMissionLocations = []};
if (isNil "_maxMissionRespawns") then {_maxMissionRespawns = -1};
if (isNil "_simpleObjects") then {_simpleObjects = []};
if (isNil "_missionemplacedweapons") then
{
_missionemplacedweapons = [];
diag_log format["[GMS] _missionSpawner: setting _missionemplacedweapons to its default value of %1",_missionemplacedweapons];
};
_markerType params["_markerType",["_markersize",[250,250]],["_markerBrush","GRID"]];
private _paraSkill = _aiDifficultyLevel;
if !(_spawnCratesTiming in GMS_validLootSpawnTimings) then
{
[format['Invalid crate spawn timing %1 found in mission %2 :: default value "atMissionSpawnGround" used',_spawnCratesTiming,_markerMissionName],"<WARNING>"] call GMS_fnc_log;
_spawnCratesTiming = "atMissionSpawnGround";
};
if !(_loadCratesTiming in GMS_validLootLoadTimings) then
{
[format['Invalid crate loading timing %1 found in mission %2 :: default "atMissionSpawn" value used',_loadCratesTiming,_markerMissionName],"<WARNING>"] call GMS_fnc_log;
_loadCratesTiming = "atMissionSpawn";
};
if !(_endCondition in GMS_validEndStates) then
{
[format['Invalid mission end condition %1 found in mission %2 :: default value allKilledOrPlayerNear; used',_endCondition,_markerMissionName],"<WARNING>"] call GMS_fnc_log;
_endCondition = allKilledOrPlayerNear;
};
//diag_log format["_missionSpawner: _markerName %1 | _markerMissionName %2 | _markerColor %3",_markerName,_markerMissionName,_markerColor];
private _markerConfigs = [
_markerLabel,
_markerMissionName, // Name used for setMarkerText and also for the root name for all markers
_markerType,
_markerColor,
_markerSize,
_markerBrush
];
private _paraConfigs = [
_chancePara,
_paraTriggerDistance,
_noPara,
_paraSkill,
_chanceLoot,
_paraLoot,
_paraLootCounts
],
private _missionLootConfigs = [
_spawnCratesTiming,
_loadCratesTiming,
_crateLoot,
_lootCounts,
_missionLootBoxes,
_missionLootVehicles
];
private _aiConfigs = [
_uniforms,
_headgear,
_vests,
_backpacks,
_weaponList,
_sideArms,
_missionLandscapeMode,
_garrisonedBuildings_BuildingPosnSystem,
_garrisonedBuilding_ATLsystem,
_missionLandscape,
_simpleObjects,
_missionPatrolVehicles,
_submarinePatrols, // Added Build 227
_submarinePatrolParameters,
_airPatrols,
_noVehiclePatrols,
_vehicleCrewCount,
_missionEmplacedWeapons,
_noEmplacedWeapons,
_useMines,
_minNoAI,
_maxNoAI,
_noAIGroups,
_missionGroups,
_scubaPatrols, // Added Build 227
_scubaGroupParameters,
_hostageConfig,
_enemyLeaderConfig,
_chanceHeliPatrol,
_noChoppers,
_missionHelis
];
private _missionMessages = [
_assetKilledMsg,
_endMsg,
_startMsg
];
private _timesSpawned = 0;
private _table = [
_aiDifficultyLevel,
_markerConfigs,
_endCondition,
_isscubamission,
_missionLootConfigs,
_aiConfigs,
_missionMessages,
_paraConfigs,
_defaultMissionLocations,
_maxMissionRespawns,
_timesSpawned
];
//[format["_missionSpawner (182): _defaultMissionLocations %1 | _maxMissionRespawns %2 | _timesSpawned %3",_defaultMissionLocations,_maxMissionRespawns,_timesSpawned]] call GMS_fnc_log;
_table

View File

@ -0,0 +1,36 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_building","_group","_statics","_men",["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
private["_staticsSpawned","_return","_obj","_unit","_u"];
_staticsSpawned = [];
{
_x params["_staticClassName","_staticRelPos","_staticDir"];
_obj = [_staticClassName, [0,0,0]] call GMS_fnc_spawnVehicle;
_obj setVariable["GRG_vehType","emplaced"];
_staticsSpawned pushBack _obj;
_obj setPosATL (_staticRelPos vectorAdd getPosATL _building);
_obj setDir _staticDir;
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call GMS_fnc_spawnUnit;
_unit moveInGunner _obj;
}forEach _statics;
{
_u = _x;
_u params["_unitRelPos","_unitDir"];
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call GMS_fnc_spawnUnit;
_unit setPosATL (_unitRelPos vectorAdd (getPosATL _building));
_unit setDir _unitDir;
_unit disableAI "PATH";
}forEach _men;
_staticsSpawned

View File

@ -0,0 +1,90 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
/*
_building,
_group,
_noStatics,
_typesStatics,
_noUnits,
_aiDifficultyLevel,
_uniforms,
_headGear,
_vests,
_backpacks,
"none",
_weaponList,
_sideArms
*/
params[
"_building",
"_group",
["_noStatics",0],
["_typesStatics",GMS_staticWeapons],
["_noUnits",0],
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_launcher","none"],
["_weaponList",[]],
["_sideArms",[]]
];
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call GMS_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call GMS_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call GMS_fnc_selectAIUniforms};
if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call GMS_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call GMS_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call GMS_fnc_selectAIBackpacks};
private["_unit","_obj","_staticClassName","_usedBldPsn","_pos","_obj"];
private _allBldPsn = ([_building] call BIS_fnc_buildingPositions) call BIS_fnc_arrayShuffle;
private _countBldPsn = count _allBldPsn;
private _statics = _noStatics min ceil(_countBldPsn/2);
private _units = _countBldPsn - _statics;
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _statics = %1 | _units = %2 | count _allBldPsn = %3 | _allBldPsn %4",_statics,_units,count _allBldPsn,_allBldPsn];
private _staticsSpawned = [];
private _locsUsed = [];
uiSleep 1;
for "_i" from 1 to _statics do
{
if (_allBldPsn isEqualTo []) exitWith {};
_pos = _allBldPsn deleteAt 0;
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _pos = %1",_pos];
_locsUsed pushBack _pos;
_staticClassName = selectRandom _typesStatics;
_obj = [_staticClassName, [0,0,0]] call GMS_fnc_spawnVehicle;
_obj setVariable["GRG_vehType","emplaced"];
_staticsSpawned pushBack _obj;
_obj setPosATL _pos; // (_pos vectorAdd (getPosATL _building));
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call GMS_fnc_spawnUnit;
_unit moveInGunner _obj;
};
private _infantryPos = _allBldPsn;
for "_i" from 1 to _units do
{
if (_allBldPsn isEqualTo []) exitWith {};
_pos = _allBldPsn deleteAt 0;
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call GMS_fnc_spawnUnit;
_unit setPosATL _pos;
{
_wp = _group addWaypoint [_x, 0];
_wp setWaypointType "MOVE";
_wp setWaypointCompletionRadius 0;
_wp waypointAttachObject _building;
_wp setWaypointHousePosition _foreachindex;
_wp setWaypointTimeout [15, 20, 30];
} forEach (_building buildingPos -1);
};
_staticsSpawned

View File

@ -0,0 +1,57 @@
/*
GMS_fnc_addMissionToQue
Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_missionList","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]];
if (GMS_debugLevel >= 3) then
{
{
diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
} forEach _this;
};
private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{
private _missionFile = format["\GMS\Missions\%1\%2.sqf",_path,_x];
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values
if !(isNil "_missionCode") then
{
private _data = [_marker,_difficulty] call _missionCode;
if !(isNil "_data") then
{
_missionsData pushBack _data;
};
} else {
diag_log format["bad path\mission combination %1",_missionFile];
};
} forEach _missionList;
private _key = round(random(10000));
private _missions = [
_key,
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner
];
GMS_missionData pushBack _missions;

View File

@ -0,0 +1,218 @@
/*
schedules deletion of all remaining alive AI and mission objects.
Updates the mission que.
Updates mission markers.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
///////////////////////////////////////////////////////////////////////
// MAIN FUNCTION STARTS HERE
//////////////////////////////////////////////////////////////////////
params[
["_key",-1],
["_missionData",[]],
["_endMsg",""],
["_markerData",[]],
["_missionLootConfigs",[]],
["_isScuba",false],
["_endCode",-1]
];
//[format["_endMission: _endCode %1 | _markerData %2 | _endMsg %3",_endCode, _markerData, _endMsg]] call GMS_fnc_log;
_missionData params [
"_coords",
"_mines",
"_objects",
"_hiddenObjects",
"_crates",
"_missionAI",
"_assetSpawned",
"_aiVehicles",
"_lootVehicles",
"_markers"
];
_markerData params [
"_markerName",
"_markerMissionName"
];
/*
_missionLootConfigs params [
"_spawnCratesTiming",
"_loadCratesTiming",
"_crateLoot",
"_lootCounts"
// Ignore the remaining entries in the configuration
];
*/
{[_x] call GMS_fnc_deleteMarker} forEach (_markers);
{
private _el = _x;
if ((_el select 0) == _key) exitWith
{
#define noActive 3
private _activeMissions = _el select noActive;
_el set[noActive, _activeMissions - 1];
};
} forEach GMS_missionData;
switch (_endCode) do
{
case -1: {
//[format["_endMission (93): _exception -1 | _mines %1 | _crates %2 | count _objects %3 | count _missionAI %4 ",_mines,_crates,count _objects, count _missionAI]] call GMS_fnc_log;
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime)];
[_mines, 0] call GMSCore_fnc_deleteObjectsMethod;
[_crates, 0] call GMSCore_fnc_deleteObjectsMethod;
[_objects, 0] call GMSCore_fnc_deleteObjectsMethod;
[_missionAI, 0] call GMSCore_fnc_deleteObjectsMethod;
[_aiVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[_lootVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
};
case 1: { // Normal End
//[format["_endMission (102): _exception 1 (normal ending) | _mines %1 | _crates %2 | count _objects %3 | count _missionAI %4 ",_mines,_crates,count _objects, count _missionAI]] call GMS_fnc_log;
if (GMS_useSignalEnd) then
{
[_crates select 0,150] spawn GMSCore_fnc_visibleMarker;
{
_x enableRopeAttach true;
}forEach _crates;
};
[["end",_endMsg,_markerMissionName]] call GMS_fnc_messageplayers;
[_coords, _markerName] spawn GMS_fnc_missionCompleteMarker;
{
private ["_v","_posnVeh"];
_posnVeh = GMS_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count GMS_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
(GMS_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
GMS_monitoredVehicles pushback _x;
};
} forEach _aiVehicles;
[_mines, 0] call GMSCore_fnc_deleteObjectsMethod;
[_objects, (diag_tickTime + GMS_cleanupCompositionTimer)] call GMSCore_fnc_addToDeletionCue;
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime + GMS_cleanupCompositionTimer)];
[_missionAI, (diag_tickTime + GMS_AliveAICleanUpTimer)] call GMSCore_fnc_addToDeletionCue;
[format["Mission Completed | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerName]] call GMS_fnc_log;
};
case 2: { // Aborted for moving a crate
#define illegalCrateMoveMsg "Crate moved before mission completed"
[["warming",illegalCrateMoveMsg,_markerName]] call GMS_fnc_messageplayers;
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime)];
[_mines, 0] call GMSCore_fnc_deleteObjectsMethod;
[_crates, 0] call GMSCore_fnc_deleteObjectsMethod;
[_objects, 0] call GMSCore_fnc_deleteObjectsMethod;
[_missionAI, 0] call GMSCore_fnc_deleteObjectsMethod;
[_aiVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[_lootVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[format["Mission Aborted <CRATE MOVED> | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerName]] call GMS_fnc_log;
};
case 3: { // Mision aborted for killing an asset
[["warning",_endMsg,_markerName]] call GMS_fnc_messageplayers;
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime)];
[_mines, 0] call GMSCore_fnc_deleteObjectsMethod;
[_crates, 0] call GMSCore_fnc_deleteObjectsMethod;
[_objects, 0] call GMSCore_fnc_deleteObjectsMethod;
[_missionAI, 0] call GMSCore_fnc_deleteObjectsMethod;
[_aiVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[_lootVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[format["Mission Aborted <ASSET KILLED> | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerName]] call GMS_fnc_log;
};
case 4: {
//[format["_endMission (153): _exception 4 | count _mines %1 | count _crates %2 | count _objects %3 | count _missionAI %4 ",_mines,_crates,count _objects, count _missionAI]] call GMS_fnc_log;
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime)];
if (GMS_useSignalEnd) then
{
[_crates select 0,150] spawn GMSCore_fnc_visibleMarker;
{
_x enableRopeAttach true;
}forEach _crates;
};
[["end",_endMsg,_markerMissionName]] call GMS_fnc_messageplayers;
[_coords, _markerName] spawn GMS_fnc_missionCompleteMarker;
{
private ["_v","_posnVeh"];
_posnVeh = GMS_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count GMS_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
(GMS_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
GMS_monitoredVehicles pushback _x;
};
} forEach _aiVehicles;
[_mines, 0] call GMSCore_fnc_deleteObjectsMethod;
[_crates, 1200] call GMSCore_fnc_deleteObjectsMethod;
[_objects, 0] call GMSCore_fnc_deleteObjectsMethod;
[_missionAI, 0] call GMSCore_fnc_deleteObjectsMethod;
[_aiVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[_lootVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
};
case 5: {
//[format["_endMission (190): _exception 5 | count _mines %1 | count _crates %2 | count _objects %3 | count _missionAI %4 ",_mines,_crates,count _objects, count _missionAI]] call GMS_fnc_log;
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime)];
if (GMS_useSignalEnd) then
{
[_crates select 0,150] spawn GMSCore_fnc_visibleMarker;
{
_x enableRopeAttach true;
}forEach _crates;
};
[["end",_endMsg,_markerMissionName]] call GMS_fnc_messageplayers;
[_coords, _markerName] spawn GMS_fnc_missionCompleteMarker;
{
private ["_v","_posnVeh"];
_posnVeh = GMS_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count GMS_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
(GMS_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
GMS_monitoredVehicles pushback _x;
};
} forEach _aiVehicles;
[_mines, 0] call GMSCore_fnc_deleteObjectsMethod;
[_crates, 120] call GMSCore_fnc_deleteObjectsMethod;
[_objects, 0] call GMSCore_fnc_deleteObjectsMethod;
[_missionAI, 0] call GMSCore_fnc_deleteObjectsMethod;
[_aiVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
[_lootVehicles, 0] call GMSCore_fnc_deleteObjectsMethod;
};
};
GMS_missionsRunning = GMS_missionsRunning - 1;
GMS_ActiveMissionCoords = GMS_ActiveMissionCoords - [ _coords];
if !(_isScuba) then
{
GMS_recentMissionCoords pushback [_coords,diag_tickTime];
};
if (_isScuba) then
{
GMS_priorDynamicUMS_Missions pushback [_coords,diag_tickTime];
GMS_UMS_ActiveDynamicMissions = GMS_UMS_ActiveDynamicMissions - [_coords];
GMS_dynamicUMS_MissionsRuning = GMS_dynamicUMS_MissionsRuning - 1;
};
GMS_missionsRun = GMS_missionsRun + 1;

View File

@ -0,0 +1,149 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private["_a1","_item","_diff","_tries"];
params["_crate","_boxLoot","_itemCnts"];
_itemCnts params["_wepCnt","_magCnt","_opticsCnt","_materialsCnt","_itemCnt","_bkcPckCnt"];
_boxLoot params["_weapons","_magazines","_optics","_materials","_items","_backpacks"];
if !(_weapons isEqualTo []) then
{
private _tries = [_wepCnt] call GMSCore_fnc_getIntegerFromRange;
//[format["_fillBoxes: _tries %1 | _wepCnt %2 | _weapons %3",_tries,_wepCnt,_weapons]] call GMS_fnc_log;
// Add some randomly selected weapons and corresponding magazines
for "_i" from 0 to _tries do
{
_item = selectRandom _weapons;
if (_item isEqualType []) then // Check whether weapon name is part of an array that might also specify an ammo to use
{
_crate addWeaponCargoGlobal [_item select 0,1]; // if yes then assume the first element in the array is the weapon name
if (count _item >1) then { // if the array has more than one element assume the second is the ammo to use.
_crate addMagazineCargoGlobal [_item select 1, 1 + round(random(3))];
} else { // if the array has only one element then lets load random ammo for it
_crate addMagazineCargoGlobal [selectRandom (getArray (configFile >> "CfgWeapons" >> (_item select 0) >> "magazines")), 1 + round(random(5))];
};
} else {
if (_item isKindOf ["Rifle", configFile >> "CfgWeapons"]) then
{
_crate addWeaponCargoGlobal [_item, 1];
_crate addMagazineCargoGlobal [selectRandom (getArray (configFile >> "CfgWeapons" >> _item >> "magazines")), 1 + round(random(5))];
};
};
};
};
if !(_magazines isEqualTo []) then
{
private _tries = [_magCnt] call GMSCore_fnc_getIntegerFromRange;
//[format["_fillBoxes: _tries %1 | _magCnt %2 | _magazines %3",_tries,_magCnt,_magazines]] call GMS_fnc_log;
// Add Magazines, grenades, and 40mm GL shells
for "_i" from 0 to _tries do
{
_item = selectRandom _magazines;
if (_item isEqualType []) then
{
_diff = (_item select 2) - (_item select 1); // Take difference between max and min number of items to load and randomize based on this value
_crate addMagazineCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (_item isEqualType "") then
{
_crate addMagazineCargoGlobal [_item, 1];
};
};
};
if !(_optics isEqualTo []) then
{
private _tries = [_opticsCnt] call GMSCore_fnc_getIntegerFromRange;
//[format["_fillBoxes: _tries %1 | _wepCnt %2 | _weapons %3",_tries,_opticsCnt,_optics]] call GMS_fnc_log;
// Add Optics
for "_i" from 0 to _tries do
{
_item = selectRandom _optics;
if (_item isEqualType []) then
{
_diff = (_item select 2) - (_item select 1);
_crate additemCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (_item isEqualType "") then
{
_crate addItemCargoGlobal [_item,1];
};
};
};
if !(_materials isEqualTo []) then
{
private _tries = [_materialsCnt] call GMSCore_fnc_getIntegerFromRange;
//[format["_fillBoxes: _tries %1 | _materialsCnt %2 | _materials %3",_tries,_materialsCnt,_materials]] call GMS_fnc_log;
// Add materials (cindar, mortar, electrical parts etc)
for "_i" from 0 to _tries do
{
_item = selectRandom _materials;
if (_item isEqualType []) then
{
_diff = (_item select 2) - (_item select 1);
_crate additemCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (_item isEqualType "") then
{
_crate addItemCargoGlobal [_item, 1];
};
};
};
if !(_items isEqualTo []) then
{
private _tries = [_itemCnt] call GMSCore_fnc_getIntegerFromRange;
//[format["_fillBoxes: _tries %1 | _itemCnt %2 | _items %3",_tries,_itemCnt,_items]] call GMS_fnc_log;
// Add Items (first aid kits, multitool bits, vehicle repair kits, food and drinks)
for "_i" from 0 to _tries do
{
_item = selectRandom _items;
if (_item isEqualType []) then
{
_diff = (_item select 2) - (_item select 1);
_crate additemCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (_item isEqualType "") then
{
_crate addItemCargoGlobal [_item, 1];
};
};
};
if !(_backpacks isEqualTo []) then
{
private _tries = [_bkcPckCnt] call GMSCore_fnc_getIntegerFromRange;
//[format["_fillBoxes: _tries %1 | _bkcPckCnt %2 | _backpacks %3",_tries,_bkcPckCnt,_backpacks]] call GMS_fnc_log;
for "_i" from 0 to _tries do
{
_item = selectRandom _backpacks;
if (_item isEqualType []) then
{
_diff = (_item select 2) - (_item select 1);
_crate addbackpackcargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (_item isEqualType "") then
{
_crate addbackpackcargoGlobal [_item, 1];
};
};
};

View File

@ -0,0 +1,82 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_center",
"_garrisonedBuilding_ATLsystem",
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_weaponList",[]],
["_sideArms",[]]
];
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
_unitsSpawned = [];
{
_g = _x;
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_statics","_men"];
private _unitsToSpwan = (count _statics) + (count _men);
/*
params[
["_pos",[0,0,0]],
["_numbertospawn",0],
["_skillLevel","red"],
["_areaDimensions",[]],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_weaponList",[]],
["_sideArms",[]],
["_scuba",false]
];
*/
#define areaDimensions [] // an empty array forces the spawnGroup function to skip setup of any waypoint
private _group = [[0,0,0],_unitsToSpwan,_aiDifficultyLevel,[],_uniforms,_headgear,_vests,_backpacks,_weaponList,_sidearms,false] call GMS_fnc_spawnGroup;
_unitsSpawned append (units _group);
private _units = units _group;
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir;
_buildingsSpawned pushBack _building;
//_staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call GMS_fnc_spawnGarrisonInsideBuilding_ATL;
{
_x params["_staticClassName","_staticRelPos","_staticDir"];
#define height 0
#define removeFuel 0
#define vehHitCode []
#define vehKilledCode []
private _damage = if (GMS_killEmptyStaticWeapons) then {1} else {0};
private _releaseToPlayers = if (GMS_killEmptyStaticWeapons) then {false} else {true};
private _wep = [_staticClassName,[0,0,0],_staticDir,height,_damage,removeFuel,_releaseToPlayers,GMS_vehicleDeleteTimer,vehHitCode,vehKilledCode] call GMSCore_fnc_spawnPatrolVehicle;
_staticsSpawned pushBack _wep;
_wep setVariable["GMS_vehType","emplaced"];
_staticsSpawned pushBack _wep;
_wep setPosATL (_staticRelPos vectorAdd getPosATL _building);
_wep setDir _staticDir;
_unit = _units deleteAt 0;
_unit moveInGunner _wep;
}forEach _statics;
{
_u = _x;
_u params["_unitRelPos","_unitDir"];
_unit = _units deleteAt 0;
_unit setPosATL (_unitRelPos vectorAdd (getPosATL _building));
_unit setDir _unitDir;
}forEach _men;
}forEach _garrisonedBuilding_ATLsystem;
//[format["_garrisonBuilding_ATLSystem: _unitsspawned %1 | _staticsSpawned %2 | BuildingsSpawned %3",_unitsSpawned,_staticsSpawned,_buildingsSpawned]] call GMS_fnc_log;
[_unitsSpawned,_staticsSpawned,_buildingsSpawned]

View File

@ -0,0 +1,176 @@
/*
GMS_fnc_initializeMission
Perform all functions necessary to initialize a mission.
A marker is created and mission info is added to GMS_initializedMissionsList
[_mrkr,_difficulty,_m] call GMS_fnc_initializeMission;
Returns one of the following values:
0 - the search for a position was unsuccessful - _coords == []
1 - the mission was successfully initialized at _coords != [0,0,0]
2 - the mission has been run the maximum allowed times.
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private ["_coords","_coordArray","_return"];
params[
"_key", // This key can be used to seach the list of available mission types to update that list when a mission is completed or times out
"_missionConfigs", // Selfevident but this is an array with all configs for the mission
"_missionCount" // The number of missions run thus far which is used to unsure each marker has a unique name
];
_missionConfigs params [
"_difficulty",
"_markerConfigs",
"_endCondition",
"_isscubamission",
"_missionLootConfigs",
"_aiConfigs",
"_missionMessages",
"_paraConfigs",
"_defaultMissionLocations",
"_maxMissionRespawns",
"_timesSpawned"
];
_markerConfigs params[
"_markerName", // The unique text identifier for the marker
"_markerMissionName", // Name used for setMarkerText - does not need to be unique
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush"
];
[format["_initializeMission (39): _markerName %1 | _key %2 | _missionCount %3 | _maxMissionRespawns %4 | _timesSpawned %5",_markerName,_key,_missionCount,_maxMissionRespawns,_timesSpawned]] call GMS_fnc_log;
private _initialized = 0;
/*
*/
_coordsArray = [];
if !(_defaultMissionLocations isEqualTo []) then
{
if (_timesSpawned < _maxMissionRespawns || {_maxMissionRespawns == -1}) then
{
_coords = selectRandom _defaultMissionLocations;
#define timesSpawnedIndex 10
_missionConfigs set[timesSpawnedIndex, _timesSpawned + 1];
} else {
_initialized = 2;
};
} else {
if (_isScubaMission) then
{
_coords = [] call GMS_fnc_findShoreLocation;
} else {
_coords = [] call GMS_fnc_findSafePosn;
_coords = [_coords select 0, _coords select 1, 0];
};
};
if (_initialized == 2) exitWith {_initialized};
if (_coords isEqualTo [] || {_coords isEqualTo [0,0,0]}) exitWith
{
[format["No Safe Mission Spawn Position Found to spawn Mission %1",_markerMissionName],'warning'] call GMS_fnc_log;
// _initialized should be == 0 here
_initialized
};
GMS_ActiveMissionCoords pushback _coords;
GMS_missionsRunning = GMS_missionsRunning + 1;
//[format["_initializeMission (70): _coords = %1 | GMS_missionsRunning = %2",_coords,GMS_missionsRunning]] call GMS_fnc_log;
private _markers = [];
/*
Handle map markers
*/
private "_markerPos";
if (GMS_labelMapMarkers select 0) then
{
_markerPos = _coords;
};
if !(GMS_preciseMapMarkers) then
{
_markerPos = [_coords,75] call GMS_fnc_randomPosition;
};
if (GMS_debugLevel >= 3) then
{
{
diag_log format["_initializeMission (95) %1 = %2",_x,_markerConfigs select _forEachIndex];
} forEach [
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush"
];
};
private _markerError = false;
if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile >> "CfgMarkers" >> _markerType)} ) then
{
//[format["_markerType set to 'ELLIPSE': Illegal marker type %1 used for mission %2 of difficulty %3",_markerType,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log;
_markerType = "ELLIPSE";
_markerSize = [200,200];
_markerBrush = "GRID";
_markerError = true;
};
if !(isClass(configFile >> "CfgMarkerColors" >> _markerColor)) then
{
//[format["_markerColor set to 'default': Illegal color %1 used for mission %2 of difficulty %3",_markerColor,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log;
_markerColor = "DEFAULT";
_markerError = true;
};
// _markers holds the two markers generated for the mission.
// The first can be "" if the marker type used is an icon such as a triangle.
// The second is always an icon which may have a label.
private _markers = [
format["%1:%2",_markerName,_missionCount],
_markerPos,
_markerMissionName,
_markerColor,
_markerType,
_markerSize,
_markerBrush] call GMS_fnc_createMissionMarkers;
if (GMS_debugLevel >= 3) then {[format["_initializeMission (130): _marker = %1 | _markerMissionName = %2 | _difficulty = %3",_markers,_markerMissionName,_difficulty]] call GMS_fnc_log};
/*
Send a message to players.
*/
private _startMsg = _missionMessages select 2;
[["start",_startMsg,_markerMissionName]] call GMS_fnc_messageplayers;
#define missionTimeoutAt (diag_tickTime + GMS_MissionTimeout)
#define triggered 0
#define objects []
#define hiddenObjects []
#define mines []
#define crates []
#define missionVehicles []
#define missionAI []
#define lootVehicles []
#define assetSpawned objNull
private _missionData = [
_coords,
mines,
objects,
hiddenObjects,
crates,
missionAI,
assetSpawned,
missionVehicles,
lootVehicles,
_markers
];
private _spawnPara = -1;
GMS_initializedMissionsList pushBack [_key, missionTimeoutAt, triggered, _missionData, _missionConfigs, _spawnPara];
//[format["_initializeMission (163): count GMS_initializedMissionsList = %1",count GMS_initializedMissionsList]] call GMS_fnc_log;
_initialized = 1;
_initialized

View File

@ -0,0 +1,51 @@
/*
Depends on GMS_fnc_addItemToCrate
call as:
[_item,_crate] call GMS_fnc_loadLootFromItemsArray;
where
_crate is a container such as ammo box or vehicle
_loadout is an array containing either 2 or 3 elements. The first array is always an array of items to add. Items can be formated as ["item1","item1"], as [["item1",3],["item2",2]] or as [["item1",2,4],["item2",3,5]].
See GMS_fnc_addItemToCrate for information about the acceptable formates for the items "item1" ... "itemN".
The second and optional third element in the array specify the number of times the script will randomly select an item from the array of items and load it into the crate.
For example:
case 1: [["item1",...,"itemN"],6]; The script will randomly select from the array of item names 6 times and call the loot loader each time.
case 2: [["item1",...,"itemN"],6, 9]; As above except that an item will be selected a minimum of 6 and maximum of 9 times.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
params["_loadout","_crate",["_addAmmo",0]];
if ((_loadout select 0) isEqualTo []) exitWith {};
{
private["_tries","_q","_item"];
_tries = 0;
//diag_log format["_fn_loadLoot:: -- >> now loading for %1",_x];
_q = _x select 1; // this can be a number or array.
if (_q isEqualType []) then // Assume the array contains a min/max number to add
{
if ((count _q) isEqualTo 2) then {_tries = (_q select 0) + round(random(((_q select 1) - (_q select 0))));} else {_tries = 0;};
};
if (_q isEqualType 0) then
{
_tries = _q;
};
for "_i" from 1 to _tries do
{
_item = selectRandom (_x select 0);
[_item,_crate,_addAmmo] call GMSCore_fnc_addItem;
};
}forEach _loadout;

View File

@ -0,0 +1,20 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
private _crate = _this select 0;
private _lootCounts = _crate getVariable "lootCounts";
private _lootarray = _crate getVariable "lootArray";
[_crate,_lootArray,_lootCounts] call GMS_fnc_fillBoxes;
_crate setVariable["lootLoaded",true];

Some files were not shown because too many files have changed in this diff Show More