mirror of
https://github.com/Ghostrider-DbD-/GMS_RC.git
synced 2024-08-30 16:02:11 +00:00
Add GMS Mission System
This commit is contained in:
parent
bb93179ec2
commit
a64f4aca20
1
@GMS/addons/GMS/$PBOPREFIX$
Normal file
1
@GMS/addons/GMS/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
addons\GMS
|
@ -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
|
||||
|
||||
|
193
@GMS/addons/GMS/Compiles/Functions/GMS_fnc_findSafePosn_3.sqf
Normal file
193
@GMS/addons/GMS/Compiles/Functions/GMS_fnc_findSafePosn_3.sqf
Normal 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
|
||||
|
||||
|
||||
|
179
@GMS/addons/GMS/Compiles/Functions/GMS_fnc_findSafePosn_4.sqf
Normal file
179
@GMS/addons/GMS/Compiles/Functions/GMS_fnc_findSafePosn_4.sqf
Normal 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;
|
||||
|
||||
|
21
@GMS/addons/GMS/Compiles/Functions/fn_addItemToCrate.sqf
Normal file
21
@GMS/addons/GMS/Compiles/Functions/fn_addItemToCrate.sqf
Normal 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;
|
19
@GMS/addons/GMS/Compiles/Functions/fn_broadcastServerFPS.sqf
Normal file
19
@GMS/addons/GMS/Compiles/Functions/fn_broadcastServerFPS.sqf
Normal 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";
|
||||
|
||||
|
||||
|
||||
|
22
@GMS/addons/GMS/Compiles/Functions/fn_cleanEmptyGroups.sqf
Normal file
22
@GMS/addons/GMS/Compiles/Functions/fn_cleanEmptyGroups.sqf
Normal 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};
|
||||
};
|
||||
|
27
@GMS/addons/GMS/Compiles/Functions/fn_countAliveAI.sqf
Normal file
27
@GMS/addons/GMS/Compiles/Functions/fn_countAliveAI.sqf
Normal 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
|
||||
|
||||
|
@ -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
|
17
@GMS/addons/GMS/Compiles/Functions/fn_deleteMarker.sqf
Normal file
17
@GMS/addons/GMS/Compiles/Functions/fn_deleteMarker.sqf
Normal 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");
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
42
@GMS/addons/GMS/Compiles/Functions/fn_findShoreLocation.sqf
Normal file
42
@GMS/addons/GMS/Compiles/Functions/fn_findShoreLocation.sqf
Normal 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
24
@GMS/addons/GMS/Compiles/Functions/fn_findWaterDepth.sqf
Normal file
24
@GMS/addons/GMS/Compiles/Functions/fn_findWaterDepth.sqf
Normal 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
17
@GMS/addons/GMS/Compiles/Functions/fn_getAllDMSMarkers.sqf
Normal file
17
@GMS/addons/GMS/Compiles/Functions/fn_getAllDMSMarkers.sqf
Normal 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
|
@ -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
|
||||
|
@ -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
|
@ -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;
|
96
@GMS/addons/GMS/Compiles/Functions/fn_mainThread.sqf
Normal file
96
@GMS/addons/GMS/Compiles/Functions/fn_mainThread.sqf
Normal 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 {"Dedicated Server"} else {"Headless Client"};
|
||||
[
|
||||
format["Timstamp %1 | Missions Running %2 | Vehicles %3 | Groups %4 | Missions Run %5 | Server FPS %6 | Server Uptime %7 Min | Running on %8",
|
||||
diag_tickTime,
|
||||
GMS_missionsRunning,
|
||||
count GMS_monitoredVehicles,
|
||||
count GMS_monitoredMissionAIGroups,
|
||||
GMS_missionsRun,
|
||||
diag_FPS,
|
||||
floor(diag_tickTime/60),
|
||||
_clientID
|
||||
]
|
||||
] 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;
|
||||
};
|
||||
};
|
@ -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;
|
23
@GMS/addons/GMS/Compiles/Functions/fn_messagePlayers.sqf
Normal file
23
@GMS/addons/GMS/Compiles/Functions/fn_messagePlayers.sqf
Normal 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;
|
||||
|
||||
|
||||
|
@ -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];
|
15
@GMS/addons/GMS/Compiles/Functions/fn_msgIED.sqf
Normal file
15
@GMS/addons/GMS/Compiles/Functions/fn_msgIED.sqf
Normal 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;
|
31
@GMS/addons/GMS/Compiles/Functions/fn_nearestPlayers.sqf
Normal file
31
@GMS/addons/GMS/Compiles/Functions/fn_nearestPlayers.sqf
Normal 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
|
31
@GMS/addons/GMS/Compiles/Functions/fn_playerInRange.sqf
Normal file
31
@GMS/addons/GMS/Compiles/Functions/fn_playerInRange.sqf
Normal 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
|
27
@GMS/addons/GMS/Compiles/Functions/fn_playerInRangeArray.sqf
Normal file
27
@GMS/addons/GMS/Compiles/Functions/fn_playerInRangeArray.sqf
Normal 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
|
@ -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;
|
||||
};
|
||||
};
|
18
@GMS/addons/GMS/Compiles/Functions/fn_setDirUp.sqf
Normal file
18
@GMS/addons/GMS/Compiles/Functions/fn_setDirUp.sqf
Normal 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};
|
||||
};
|
84
@GMS/addons/GMS/Compiles/Functions/fn_spawnMarker.sqf
Normal file
84
@GMS/addons/GMS/Compiles/Functions/fn_spawnMarker.sqf
Normal 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
|
@ -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];
|
47
@GMS/addons/GMS/Compiles/GMS_functions.sqf
Normal file
47
@GMS/addons/GMS/Compiles/GMS_functions.sqf
Normal 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;
|
||||
|
||||
|
||||
|
||||
|
56
@GMS/addons/GMS/Compiles/GMS_variables.sqf
Normal file
56
@GMS/addons/GMS/Compiles/GMS_variables.sqf
Normal 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"};
|
||||
|
@ -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;
|
||||
};
|
24
@GMS/addons/GMS/Compiles/Groups/fn_cleanEmptyGroups.sqf
Normal file
24
@GMS/addons/GMS/Compiles/Groups/fn_cleanEmptyGroups.sqf
Normal 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};
|
||||
};
|
||||
};
|
||||
|
31
@GMS/addons/GMS/Compiles/Groups/fn_createGroup.sqf
Normal file
31
@GMS/addons/GMS/Compiles/Groups/fn_createGroup.sqf
Normal 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
|
@ -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;
|
||||
|
@ -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
|
47
@GMS/addons/GMS/Compiles/Groups/fn_groupWaypointMonitor.sqf
Normal file
47
@GMS/addons/GMS/Compiles/Groups/fn_groupWaypointMonitor.sqf
Normal 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;
|
||||
|
118
@GMS/addons/GMS/Compiles/Groups/fn_setNextWaypoint.sqf
Normal file
118
@GMS/addons/GMS/Compiles/Groups/fn_setNextWaypoint.sqf
Normal 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];
|
||||
};
|
||||
|
||||
|
||||
|
87
@GMS/addons/GMS/Compiles/Groups/fn_setupWaypoints.sqf
Normal file
87
@GMS/addons/GMS/Compiles/Groups/fn_setupWaypoints.sqf
Normal 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
|
||||
};
|
74
@GMS/addons/GMS/Compiles/Groups/fn_simulationMonitor.sqf
Normal file
74
@GMS/addons/GMS/Compiles/Groups/fn_simulationMonitor.sqf
Normal 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;
|
||||
*/
|
||||
};
|
||||
|
||||
|
104
@GMS/addons/GMS/Compiles/Groups/fn_spawnGroup.sqf
Normal file
104
@GMS/addons/GMS/Compiles/Groups/fn_spawnGroup.sqf
Normal 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
|
||||
|
@ -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];
|
@ -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
|
||||
|
183
@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf
Normal file
183
@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf
Normal 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
|
@ -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
|
@ -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
|
57
@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf
Normal file
57
@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf
Normal 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;
|
||||
|
||||
|
||||
|
||||
|
218
@GMS/addons/GMS/Compiles/Missions/fn_endMission.sqf
Normal file
218
@GMS/addons/GMS/Compiles/Missions/fn_endMission.sqf
Normal 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;
|
149
@GMS/addons/GMS/Compiles/Missions/fn_fillBoxes.sqf
Normal file
149
@GMS/addons/GMS/Compiles/Missions/fn_fillBoxes.sqf
Normal 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];
|
||||
};
|
||||
};
|
||||
};
|
@ -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]
|
176
@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf
Normal file
176
@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf
Normal 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
|
@ -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;
|
20
@GMS/addons/GMS/Compiles/Missions/fn_loadMissionCrate.sqf
Normal file
20
@GMS/addons/GMS/Compiles/Missions/fn_loadMissionCrate.sqf
Normal 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];
|
||||
|
||||
|
||||
|
||||
|
34
@GMS/addons/GMS/Compiles/Missions/fn_missionCleanup.sqf
Normal file
34
@GMS/addons/GMS/Compiles/Missions/fn_missionCleanup.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
schedules deletion of all remaining alive AI and mission objects.
|
||||
|
||||
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","_mines","_objects","_hiddenObjects","_GMS_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
|
||||
|
||||
[_mines] call GMS_fnc_clearMines;
|
||||
[_objects, (diag_tickTime + _cleanupCompositionTimer)] call GMSCore_fnc_addToDeletionCue;
|
||||
GMS_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime + _cleanupCompositionTimer)];
|
||||
[_GMS_AllMissionAI, (diag_tickTime + _cleanupAliveAITimer)] call GMSCore_fnc_addToDeletionCue;
|
||||
GMS_missionsRunning = GMS_missionsRunning - 1;
|
||||
GMS_ActiveMissionCoords = GMS_ActiveMissionCoords - [ _coords];
|
||||
if !(_isScubaMission) then
|
||||
{
|
||||
GMS_recentMissionCoords pushback [_coords,diag_tickTime];
|
||||
[_markerName,"inactive",[0,0,0]] call GMS_fnc_updateMissionQue;
|
||||
};
|
||||
if (_isScubaMission) then
|
||||
{
|
||||
GMS_priorDynamicUMS_Missions pushback [_coords,diag_tickTime];
|
||||
GMS_UMS_ActiveDynamicMissions = GMS_UMS_ActiveDynamicMissions - [_coords];
|
||||
GMS_dynamicUMS_MissionsRuning = GMS_dynamicUMS_MissionsRuning - 1;
|
||||
};
|
@ -0,0 +1,436 @@
|
||||
/*
|
||||
GMS_fnc_monitorInitializedMissions
|
||||
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"
|
||||
|
||||
//GMS_activeMonitorThreads = GMS_activeMonitorThreads + 1;
|
||||
GMS_monitoring = true;
|
||||
|
||||
//[format["_monitorInitializedMissions (17): GMS_initializedMissionsList = %1", GMS_initializedMissionsList]] call GMS_fnc_log;
|
||||
|
||||
private _missionsList = GMS_initializedMissionsList;
|
||||
for "_i" from 1 to (count _missionsList) do
|
||||
{
|
||||
|
||||
if (_i > (count _missionsList)) exitWith {};
|
||||
|
||||
// Select a mission category (blue, red, green , etd)
|
||||
private _el = _missionsList deleteAt 0;
|
||||
_el params [
|
||||
"_key",
|
||||
"_missionTimeoutAt", // 1 // server time at which the mission times out.
|
||||
"_triggered", // 2 // integer - specifies if mission was triggered by a player or scripting such as debug setting
|
||||
"_missionData", // 4 // variable containing information specific to this instance of the mission such as location and objects
|
||||
"_missionConfigs", // 5 // Variables regarding the configuration of the dynamic mission
|
||||
"_spawnPara"
|
||||
];
|
||||
|
||||
#define triggered 2
|
||||
#define missionCoords _missionData select 0
|
||||
#define delayTime 1
|
||||
|
||||
private _monitorAction = -2;
|
||||
|
||||
if (_triggered == 0) then
|
||||
{
|
||||
if ((_missionTimeoutAt > 0) && {diag_tickTime > _missionTimeoutAt}) then
|
||||
{
|
||||
_monitorAction = -1;
|
||||
//diag_log format["_monitorInitializedMissions (37) Mission Timeout Criteria Met at %1",diag_tickTime];
|
||||
} else {
|
||||
private _playerInRange = [missionCoords, GMS_TriggerDistance, false, true] call GMS_fnc_playerInRange;
|
||||
if (_playerInRange) then {
|
||||
//diag_log format["_monitorInitializedMissions (41) Player in range criteria met at %1",diag_tickTime];
|
||||
_monitorAction = 0;
|
||||
} else {
|
||||
if (GMS_debugLevel >= 3) then
|
||||
{
|
||||
_monitorAction = 0;
|
||||
[format["_monitorInitializedMissions (54): mission triggered for GMS_debugLeve = %1",GMS_debugLevel]] call GMS_fnc_log;
|
||||
}; // simulate the mission being tripped by a player
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//diag_log format["_monitorInitializedMissions: time %1 | _monitorAction %2 | _missionParameters %3",diag_tickTime,_monitorAction,_missionParameters];
|
||||
|
||||
switch (_monitorAction) do
|
||||
{
|
||||
case -2 : {
|
||||
_missionsList pushBack _el;
|
||||
};
|
||||
// Handle Timeout
|
||||
case -1:
|
||||
{
|
||||
|
||||
_missionConfigs params[
|
||||
"_difficulty",
|
||||
"_markerConfigs",
|
||||
"_endCondition",
|
||||
"_isscubamission",
|
||||
"_missionLootConfigs",
|
||||
"_aiConfigs",
|
||||
"_missionMessages",
|
||||
"_paraConfigs"
|
||||
];
|
||||
|
||||
_missionMessages params [
|
||||
"_assetKilledMsg",
|
||||
"_endMsg"
|
||||
];
|
||||
|
||||
[format["_fnc_monitorInitializedMissions (71): mission timed out: _endMsg %1 | el %2",_endMsg,_el]] call GMS_fnc_log;
|
||||
|
||||
/*
|
||||
["_key",-1],
|
||||
["_missionData",[]],
|
||||
["_endMsg",,""],
|
||||
["_markerData",[]],
|
||||
["_missionLootConfigs",[]],
|
||||
["_isScuba",false],
|
||||
["_endCode",-1]
|
||||
*/
|
||||
[_key, _missionData, "", _missionData,_missionLootConfigs,_isscubamission,-1] call GMS_fnc_endMission;
|
||||
};
|
||||
|
||||
// Handle mission waiting to be triggerd and player is within the range to trigger
|
||||
case 0:
|
||||
{
|
||||
//waitUntil {!_spawningMission};
|
||||
//_spawningMission = true; // to prevent the script from trying to spawn multiple missions at the same time.
|
||||
|
||||
#define noActive 2
|
||||
#define waitTime 5
|
||||
#define missionData 6
|
||||
|
||||
/*
|
||||
_missionData = [
|
||||
_coords,
|
||||
_mines,
|
||||
_objects,
|
||||
_hiddenObjects,
|
||||
_crates,
|
||||
_missionInfantry,
|
||||
_assetSpawned,
|
||||
_aiVehicles,
|
||||
_lootVehicles,
|
||||
_markers];
|
||||
*/
|
||||
_missionData params [
|
||||
"_coords",
|
||||
"_mines",
|
||||
"_objects",
|
||||
"_hiddenObjects",
|
||||
"_crates",
|
||||
"_missionInfantry",
|
||||
"_assetSpawned",
|
||||
"_aiVehicles",
|
||||
"_lootVehicles",
|
||||
"_markers"
|
||||
];
|
||||
_missionConfigs params[
|
||||
"_difficulty",
|
||||
"_markerConfigs",
|
||||
"_endCondition",
|
||||
"_isscubamission",
|
||||
"_missionLootConfigs",
|
||||
"_aiConfigs",
|
||||
"_missionMessages",
|
||||
"_paraConfigs",
|
||||
"_defaultMissionLocations"
|
||||
];
|
||||
_markers params[
|
||||
"_shapedMarker",
|
||||
"_iconMarker"
|
||||
];
|
||||
_missionMessages params [
|
||||
"_assetKilledMsg",
|
||||
"_endMsg",
|
||||
"_startMsg"
|
||||
];
|
||||
_missionLootConfigs params [
|
||||
"_spawnCratesTiming",
|
||||
"_loadCratesTiming",
|
||||
"_crateLoot",
|
||||
"_lootCounts",
|
||||
"_missionLootBoxes",
|
||||
"_missionLootVehicles"
|
||||
];
|
||||
_aiConfigs params [
|
||||
"_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"
|
||||
];
|
||||
|
||||
|
||||
_el set[triggered,1];
|
||||
private["_temp"];
|
||||
if (GMS_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate
|
||||
{
|
||||
_temp = [_coords,GMS_SmokeAtMissions select 1] call GMS_fnc_smokeAtCrates;
|
||||
_objects append _temp;
|
||||
//[format["_monitorInitializedMissions (181): added Smoke objects, _iconMarker %3 | count _objects = %1 | _objects = %2",count _objects, _objects,_iconMarker]] call GMS_fnc_log;
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
if (_useMines) then
|
||||
{
|
||||
_temp = [_coords] call GMS_fnc_spawnMines;
|
||||
_mines = _temp;
|
||||
//[format["_monitorInitializedMissions (189): spawned mines for mission _iconMarker %3 | located at %1 | mines = %2",_coords,_mines,_iconMarker]] call GMS_fnc_log;
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
if (_missionLandscapeMode isEqualTo "random") then
|
||||
{
|
||||
_temp = [_coords,_missionLandscape, 3, 15, 2] call GMS_fnc_spawnRandomLandscape;
|
||||
//[format["_monitorInitializedMissions (196): spawned randomly place objects for _iconMarker %3 | at %1 | list of objects = %2",_coords,_temp select 0,_iconMarker]] call GMS_fnc_log;
|
||||
} else {
|
||||
_temp = [_coords, _missionLandscape] call GMS_fnc_spawnCompositionObjects;
|
||||
//[format["_monitorInitializedMissions (199): precisly positioned objects for _iconMarker %3 | at %1 | list of objects = %2",_coords,_temp select 0,_iconMarker]] call GMS_fnc_log;
|
||||
};
|
||||
_temp params["_obj","_hiddenObj"];
|
||||
_objects append _obj;
|
||||
_hiddenObjects append _hiddenObj;
|
||||
//[format["_monitorInitializedMissions (204): added landscape objects for _iconMarker %1 | count _objects = %2 | _objects = %3",_iconMarker,count _objects, _objects]] call GMS_fnc_log;
|
||||
uiSleep delayTime;
|
||||
|
||||
_temp = [_coords,_simpleObjects,true] call GMS_fnc_spawnSimpleObjects;
|
||||
_objects append _temp;
|
||||
//[format["_monitorInitializedMissions (209): added simple objects for _iconMarker %1 | count _objects = %2 | _objects = %3",_iconMarker,count _objects, _objects]] call GMS_fnc_log;
|
||||
|
||||
_ai = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission] call GMS_fnc_spawnMissionAI;
|
||||
_missionInfantry append _ai;
|
||||
//[format["_monitorInitializedMissions (213): spawned mission AI for _iconMarker %1 at %2 | with count _missionInfantry = %3 | with _missionInfantry = %4",_iconMarker,diag_tickTime,count _missionInfantry, _missionInfantry]] call GMS_fnc_log;
|
||||
uiSleep delayTime;
|
||||
|
||||
if (!(_scubaGroupParameters isEqualTo []) || {_scubaPatrols > 0}) then
|
||||
{
|
||||
_ai = [_coords, _minNoAI,_maxNoAI,_scubaPatrols,_scubaGroupParameters,_difficulty,GMS_UMS_uniforms,GMS_UMS_headgear,GMS_UMS_vests,_backpacks,GMS_UMS_weapons,_sideArms,true] call GMS_fnc_spawnMissionAI;
|
||||
_missionInfantry append _ai;
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
// TODO: 05/08/22 -> redo code to handle this
|
||||
if !(_hostageConfig isEqualTo []) then
|
||||
{
|
||||
_temp = [_coords,_hostageConfig] call GMS_fnc_spawnHostage;
|
||||
_assetSpawned = _temp select 0;
|
||||
_objects pushBack (_temp select 1); // The building in which the asset was spawned.
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
// TODO: 05/08/22 -> redo code to handle this
|
||||
if !(_enemyLeaderConfig isEqualTo []) then
|
||||
{
|
||||
_temp = [_coords,_enemyLeaderConfig] call GMS_fnc_spawnLeader;
|
||||
if (_temp isEqualTo grpNull) then {throw 1} else
|
||||
{
|
||||
_assetSpawned = _temp select 0;
|
||||
_objects pushBack (_temp select 1); // The building in which the asset was spawned.
|
||||
_missionInfantry pushBack _assetSpawned;
|
||||
};
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
private _noChoppers = [_noChoppers] call GMSCore_fnc_getNumberFromRange;
|
||||
//[format["_monitorInitializeMissions(246): _iconMarker %1 | _noChoppers = %2",_iconMarker,_noChoppers]] call GMS_fnc_log;
|
||||
if ((_noChoppers > 0) && {random(1) < _chanceHeliPatrol}) then
|
||||
{
|
||||
_temp = [_coords,_noChoppers,_missionHelis,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms] call GMS_fnc_spawnMissionHelis;
|
||||
_temp params["_helisSpawned","_unitsSpawned"];
|
||||
//[format["_monitorInitializeMissions (251): _iconMarker %1 | _helisSpawned = %2",_iconMarker,_helisSpawned]] call GMS_fnc_log;
|
||||
|
||||
GMS_monitoredVehicles append _helisSpawned;
|
||||
GMS_aircraftPatrols append _helisSpawned; // Used to find nearest heli ...
|
||||
_aiVehicles append _helisSpawned;
|
||||
_missionInfantry append _unitsSpawned;
|
||||
uisleep delayTime;
|
||||
};
|
||||
|
||||
// TODO: 05/08/22 -> redo code to handle this
|
||||
if !(_garrisonedBuilding_ATLsystem isEqualTo []) then // Note that there is no error checking here for nulGroups
|
||||
{
|
||||
_temp = [_coords, _garrisonedBuilding_ATLsystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_garrisonBuilding_ATLsystem;
|
||||
_temp params["_unitsSpawned","_staticsSpawned","_buildingsSpawned"];
|
||||
_objects append _buildingsSpawned;
|
||||
//[format["_monitorInitializedMissions (264): added ATL Garrisons, _iconMarker %1 | count _objects = %2 | _objects = %3",_iconMarker,count _objects, _objects]] call GMS_fnc_log;
|
||||
GMS_monitoredVehicles append _staticsSpawned;
|
||||
_missionInfantry append _unitsSpawned;
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
// TODO: 05/08/22 -> redo code to handle this
|
||||
if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then
|
||||
{
|
||||
_temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_garrisonBuilding_RelPosSystem;
|
||||
_objects append (_temp select 1);
|
||||
GMS_monitoredVehicles append (_temp select 2);
|
||||
_missionInfantry append (units (_temp select 0));
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
private _userelativepos = true;
|
||||
private _emplacedWeaponsThisMission = [_noEmplacedWeapons] call GMSCore_fnc_getNumberFromRange;
|
||||
if (GMS_useStatic && {((_emplacedWeaponsThisMission > 0) || {!(_missionEmplacedWeapons isEqualTo [])} )} ) then
|
||||
{
|
||||
_temp = [_coords,_missionEmplacedWeapons,_userelativepos,_emplacedWeaponsThisMission,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_spawnEmplacedWeaponArray;
|
||||
_temp params["_statics","_units"];
|
||||
_objects append _statics;
|
||||
_missionInfantry append _units;
|
||||
//[format["_monitorInitializedMissions (288): spawned emplaced weapons for _iconMarker %1 at %2 | with count _missionInfantry = %3 | with _statics = %4",_iconMarker,diag_tickTime,count _missionInfantry, _statics]];
|
||||
uisleep delayTime;
|
||||
};
|
||||
|
||||
|
||||
if !(_missionLootVehicles isEqualTo []) then
|
||||
{
|
||||
_lootVehicles = [_coords,_missionLootVehicles,_spawnCratesTiming] call GMS_fnc_spawnMissionLootVehicles;
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
private _noPatrols = [_noVehiclePatrols] call GMSCore_fnc_getNumberFromRange;
|
||||
//[format["_monitorInitializedMissions (300): _iconMarker %1 | _noPatrols (vehicle) = %2",_iconMarker,_noPatrols]] call GMS_fnc_log;
|
||||
if (GMS_useVehiclePatrols && {( (_noPatrols > 0) || {!(_missionPatrolVehicles isEqualTo [])} )} ) then
|
||||
{
|
||||
_temp = [_coords,_noPatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols;
|
||||
_temp params["_vehs","_units"];
|
||||
|
||||
_aiVehicles append _vehs;
|
||||
_missionInfantry append _units;
|
||||
//[format["_monitorInitializedMissions (307): spawned vehicle patrols for _shapedMarker %1 at %2 | with count _missionInfantry = %3 | with _vehs = %4 | _missionInfantry = %5",_shapedMarker,diag_tickTime,count _missionInfantry, _vehs, _missionInfantry]] call GMS_fnc_log;
|
||||
uiSleep delayTime;
|
||||
};
|
||||
|
||||
if (GMS_useVehiclePatrols && {((_submarinePatrols > 0) || {!(_submarinePatrolParameters isEqualTo [])} )} ) then
|
||||
{
|
||||
_temp = [_coords,_noPatrols,_difficulty,_submarinePatrolParameters,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols;
|
||||
_temp params["_vehs","_units"];
|
||||
GMS_monitoredVehicles append _vehs;
|
||||
GMS_landVehiclePatrols append _vehs;
|
||||
_aiVehicles append _vehs;
|
||||
_missionInfantry append _units;
|
||||
uiSleep delayTime;
|
||||
//[format["_monitorInitializedMissions: spawned sub patrols %1",_coords]] call GMS_fnc_log;
|
||||
};
|
||||
|
||||
if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then
|
||||
{
|
||||
if (_missionLootBoxes isEqualTo []) then
|
||||
{
|
||||
_crates = [_coords,[[selectRandom GMS_crateTypes,[1,1,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
//[format["_monitorInitializedMissions (326): _shapedMarker %1 | standard locations for crates at %2 | _crates = %3",_shapedMarker,_coords,_crates]] call GMS_fnc_log;
|
||||
}
|
||||
else
|
||||
{
|
||||
_crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
//[format["_monitorInitializedMissions (331): _iconMarker %1 | predefined locations for crates at %2 | _crates = %3",_iconMarker,_coords,_crates]] call GMS_fnc_log;
|
||||
};
|
||||
//diag_log format["monitorInitializedMission (333): _spawnCrates Timing = %1 / crates spawned = %2",_spawnCratesTiming,_crates];
|
||||
if (GMS_cleanUpLootChests) then
|
||||
{
|
||||
_objects append _crates;
|
||||
};
|
||||
if (_loadCratesTiming isEqualTo "atMissionSpawn") then
|
||||
{
|
||||
private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]);
|
||||
//[format["_monitorInitializedMissions (341) _crateMoney = %1",_crateMoney]] call GMS_fnc_log;
|
||||
{
|
||||
[_x,missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty])] call GMS_fnc_setMoney;
|
||||
} forEach _crates;
|
||||
//diag_log format["monitorInitializedMission (345): _iconMarker %1 | Loot LOADED _loadCrates Timing = %2",_iconMarker,_loadCratesTiming];
|
||||
} else {
|
||||
//diag_log format["monitorInitializedMission (347): _iconMarker %1 | NO Loot LOADED _loadCrates Timing = %2",_iconMarker,_loadCratesTiming];
|
||||
};
|
||||
};
|
||||
//[format["_monitorInitializedMissions (351): added crates, count _crates = %1 | _crates = %2",count _crates, _crates]] call GMS_fnc_log;
|
||||
uiSleep 1;
|
||||
// [format["_monitorInitializedMissions (353): _markers selet 1 = %1 | _iconMarker = %2",_markers select 1, _iconMarker]] call GMS_fnc_log;
|
||||
if (GMS_showCountAliveAI) then
|
||||
{
|
||||
GMS_missionLabelMarkers pushBack [
|
||||
_markers select 1, // The icon marker used for adding text to markers
|
||||
_markerConfigs select 1, // The name of the mission shown to players on markers and in allerts
|
||||
_missionInfantry // The array of units tied to the mission used in this case to keep a count of units still alive that is shown on the map
|
||||
];
|
||||
};
|
||||
|
||||
{
|
||||
_x setVariable["crateSpawnPos", (getPos _x)];
|
||||
} forEach _crates;
|
||||
//[format["_monitorInitializedMissions (361): _shapedMarker %1 | _mines = %3",_shapedMarker,_coords,_mines]] call GMS_fnc_log;
|
||||
//[format["_monitorInitializedMissions (362): _shapedMarker %1 | _crates = %3",_shapedMarker,_coords,_crates]] call GMS_fnc_log;
|
||||
#define indexMines 1
|
||||
#define indexCrates 4
|
||||
_missionData set[indexMines, _mines];
|
||||
_missionData set[indexCrates, _crates];
|
||||
//_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_missionInfantry,_assetSpawned,_aiVehicles,_lootVehicles,_markers];
|
||||
|
||||
//_el set[missionData, _missionData];
|
||||
|
||||
// Everything spawned withouth serious errors so lets keep the mission active for future monitoring
|
||||
//_spawningMission = false;
|
||||
_missionsList pushBack _el;
|
||||
_el params [
|
||||
"_key",
|
||||
"_missionTimeoutAt", // 1 // server time at which the mission times out.
|
||||
"_triggered", // 2 // integer - specifies if mission was triggered by a player or scripting such as debug setting
|
||||
"_missionData", // 4 // variable containing information specific to this instance of the mission such as location and objects
|
||||
"_missionConfigs" // 5 // Variables regarding the configuration of the dynamic mission
|
||||
];
|
||||
_missionData params [
|
||||
"_coords",
|
||||
"_mines",
|
||||
"_objects",
|
||||
"_hiddenObjects",
|
||||
"_crates",
|
||||
"_missionInfantry",
|
||||
"_assetSpawned",
|
||||
"_aiVehicles",
|
||||
"_lootVehicles",
|
||||
"_markers"
|
||||
];
|
||||
//[format["_monitorInitializedMissions (393): _shapedMarker %1 | _coords %2 | count _mines %3 | count _objects %4 | _crates %5",_shapedMarker,_coords,count _mines,count _objects,_crates]] call GMS_fnc_log;
|
||||
};
|
||||
};
|
||||
//diag_log format["_monitorInitializedMissions (396) End of Code Block | GMS_initializedMissionsList = %1",GMS_initializedMissionsList];
|
||||
};
|
||||
GMS_monitoring = false;
|
||||
//GMS_activeMonitorThreads = GMS_activeMonitorThreads - 1;
|
400
@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf
Normal file
400
@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf
Normal file
@ -0,0 +1,400 @@
|
||||
/*
|
||||
GMS_fnc_monitorInitializedMissions
|
||||
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 missionData 4
|
||||
#define noActive 2
|
||||
#define waitTime 5
|
||||
#define missionTimeout 1
|
||||
|
||||
//[format["_monitorSpawnedMissions (20): count GMS_initializedMissionsList =%1 | GMS_initializedMissionsList = %2",count GMS_initializedMissionsList,GMS_initializedMissionsList]] call GMS_fnc_log;
|
||||
private _missionsList = GMS_initializedMissionsList;
|
||||
for "_i" from 1 to (count _missionsList) do
|
||||
{
|
||||
if (_i > count _missionsList) exitWith {};
|
||||
// Select a mission category (blue, red, green , etd)
|
||||
private _el = _missionsList deleteAt 0;
|
||||
_el params [
|
||||
"_key",
|
||||
"_missionTimeoutAt", // 1 // server time at which the mission times out.
|
||||
"_triggered", // 2 // integer - specifies if mission was triggered by a player or scripting such as debug setting
|
||||
"_missionData", // 4 // variable containing information specific to this instance of the mission such as location and objects
|
||||
"_missionConfigs", // 5 // Variables regarding the configuration of the dynamic mission
|
||||
"_spawnPara"
|
||||
];
|
||||
#define triggered 2
|
||||
#define spawnPara 5
|
||||
#define delayTime 1
|
||||
if (_triggered == 1) then
|
||||
{
|
||||
_missionData params [
|
||||
"_coords",
|
||||
"_mines",
|
||||
"_objects",
|
||||
"_hiddenObjects",
|
||||
"_crates",
|
||||
"_missionInfantry",
|
||||
"_assetSpawned",
|
||||
"_aiVehicles",
|
||||
"_lootVehicles",
|
||||
"_markers"
|
||||
];
|
||||
|
||||
_missionConfigs params[
|
||||
"_difficulty",
|
||||
"_markerConfigs",
|
||||
"_endCondition",
|
||||
"_isscubamission",
|
||||
"_missionLootConfigs",
|
||||
"_aiConfigs",
|
||||
"_missionMessages",
|
||||
"_paraConfigs"
|
||||
];
|
||||
|
||||
private _missionComplete = -1;
|
||||
private ["_secureAsset","_endIfPlayerNear","_endIfAIKilled"];
|
||||
//[format["_monitorSpawnedMissions: (67): _endCondition = %1 | _missionMarkerName = %2",_endCondition, _markerConfigs select 1]] call GMS_fnc_log;
|
||||
switch (_endCondition) do
|
||||
{
|
||||
case playerNear: {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;};
|
||||
case allUnitsKilled: {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;};
|
||||
case allKilledOrPlayerNear: {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
|
||||
case assetSecured: {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;};
|
||||
default {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
|
||||
};
|
||||
|
||||
try {
|
||||
//[format["_monitorSpawnedMissions: (88): _spawnPara = %3 | count _missionInfantry = %1 | _crates = %2",count _missionInfantry, _crates,_spawnPara]] call GMS_fnc_log;
|
||||
if (GMS_debugLevel >= 5) throw 1;
|
||||
if (GMS_debugLevel >= 4) throw 4;
|
||||
private _playerIsNearCrates = [_crates,20,true] call GMS_fnc_playerInRangeArray;
|
||||
private _playerIsNearCenter = [_coords,20,true] call GMS_fnc_playerInRange;
|
||||
private _playerIsNear = if (_playerIsNearCrates || {_playerIsNearCenter}) then {true} else {false};
|
||||
private _minNoAliveForCompletion = (count _missionInfantry) - (round(GMS_killPercentage * (count _missionInfantry)));
|
||||
private _aiKilled = if (({alive _x} count _missionInfantry) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete
|
||||
|
||||
if (_endIfPlayerNear && {_playerIsNear}) then {throw 1}; // mission complete
|
||||
if (_endIfAIKilled && {_aiKilled}) then {throw 1};
|
||||
if (_spawnPara isEqualType -1) then
|
||||
{
|
||||
#define chancePara 0;
|
||||
private _chancePara = _paraConfigs select chancePara;
|
||||
_spawnPara = if (random(1) < _chancePara ) then {true} else {false};
|
||||
_el set[spawnPara, _spawnPara];
|
||||
};
|
||||
if (_spawnPara) then
|
||||
{
|
||||
#define paraTriggerDistance 1
|
||||
if ([_coords,_paraConfigs select paraTriggerDistance,true] call GMS_fnc_playerInRange) then
|
||||
{
|
||||
_spawnPara = false; // The player gets one try to spawn these.
|
||||
_el set[spawnPara,_spawnPara];
|
||||
_paraConfigs params[
|
||||
"_chancePara",
|
||||
"_paraTriggerDistance",
|
||||
"_noPara",
|
||||
"_paraSkill",
|
||||
"_chanceLoot",
|
||||
"_paraLoot",
|
||||
"_paraLootCounts"
|
||||
];
|
||||
_aiConfigs params [
|
||||
"_uniforms",
|
||||
"_headgear",
|
||||
"_vests",
|
||||
"_backpacks",
|
||||
"_weaponList",
|
||||
"_sideArms"
|
||||
];
|
||||
//params["_pos","_numAI","_skilllevel",["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weapons",[]],["_sideArms",[]],["_isScuba",false]];
|
||||
private _paraGroup = [_coords,_noPara,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission] call GMS_fnc_spawnParaUnits;
|
||||
//[format["_monitorSpawneMissions: _noPara = %1 | _chancePara = %2 | _paraGroup = %3",_noPara,_chancePara,_paraGroup]] call GMS_fnc_log;
|
||||
if !(isNull _paraGroup) then
|
||||
{
|
||||
_missionInfantry append (units _paraGroup);
|
||||
if (random(1) < _chanceLoot) then
|
||||
{
|
||||
private _extraCrates = [_coords,[[selectRandom GMS_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionSpawnAir", "start", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
if (GMS_cleanUpLootChests) then
|
||||
{
|
||||
_objects append _extraCrates;
|
||||
};
|
||||
};
|
||||
_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_missionInfantry,_assetSpawned,_aiVehicles,_lootVehicles,_markers];
|
||||
_el set[missionData, _missionData];
|
||||
//diag_log format["_monitorSpawnedMissions (134): para spawned at %1",diag_tickTime];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_secureAsset) then
|
||||
{
|
||||
if !(alive _assetSpawned) then
|
||||
{
|
||||
throw 3;
|
||||
} else {
|
||||
|
||||
if (({alive _x} count _missionInfantry) <= (_minNoAliveForCompletion + 1)) then
|
||||
{
|
||||
if ((_assetSpawned getVariable["GMS_unguarded",0]) isEqualTo 0) then
|
||||
{
|
||||
_assetSpawned setVariable["GMS_unguarded",1,true];
|
||||
};
|
||||
|
||||
if ((_assetSpawned getVariable["GMS_AIState",0]) isEqualTo 1) then
|
||||
{
|
||||
_assetSpawned allowdamage false;
|
||||
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
|
||||
throw 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
private _moved = false;
|
||||
if (!(_crates isEqualTo []) && {GMS_crateMoveAllowed}) then
|
||||
{
|
||||
{
|
||||
if ( _x distance (_x getVariable ["crateSpawnPos", (getPos _x)]) > max_distance_crate_moved_uncompleted_mission) throw 2;
|
||||
} forEach _crates;
|
||||
};
|
||||
|
||||
// If there were no throws then lets add the mission parameters back to the list of active missions and check on the mission in a bit.
|
||||
_missionsList pushBack _el;
|
||||
}
|
||||
|
||||
catch // catch all conditions that cause the mission to end.
|
||||
{
|
||||
/*
|
||||
_markerConfigs params [
|
||||
"_markerLabel",
|
||||
"_markerMissionName" // A trunkated list of variables is parsed as we do not need all of them
|
||||
];
|
||||
*/
|
||||
#define markerMissionName 1
|
||||
private _markerMissionName = _markerConfigs select markerMissionName;
|
||||
|
||||
_missionLootConfigs params [
|
||||
"_spawnCratesTiming",
|
||||
"_loadCratesTiming",
|
||||
"_crateLoot",
|
||||
"_lootCounts" // A trunkated list of variables is parsed as we do not need all of them
|
||||
];
|
||||
|
||||
_missionMessages params [
|
||||
"_assetKilledMsg",
|
||||
"_endMsg"
|
||||
];
|
||||
|
||||
switch (_exception) do
|
||||
{
|
||||
case 1: { // Normal Mission End
|
||||
//diag_log format["_monitorSpawnedMissions: (200): _markerMissionName %1: Normal mission end",_markerMissionName];
|
||||
|
||||
if ((_spawnCratesTiming) in ["atMissionEndGround","atMissionEndAir"]) then
|
||||
{
|
||||
if !(_missionLootBoxes isEqualTo []) then
|
||||
{
|
||||
_crates = [_coords,_missionLootBoxes,_loadCratesTiming,(_missionLootConfigs select spawnCratesTiming), "end", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
}
|
||||
else
|
||||
{
|
||||
_crates = [_coords,[[selectRandom GMS_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,(_missionLootConfigs select spawnCratesTiming), "end", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
};
|
||||
|
||||
if (GMS_cleanUpLootChests) then
|
||||
{
|
||||
_objects append _crates;
|
||||
};
|
||||
private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]);
|
||||
//[format["_monitorSpawnedMissions: (218) _crateMoney = %1",_crateMoney]] call GMS_fnc_log;
|
||||
{
|
||||
[_x, _crateMoney] call GMSCore_fnc_setMoney;
|
||||
} forEach _crates;
|
||||
};
|
||||
|
||||
if (_loadCratesTiming isEqualTo "atMissionCompletion") then
|
||||
{
|
||||
private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]);
|
||||
//[format["_monitorSpawnedMissions: (227) _crateMoney = %1",_crateMoney]] call GMS_fnc_log;
|
||||
{
|
||||
[_x] call GMS_fnc_loadMissionCrate;
|
||||
[_x, _crateMoney] call GMSCore_fnc_setMoney;
|
||||
} forEach _crates;
|
||||
//diag_log format["_monitorSpawnedMissions: (232): Loot and Money LOADED _loadCrates Timing = %1 | _crates = %2",_loadCratesTiming,_crates];
|
||||
{
|
||||
[_x] call GMS_fnc_loadMissionCrate;
|
||||
//[_x, missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty])] call GMS_fnc_setMoney;
|
||||
} forEach _lootVehicles;
|
||||
//diag_log format["_monitorSpawnedMissions: (237): Loot LOADED _loadCrates Timing = %1",_loadCratesTiming];
|
||||
};
|
||||
|
||||
_aiVehicles append _lootVehicles; // So these are deleted if no player enters the driver's seat.
|
||||
if (_secureAsset) then
|
||||
{
|
||||
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
|
||||
{
|
||||
_assetSpawned setVariable["GMSAnimations",[""],true];
|
||||
[_assetSpawned,""] remoteExec["switchMove",-2];;
|
||||
uiSleep 0.1;
|
||||
_assetSpawned enableAI "ALL";
|
||||
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
|
||||
(group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0];
|
||||
[group _assetSpawned,0] setWaypointPosition [_newPos,0];
|
||||
[group _assetSpawned,0] setWaypointType "MOVE";
|
||||
};
|
||||
|
||||
if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then
|
||||
{
|
||||
[_assetSpawned,""] remoteExec["switchMove",-2];
|
||||
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
|
||||
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
|
||||
};
|
||||
};
|
||||
//diag_log format["_monitorSpawnedMissions: (262):_crates = %1",_crates];
|
||||
/*
|
||||
["_key",-1],
|
||||
["_missionData",[]],
|
||||
["_endMsg",,""],
|
||||
["_markerData",[]],
|
||||
["_missionLootConfigs",[]],
|
||||
["_isScuba",false],
|
||||
["_endCode",-1]
|
||||
*/
|
||||
[format["_monitorSpawnedMissions (case 1): _markerConfigs %1 | _endMsg %2",_markerConfigs,_endMsg]] call GMS_fnc_log;
|
||||
[_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 1] call GMS_fnc_endMission;
|
||||
//[format["_monitorSpawnedMissions (265): _markerMissionName %1: end of case 1 for mission completion",_markerMissionName]] call GMS_fnc_log;
|
||||
};
|
||||
|
||||
case 2: { // Abort, crate moved.
|
||||
_endMsg = "Crate Removed from Mission Site Before Mission Completion: Mission Aborted";
|
||||
/*
|
||||
["_key",-1],
|
||||
["_missionData",[]],
|
||||
["_endMsg",,""],
|
||||
["_markerData",[]],
|
||||
["_missionLootConfigs",[]],
|
||||
["_isScuba",false],
|
||||
["_endCode",-1]
|
||||
*/
|
||||
//[format["_monitorSpawnedMissions (case 2): _markerConfigs %1 | _endMsg %2",_markerConfigs,_endMsg]] call GMS_fnc_log;
|
||||
[_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs, _isscubamission, 2] call GMS_fnc_endMission;
|
||||
};
|
||||
|
||||
case 3: { // Abort, key asset killed
|
||||
/*
|
||||
["_key",-1],
|
||||
["_missionData",[]],
|
||||
["_endMsg",,""],
|
||||
["_markerData",[]],
|
||||
["_missionLootConfigs",[]],
|
||||
["_isScuba",false],
|
||||
["_endCode",-1]
|
||||
*/
|
||||
//[format["_monitorSpawnedMissions (case 3): _markerConfigs %1 | _assetKilledMsg %2",_markerConfigs,_assetKilledMsg]] call GMS_fnc_log;
|
||||
[_key, _missionData, _assetKilledMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 3] call GMS_fnc_endMission;
|
||||
};
|
||||
|
||||
case 4: {
|
||||
// Used for testing purposes only
|
||||
//[format["Programed mission abort, debug level >= 4"]] call GMS_fnc_log;
|
||||
/*
|
||||
["_key",-1],
|
||||
["_missionData",[]],
|
||||
["_endMsg",,""],
|
||||
["_markerData",[]],
|
||||
["_missionLootConfigs",[]],
|
||||
["_isScuba",false],
|
||||
["_endCode",-1]
|
||||
*/
|
||||
//diag_log format["_monitorSpawnedMissions: (286): _crates = %1 | _mines = %2",_crates,_mines];
|
||||
[_key, _missionData, "DEBUG SETTING >= 4", _markerConfigs, _missionLootConfigs, _isscubamission, 4] call GMS_fnc_endMission;
|
||||
};
|
||||
|
||||
case 5: { // SIMULATED Normal Mission End
|
||||
//diag_log format["_monitorSpawnedMissions: (291): _markerMissionName %1: Normal mission end",_markerMissionName];
|
||||
|
||||
if ((_spawnCratesTiming) in ["atMissionEndGround","atMissionEndAir"]) then
|
||||
{
|
||||
if !(_missionLootBoxes isEqualTo []) then
|
||||
{
|
||||
_crates = [_coords,_missionLootBoxes,_loadCratesTiming,(_missionLootConfigs select spawnCratesTiming), "end", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
}
|
||||
else
|
||||
{
|
||||
_crates = [_coords,[[selectRandom GMS_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,(_missionLootConfigs select spawnCratesTiming), "end", _difficulty] call GMS_fnc_spawnMissionCrates;
|
||||
};
|
||||
|
||||
if (GMS_cleanUpLootChests) then
|
||||
{
|
||||
_objects append _crates;
|
||||
};
|
||||
private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]);
|
||||
//[format["_monitorSpawnedMissions: (312) _crateMoney = %1",_crateMoney]] call GMS_fnc_log;
|
||||
{
|
||||
[_x, _crateMoney] call GMSCore_fnc_setMoney;
|
||||
} forEach _crates;
|
||||
};
|
||||
|
||||
if (_loadCratesTiming isEqualTo "atMissionCompletion") then
|
||||
{
|
||||
private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]);
|
||||
//[format["_monitorSpawnedMissions: (323) _crateMoney = %1",_crateMoney]] call GMS_fnc_log;
|
||||
{
|
||||
[_x] call GMS_fnc_loadMissionCrate;
|
||||
[_x, _crateMoney] call GMSCore_fnc_setMoney;
|
||||
} forEach _crates;
|
||||
//diag_log format["_monitorSpawnedMissions: (329): Loot and Money LOADED _loadCrates Timing = %1 | _crates = %2",_loadCratesTiming,_crates];
|
||||
{
|
||||
[_x] call GMS_fnc_loadMissionCrate;
|
||||
//[_x, missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty])] call GMS_fnc_setMoney;
|
||||
} forEach _lootVehicles;
|
||||
//diag_log format["_monitorSpawnedMissions: (592): Loot LOADED _loadCrates Timing = %1",_loadCratesTiming];
|
||||
};
|
||||
|
||||
_aiVehicles append _lootVehicles; // So these are deleted if no player enters the driver's seat.
|
||||
if (_secureAsset && {(alive _assetSpawned)}) then
|
||||
{
|
||||
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
|
||||
{
|
||||
_assetSpawned setVariable["GMSAnimations",[""],true];
|
||||
[_assetSpawned,""] remoteExec["switchMove",-2];;
|
||||
uiSleep 0.1;
|
||||
_assetSpawned enableAI "ALL";
|
||||
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
|
||||
(group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0];
|
||||
[group _assetSpawned,0] setWaypointPosition [_newPos,0];
|
||||
[group _assetSpawned,0] setWaypointType "MOVE";
|
||||
};
|
||||
|
||||
if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then
|
||||
{
|
||||
[_assetSpawned,""] remoteExec["switchMove",-2];
|
||||
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
|
||||
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
|
||||
};
|
||||
};
|
||||
//diag_log format["_monitorSpawnedMissions: (360):_crates = %1",_crates];
|
||||
|
||||
[_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 5] call GMS_fnc_endMission;
|
||||
//[format["_monitorSpawnedMissions (363): _markerMissionName %1: end of case 1 for mission completion",_markerMissionName]] call GMS_fnc_log;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_missionsList pushBack _el;
|
||||
};
|
||||
};
|
||||
|
||||
GMS_monitoring = false;
|
||||
//GMS_activeMonitorThreads = GMS_activeMonitorThreads - 1;
|
25
@GMS/addons/GMS/Compiles/Missions/fn_paraDropObject.sqf
Normal file
25
@GMS/addons/GMS/Compiles/Missions/fn_paraDropObject.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
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["_pos","_crate",["_crateVisualMarker",true],["_dropHeight", 150]];
|
||||
private _chute = createVehicle ["I_Parachute_02_F", _pos, [], 0, "FLY"];
|
||||
[_chute] call GMS_fnc_protectVehicle;
|
||||
_crate setVariable["chute",_chute];
|
||||
_chute setPos [getPos _chute select 0, getPos _chute select 1, _dropHeight];
|
||||
_crate setPos (getPos _chute);
|
||||
_crate attachTo [_chute, [0,0,0]];
|
||||
if (_crateVisualMarker) then {[_crate,150] spawn GMS_fnc_visibleMarker};
|
||||
_chute
|
||||
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _chancePara = missionNamespace getVariable[format["GMS_chancePara%1",_aiDifficultyLevel],0];
|
||||
_chancePara
|
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIBackpacks.sqf
Normal file
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIBackpacks.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _backpacks = missionNamespace getVariable[format["GMS_backpacks_%1",_aiDifficultyLevel],[]];
|
||||
_backpacks
|
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIHeadgear.sqf
Normal file
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIHeadgear.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _headgear = missionNamespace getVariable [format["GMS_headgear_%1",_aiDifficultyLevel],[]];
|
||||
_headgear
|
21
@GMS/addons/GMS/Compiles/Missions/fn_selectAILoadout.sqf
Normal file
21
@GMS/addons/GMS/Compiles/Missions/fn_selectAILoadout.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
[
|
||||
_missionColor // ["blue","red","green","orange"]
|
||||
] call GMS_fnc_selectAILoadout;
|
||||
|
||||
returns:
|
||||
_lootarray
|
||||
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["_missionColor"];
|
||||
private _weaponList = missionNamespace getVariable [format["GMS_WeaponList_%1",_missionColor],[]];
|
||||
_weaponList
|
17
@GMS/addons/GMS/Compiles/Missions/fn_selectAISidearms.sqf
Normal file
17
@GMS/addons/GMS/Compiles/Missions/fn_selectAISidearms.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"]; //[["_aiDifficultyLevel",selectRandom["Red","Green"]]];
|
||||
|
||||
private _sideArms = missionNamespace getVariable[format["GMS_Pistols_%1",_aiDifficultyLevel],[]];
|
||||
_sideArms
|
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIUniforms.sqf
Normal file
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIUniforms.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _uniforms = missionNamespace getVariable [format["GMS_SkinList_%1",_aiDifficultyLevel],[]];
|
||||
_uniforms
|
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIVests.sqf
Normal file
16
@GMS/addons/GMS/Compiles/Missions/fn_selectAIVests.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _vests = missionNamespace getVariable [format["GMS_vests_%1",_aiDifficultyLevel],[]];
|
||||
_vests
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _chanceHeliPatrol = missionNamespace getVariable[format["GMS_chanceHeliPatrol%1",_aiDifficultyLevel],[]];
|
||||
_chanceHeliPatrol
|
16
@GMS/addons/GMS/Compiles/Missions/fn_selectMissionHelis.sqf
Normal file
16
@GMS/addons/GMS/Compiles/Missions/fn_selectMissionHelis.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _missionHelis = missionNamespace getVariable[format["GMS_patrolHelis%1",_aiDifficultyLevel],[]];
|
||||
_missionHelis
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _noChoppers = missionNamespace getVariable [format["GMS_noPatrolHelis%1",_aiDifficultyLevel],0];
|
||||
_noChoppers
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
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["_aiDifficultyLevel"];
|
||||
private _noPara = missionNamespace getVariable [format["GMS_noPara%1",_aiDifficultyLevel],0];
|
||||
_noPara
|
@ -0,0 +1,15 @@
|
||||
/*
|
||||
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["_diff"];
|
||||
private _count = missionNamespace getVariable [format["GMS_vehCrew_%1",_diff],0];
|
||||
_count
|
18
@GMS/addons/GMS/Compiles/Missions/fn_signalEnd.sqf
Normal file
18
@GMS/addons/GMS/Compiles/Missions/fn_signalEnd.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// Attach a marker of type _marker to an object _crate
|
||||
// by Ghostrider [GRG] based on code from Wicked AI for Arma 2 Dayz Epoch
|
||||
/////////////////////////////////////////////////////
|
||||
/*
|
||||
--------------------------
|
||||
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 ["_start","_maxHeight","_smokeShell","_light","_lightSource"];
|
||||
//params[["_crate",objNull],["_time",60]];
|
||||
|
||||
_this call GMSCore_fnc_visibleMarker;
|
||||
|
45
@GMS/addons/GMS/Compiles/Missions/fn_smokeAtCrates.sqf
Normal file
45
@GMS/addons/GMS/Compiles/Missions/fn_smokeAtCrates.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
GMS_fnc_smokeAtCrates
|
||||
|
||||
Spawns a smoking wreck or object at a specified location and returns the objects spawn (wreck and the particle effects object)
|
||||
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 _wreckSelected = selectRandom ["Land_Wreck_Car2_F","Land_Wreck_Car3_F","Land_Wreck_Car_F","Land_Wreck_Offroad2_F","Land_Wreck_Offroad_F","Land_Tyres_F","Land_Pallets_F","Land_MetalBarrel_F"];
|
||||
params["_pos","_mode",["_maxDist",12],["_wreckChoices",_wreckSelected],["_addFire",false]];
|
||||
private ["_objs","_wreckSelected","_smokeType","_fire","_posFire","_posWreck","_smoke","_dis","_minDis","_maxDis","_closest","_wrecks"];
|
||||
|
||||
_smokeType = if(_addFire) then {"test_EmptyObjectForFireBig"} else {"test_EmptyObjectForSmoke"};
|
||||
|
||||
switch (_mode) do {
|
||||
case "none": {_minDis = 0; _maxDis = 1; _closest = 1;};
|
||||
case "center": {_minDis = 5; _maxDis = 15; _closest = 5;};
|
||||
case "random": {_minDis = 15; _maxDis = 50; _closest = 10;};
|
||||
default {_minDis = 5; _maxDis = 15; _closest = 5;};
|
||||
};
|
||||
_posWreck = [_pos, _minDis, 50, _closest, 0, 20, 0] call BIS_fnc_findSafePos; // find a safe spot near the location passed in the call
|
||||
|
||||
|
||||
// spawn a wreck near the mission center
|
||||
_fire = createVehicle [_wreckSelected, [0,0,0], [], 0, "can_collide"];
|
||||
_fire setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
|
||||
_fire setPos _posWreck;
|
||||
_fire setDir random(360);
|
||||
|
||||
// spawn asmoke or fire source near the wreck and attach it.
|
||||
_smoke = createVehicle [_smokeType, [0,0,0], [], 0, "can_collide"];
|
||||
_smoke setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
|
||||
_smoke setPos _posWreck;
|
||||
_smoke attachto [_fire, [0,0,1.5]];
|
||||
|
||||
_objs = [_fire,_smoke];
|
||||
_objs
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
GMS_fnc_spawnCompositionObjects
|
||||
|
||||
--------------------------
|
||||
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","_objects"];
|
||||
private ["_dam","_sim","_obj"];
|
||||
if (count _center == 2) then {_center pushBack 0};
|
||||
private _newObjs = [];
|
||||
private _hiddenObjs = [];
|
||||
|
||||
{
|
||||
_x params["_className","_relPos","_dir","_booleans"];
|
||||
if ((_booleans) isEqualType []) then // assum simulation and damage settings are defined in the old way as [bool,bool]
|
||||
{
|
||||
_dam = (_booleans) select 0;
|
||||
_sim = (_booleans) select 1;
|
||||
};
|
||||
if ((typeName _booleans) isEqualTo "BOOL") then // assume simulation and damage settings are defined in the new way as , bool, bool, ...
|
||||
{
|
||||
_sim = _x select 4;
|
||||
_dam = _x select 3;
|
||||
};
|
||||
|
||||
private _objPos = _center vectorAdd _relPos;
|
||||
|
||||
if (_className isKindOf "House" && {GMS_hideRocksAndPlants}) then
|
||||
{
|
||||
private _shrubs = nearestTerrainObjects[_objPos,["TREE", "SMALL TREE", "BUSH","FENCE", "WALL","ROCK"], sizeOf _className];
|
||||
if !(_shrubs isEqualTo []) then
|
||||
{
|
||||
_hiddenObjs append _shrubs;
|
||||
{_x hideObjectGlobal true} forEach _shrubs;
|
||||
};
|
||||
};
|
||||
_obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"];
|
||||
|
||||
_obj setPosATL _objPos;
|
||||
[_obj] call GMSCore_fnc_emptyObjectInventory;
|
||||
_newObjs pushback _obj;
|
||||
[_obj, _dir] call GMS_fnc_setDirUp;
|
||||
_obj setVectorUp [0,0,1];
|
||||
_obj enableDynamicSimulation _sim;
|
||||
_obj allowDamage _dam;
|
||||
if ((typeOf _obj) isKindOf "LandVehicle" || {(typeOf _obj) isKindOf "Air" || {(typeOf _obj) isKindOf "Ship"}}) then
|
||||
{
|
||||
[_obj] call GMS_fnc_configureMissionVehicle;
|
||||
};
|
||||
} forEach _objects;
|
||||
|
||||
[_newObjs,_hiddenObjs];
|
||||
|
40
@GMS/addons/GMS/Compiles/Missions/fn_spawnCrate.sqf
Normal file
40
@GMS/addons/GMS/Compiles/Missions/fn_spawnCrate.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
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",["_crateType","Box_NATO_Wps_F"],["_crateDir",0]];
|
||||
|
||||
private _cratePos = _coords findEmptyPosition[15,25,_crateType];
|
||||
_crate = createVehicle [_crateType,_coords,[], 0, "NONE"];
|
||||
_crate setVariable ["LAST_CHECK", 100000];
|
||||
_crate allowDamage false;
|
||||
_crate enableRopeAttach false;
|
||||
[_crate] call GMSCore_fnc_emptyObjectInventory;
|
||||
_crate setPosATL [_coords select 0, _coords select 1, (_coords select 2) + 0.25];
|
||||
[_crate, _crateDir] call GMS_fnc_setDirUp;
|
||||
_crate setVectorUp surfaceNormal getPosATL _crate;
|
||||
|
||||
if ((_coords select 2) < 0 || {surfaceIsWater (_coords)}) then
|
||||
{
|
||||
|
||||
private["_lantern","_bbr","_p1","_p2","_maxHeight"];
|
||||
_light = "#lightpoint" createVehicle (getPos _crate);
|
||||
_light setLightDayLight true;
|
||||
_light setLightBrightness 1.0;
|
||||
_light setLightAmbient [0.0, 1.0, 0.0];
|
||||
_light setLightColor [0.0, 1.0, 0.0];
|
||||
_bbr = boundingBoxReal _crate;
|
||||
_p1 = _bbr select 0;
|
||||
_p2 = _bbr select 1;
|
||||
_maxHeight = abs ((_p2 select 2) - (_p1 select 2));
|
||||
_light attachTo [_crate, [0,0,(_maxHeight + 0.5)]];
|
||||
};
|
||||
_crate;
|
@ -0,0 +1,98 @@
|
||||
/*
|
||||
|
||||
[_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call GMS_fnc_spawnEmplacedWeaponArray;
|
||||
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["_coords",["_missionEmplacedWeapons",[]],["_useRelativePos",true],["_noEmplacedWeapons",0],["_aiDifficultyLevel","red"],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]]];
|
||||
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};
|
||||
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call GMS_fnc_selectAILoadout};
|
||||
if (_sideArms isEqualTo []) then {[_aiDifficultyLevel] call GMS_fnc_selectAISidearms};
|
||||
|
||||
private["_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode","_useRelativePos","_useRelativePos"];
|
||||
_emplacedWeps = [];
|
||||
_emplacedAI = [];
|
||||
_units = [];
|
||||
_abort = false;
|
||||
_pos = [];
|
||||
|
||||
private _emplacedWepData = +_missionEmplacedWeapons; // So we dont overwrite this for the next instance of the mission
|
||||
//diag_log format["_spawnEmplacedWeaponArray(30): _noEmplacedWeapons = %1 | _emplacedWepData = %2",_noEmplacedWeapons,_emplacedWepData];
|
||||
|
||||
// Define _emplacedWepData if not already configured.
|
||||
if (_emplacedWepData isEqualTo []) then
|
||||
{
|
||||
private _wepPositions = [_coords,_noEmplacedWeapons,35,50] call GMS_fnc_findPositionsAlongARadius;
|
||||
{
|
||||
_static = selectRandom GMS_staticWeapons;
|
||||
_emplacedWepData pushback [_static,_x];
|
||||
} forEach _wepPositions;
|
||||
_useRelativePos = false;
|
||||
};
|
||||
|
||||
//diag_log format["_spawnEmplacedWeaponArray(45): _noEmplacedWeapons = %1 | _emplacedWepData = %2",_noEmplacedWeapons,_emplacedWepData];
|
||||
|
||||
{
|
||||
_x params [["_static",""],["_pos",[0,0,0]],["_dir",0]];
|
||||
if (_useRelativePos) then
|
||||
{
|
||||
_pos = _coords vectorAdd _pos;
|
||||
};
|
||||
|
||||
#define configureWaypoints false
|
||||
#define numberAI 1
|
||||
#define areaDimensions [] // an empty array forces the spawnGroup function to skip setup of any waypoint
|
||||
private _empGroup = [_pos,numberAI,_aiDifficultyLevel,areaDimensions,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_spawnGroup;
|
||||
_empGroup setcombatmode "RED";
|
||||
_empGroup setBehaviour "COMBAT";
|
||||
_empGroup setVariable ["soldierType","emplaced"];
|
||||
|
||||
// TODO: recode to use GMS_fnc to create vehicle
|
||||
//private _wep = [_static,_pos] call GMS_fnc_spawnVehicle;
|
||||
/*
|
||||
["_className",""], // Clasname of vehicle to be spawned
|
||||
["_spawnPos",[0,0,0]], // selfevident
|
||||
["_dir",0], // selfevident
|
||||
["_height",0],
|
||||
["_disable",0], // damage value set to this value if less than this value when all crew are dead
|
||||
["_removeFuel",0.2], // fuel set to this value when all crew dead
|
||||
["_releaseToPlayers",true],
|
||||
["_deleteTimer",300],
|
||||
["_vehHitCode",[]],
|
||||
["_vehKilledCode",[]]
|
||||
*/
|
||||
//_wep setVariable["GRG_vehType","emplaced"];
|
||||
//_wep setPosATL _pos;
|
||||
//_wep setdir _dir;
|
||||
|
||||
// TODO: recode to use GMS_fnc to handle this if needed
|
||||
//[_wep,2] call GMS_fnc_configureMissionVehicle;
|
||||
#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 = [_static,_pos,_dir,height,_damage,removeFuel,_releaseToPlayers,GMS_vehicleDeleteTimer,vehHitCode,vehKilledCode] call GMSCore_fnc_spawnPatrolVehicle;
|
||||
_wep setVariable["GMS_vehType","emplaced"];
|
||||
_emplacedWeps pushback _wep;
|
||||
[_wep,_empGroup] call GMSCore_fnc_loadVehicleCrew;
|
||||
//_gunner setVariable["GRG_vehType","emplaced"];
|
||||
_emplacedAI append _units;
|
||||
} forEach _emplacedWepData;
|
||||
|
||||
GMS_monitoredVehicles append _emplacedWeps;
|
||||
|
||||
[_emplacedWeps,_emplacedAI]
|
||||
|
42
@GMS/addons/GMS/Compiles/Missions/fn_spawnMines.sqf
Normal file
42
@GMS/addons/GMS/Compiles/Missions/fn_spawnMines.sqf
Normal file
@ -0,0 +1,42 @@
|
||||
// Spawns mines in a region centered around a specific position and returns an array with the spawned mines for later use, i.e. deletion
|
||||
/*
|
||||
GMS_fnc_spawnMines
|
||||
|
||||
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"];
|
||||
|
||||
#define noMines 50
|
||||
#define mineTypes = ["ATMine","SLAMDirectionalMine"];
|
||||
private _minesPlaced = [];
|
||||
#define minDis 50
|
||||
#define maxDis 150
|
||||
_closest = 5;
|
||||
_dir = 0;
|
||||
_incr = 360/ (noMines/2);
|
||||
for "_i" from 1 to noMines/2 do
|
||||
{
|
||||
for "_j" from 1 to 2 do
|
||||
{
|
||||
private _radius = maxDis - floor(random(maxDis - minDis));
|
||||
private _xpos = (_pos select 0) + sin (_dir) * _radius;
|
||||
private _ypos = (_pos select 1) + cos (_dir) * _radius;
|
||||
private _posMine = [_xpos,_ypos,0];
|
||||
private _mine = createMine ["ATMine", _posMine, [], 0];
|
||||
if (GMSCore_modtype isEqualTo "Epoch") then {_mine setVariable ["LAST_CHECK", (diag_tickTime + 14400)]};
|
||||
_mine setPos _posMine;
|
||||
_minesPlaced pushBack _mine;
|
||||
};
|
||||
_dir = _dir + _incr;
|
||||
};
|
||||
_minesPlaced
|
65
@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAI.sqf
Normal file
65
@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAI.sqf
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
GMS_fnc_spawnMissionAI
|
||||
by Ghostrider [GRG]
|
||||
|
||||
returns an array of the units spawned
|
||||
|
||||
--------------------------
|
||||
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 configureWaypoints true
|
||||
|
||||
params["_coords",["_minNoAI",3],["_maxNoAI",6],["_noAIGroups",0],["_missionGroups",[]],["_aiDifficultyLevel","red"],["_uniforms",[]],["_headGear",GMS_BanditHeadgear],["_vests",[]],["_backpacks",[]],["_weapons",[]],["_sideArms",[]],["_isScubaGroup",false]];
|
||||
//[format["GMS_fnc_spawnMissionAI: _this = %1",_this]] call GMS_fnc_log;
|
||||
private _unitsToSpawn = 0;
|
||||
private _unitsPerGroup = 0;
|
||||
private _ResidualUnits = 0;
|
||||
private _adjusttedGroupSize = 0;
|
||||
private ["_min","_max","_unitsToSpawn","_unitsPerGroup"];
|
||||
|
||||
private _allAI = [];
|
||||
private _abort = false;
|
||||
private _groups = [];
|
||||
#define patrolAreadDimensions [60,60]
|
||||
if !(_missionGroups isEqualTo []) then
|
||||
{
|
||||
{
|
||||
//[format["GMS_fnc_spawnMissionAI: evaluating _missionGroups element %1",_x]] call GMS_fnc_log;
|
||||
_x params["_position","_minAI","_maxAI","_skillLevel"];
|
||||
private _min = [_minAI] call GMSCore_fnc_getIntegerFromRange;
|
||||
private _max = [_maxAI] call GMSCore_fnc_getIntegerFromRange;
|
||||
//[format["GMS_fnc_spawnMissionAI: params returned _minAI %1 | _maxAI %2 _position %3 | _skillLevel %4",_minAI,_maxAI,_position,_skillLevel]] call GMS_fnc_log;
|
||||
_unitsToSpawn = round(_min + round(random(_max - _min)));
|
||||
private _groupPos = _coords vectorAdd _position;
|
||||
private _newGroup = [_groupPos,_unitsToSpawn,_aiDifficultyLevel,patrolAreadDimensions,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call GMS_fnc_spawnGroup;
|
||||
_groups pushBack _newGroup;
|
||||
GMS_monitoredMissionAIGroups pushback _newGroup;
|
||||
_allAI append (units _newGroup);
|
||||
//[format["GMS_fnc_spawnMissionAI: _group %1 with %2 units added | _min %3 | _max %4 | _unitsToSpawn %5",_newGroup, count (units _newGroup),_min,_max,_unitsToSpawn]]call GMS_fnc_log;
|
||||
}forEach _missionGroups;
|
||||
} else {
|
||||
if (_noAIGroups > 0) then
|
||||
{
|
||||
private _min = [_minNoAI] call GMSCore_fnc_getIntegerFromRange;
|
||||
private _max = [_maxNoAI] call GMSCore_fnc_getIntegerFromRange;
|
||||
_unitsToSpawn = round(_min + round(random(_max - _min)));
|
||||
_unitsPerGroup = floor(_unitsToSpawn/_noAIGroups);
|
||||
private _area = [_coords,[200,200]];
|
||||
private _groupPosns = [_coords,_noAIGroups,30,50] call GMS_fnc_findPositionsAlongARadius;
|
||||
{
|
||||
_newGroup = [_x,_unitsPerGroup,_aiDifficultyLevel,patrolAreadDimensions,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call GMS_fnc_spawnGroup;
|
||||
_groups pushBack _newGroup;
|
||||
GMS_monitoredMissionAIGroups pushback _newGroup;
|
||||
_allAI append (units _newGroup);
|
||||
//[format["GMS_fnc_spawnMissionAI: _group %1 with %2 units added",_newGroup, count (units _newGroup)]] call GMS_fnc_log;
|
||||
} forEach _groupPosns;
|
||||
};
|
||||
};
|
||||
//[format["GMS_fnc_spawnMissionAI: _groups = %1 | _allAI = %2",_groups,_allAI]] call GMS_fnc_log;
|
||||
_allAI
|
||||
|
79
@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionCrates.sqf
Normal file
79
@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionCrates.sqf
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
GMS_fnc_spawnMissionCrates
|
||||
|
||||
By Ghostrider [GRG]
|
||||
Copyright 2018
|
||||
|
||||
--------------------------
|
||||
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"
|
||||
|
||||
_fnc_dropMissionCrates = {
|
||||
private ["_crates","_marker","_markers","_GMS_localMissionMarker","_location","_airborneCrates","_curPosCrate"];
|
||||
_crates = _this select 0;
|
||||
_markers = [];
|
||||
|
||||
{
|
||||
[(getPos _x), _x, true, 50] call GMS_fnc_paraDropObject;
|
||||
} forEach _crates;
|
||||
|
||||
_airborneCrates = _crates;
|
||||
while {count _airborneCrates > 0} do
|
||||
{
|
||||
uiSleep 1;
|
||||
{
|
||||
if ((getPos _x) select 2 < 5) then
|
||||
{
|
||||
_airborneCrates = _airborneCrates - [_x];
|
||||
_chute = _x getVariable["chute",objNull];
|
||||
detach _x;
|
||||
deleteVehicle _chute;
|
||||
_location = getPos _x;
|
||||
_GMS_localMissionMarker = [format["crateMarker%1%2",_location select 0, _location select 1],_location,"","","ColorBlack",["mil_dot",[]]];
|
||||
_marker = [_GMS_localMissionMarker] call GMS_fnc_spawnMarker;
|
||||
[_marker,diag_tickTime + 300] call GMSCore_fnc_addToDeletionCue;
|
||||
_curPosCrate = getPos _x;
|
||||
_x setPos [_curPosCrate select 0, _curPosCrate select 1, 0.3];
|
||||
};
|
||||
} forEach _crates;
|
||||
};
|
||||
};
|
||||
|
||||
params[ ["_coords", [0,0,0]], ["_cratesToSpawn",[]], ["_loadCrateTiming","atMissionSpawn"],["_spawnCrateTiming","atMissionSpawn"],["_missionState","start"], ["_difficulty","red"] ];
|
||||
|
||||
|
||||
private _params = ["_coords","_cratesToSpawn","_loadCrateTiming","_spawnCrateTiming","_missionState","_difficulty"];
|
||||
|
||||
if ((count _coords) == 2) then // assume only X and Y offsets are provided
|
||||
{
|
||||
_coords pushback 0;; // calculate the world coordinates
|
||||
};
|
||||
private _cratesSpawned = [];
|
||||
|
||||
{
|
||||
_x params["_crateType","_crateOffset","_lootArray","_lootCounts",["_crateDir",0]];
|
||||
|
||||
private _pos = _coords vectorAdd _crateOffset;
|
||||
private _crate = [_pos,_crateType] call GMS_fnc_spawnCrate;
|
||||
[_crate, _crateDir] call GMS_fnc_setDirUp;
|
||||
_crate setVariable["lootArray",_lootArray];
|
||||
_crate setVariable["lootCounts",_lootCounts];
|
||||
_crate setVariable["difficulty",_difficulty];
|
||||
if (_loadCrateTiming isEqualTo "atMissionSpawn" || {_missionState isEqualTo "end"}) then
|
||||
{
|
||||
[_crate] call GMS_fnc_loadMissionCrate;
|
||||
};
|
||||
_cratesSpawned pushback _crate;
|
||||
}forEach _cratesToSpawn;
|
||||
|
||||
if (_spawnCrateTiming in ["atMissionEndAir","atMissionSpawnAir"]) then
|
||||
{
|
||||
[_cratesSpawned] spawn _fnc_dropMissionCrates;
|
||||
};
|
||||
|
||||
_cratesSpawned
|
58
@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf
Normal file
58
@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
GMS_fnc_spawnMissionHelis
|
||||
*/
|
||||
|
||||
#include "\GMS\Compiles\Init\GMS_defines.hpp"
|
||||
params[
|
||||
["_coords",[0,0,0]],
|
||||
["_noChoppers",0],
|
||||
["_missionHelis",[]],
|
||||
["_difficulty","Red"],
|
||||
["_uniforms",[]],
|
||||
["_headgear",[]],
|
||||
["_vests",[]],
|
||||
["_backpacks",[]],
|
||||
["_weaponList",[]],
|
||||
["_sideArms",[]]
|
||||
];
|
||||
private _helis = [];
|
||||
private _units = [];
|
||||
for "_i" from 0 to (_noChoppers) do
|
||||
{
|
||||
private _spawnPos = _coords getPos[30,random(359)];
|
||||
private _heli = selectRandom _missionHelis;
|
||||
private _noCrew = [_heli,false] call BIS_fnc_crewCount;
|
||||
#define patrolArea [1000,1000]
|
||||
private _crewGroup = [_spawnPos,_noCrew,_difficulty,patrolArea,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms] call GMS_fnc_spawnGroup;
|
||||
_crewGroup setVariable["GMS_group",true];
|
||||
_units append (units _crewGroup);
|
||||
|
||||
#define heliDir 0
|
||||
#define heliHeight 100
|
||||
#define heliRemoveFuel 0.2
|
||||
#define heliDamage 0.5
|
||||
#define vehHitCode [GMS_fnc_vehicleHit]
|
||||
#define vehKilledCode [GMS_fnc_vehicleKilled]
|
||||
private _releaseToPlayers = GMS_allowClaimVehicle;
|
||||
// the function returns the vehicle object spawned (_aircraft)
|
||||
/*
|
||||
params[
|
||||
["_className",""],
|
||||
["_group",grpNull],
|
||||
["_pos",[0,0,0]],
|
||||
["_dir",0],
|
||||
["_height",0],
|
||||
["_disable",0], // damage value set to this value if less than this value when all crew are dead
|
||||
["_removeFuel",0.2], // uel set to this value when all crew dead
|
||||
["_releaseToPlayers",true],
|
||||
["_deleteTimer",300],
|
||||
["_vehHitCode",[]],
|
||||
["_vehKilledCode",[]]
|
||||
];
|
||||
*/
|
||||
|
||||
private _aircraft = [_heli,_crewGroup,_spawnPos,heliDir,heliHeight,heliDamage,heliRemoveFuel,_releaseToPlayers,GMS_vehicleDeleteTimer,vehHitCode,vehKilledCode] call GMSCore_fnc_spawnPatrolAircraft;
|
||||
_helis pushBack _aircraft;
|
||||
};
|
||||
|
||||
[_helis,_units]
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
GMS_fnc_spawnMissionLootVehicles
|
||||
|
||||
by Ghostridere-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","_missionLootVehicles",["_loadCrateTiming","atMissionSpawn"],["_lock",0]];
|
||||
if (count _coords isEqualTo 2) then {_coords pushBack 0};
|
||||
private _vehs = [];
|
||||
{
|
||||
_x params["_vehType","_vehOffset",["_dir",0],"_lootArray","_lootCounts"];
|
||||
_veh = [_vehType, _coords vectorAdd _vehOffset] call GMS_fnc_spawnVehicle;
|
||||
[_veh, _dir] call GMS_fnc_setDirUp;
|
||||
_veh lock _lock;
|
||||
if (_loadCrateTiming isEqualTo "atMissionSpawnGround") then
|
||||
{
|
||||
[_veh,_lootArray,_lootCounts] call GMS_fnc_fillBoxes;
|
||||
_veh setVariable["lootLoaded",true];
|
||||
private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]);
|
||||
[format["GMS_fnc_spawnMissionLootVehicles (29) _crateMoney = %1",_crateMoney]] call GMS_fnc_log;
|
||||
//[_veh,missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty])] call GMS_fnc_setMoney;
|
||||
} else {
|
||||
_veh setVariable["lootArray",_lootArray];
|
||||
_veh setVariable["lootCounts",_lootCounts];
|
||||
_veh setVariable["lootLoaded",false];
|
||||
};
|
||||
_vehs pushback _veh;
|
||||
}forEach _missionLootVehicles;
|
||||
_vehs
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
GMS_fnc_spawnMissionVehiclePatrols
|
||||
by Ghostrider [GRG]
|
||||
returns [] if no groups could be created
|
||||
returns [_AI_Vehicles,_missionAI] otherwise;
|
||||
|
||||
--------------------------
|
||||
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",
|
||||
"_noVehiclePatrols",
|
||||
"_skillAI",
|
||||
"_missionPatrolVehicles"
|
||||
,["_useRelativePos",true],
|
||||
["_uniforms",[]],
|
||||
["_headGear",[]],
|
||||
["_vests",[]],
|
||||
["_backpacks",[]],
|
||||
["_weaponList",[]],
|
||||
["_sideArms",[]],
|
||||
["_isScubaGroup",false],
|
||||
["_crewCount",4]
|
||||
];
|
||||
|
||||
private["_spawnPos"];
|
||||
private _vehicles = [];
|
||||
private _missionAI = [];
|
||||
private _abort = false;
|
||||
private _patrolsThisMission = +_missionPatrolVehicles;
|
||||
//diag_log format["_spawnMissionVehiclePatrols(30): _noVehiclePatrols = %1 | _patrolsThisMission = %2",_noVehiclePatrols,_patrolsThisMission];
|
||||
if (_patrolsThisMission isEqualTo []) then
|
||||
{
|
||||
_useRelativePos = false;
|
||||
private _spawnLocations = [_coords,_noVehiclePatrols,60,100] call GMS_fnc_findPositionsAlongARadius;
|
||||
//diag_log format["_spawnMissionVehiclePatrols (35): _spawnLocations = %1",_spawnLocations];
|
||||
{
|
||||
|
||||
private _veh = [_skillAI] call GMS_fnc_selectPatrolVehicle;
|
||||
[format["GMS_fnc_spawnMissionVehiclePatrols: _veh %1 = %2",_forEachIndex,_veh]] call GMS_fnc_log;
|
||||
_patrolsThisMission pushBack [_veh, _x];
|
||||
//diag_log format["_spawnMissionVehiclePatrols(36): _v = %1 | _patrolsThisMission = %2",_v,_patrolsThisMission];
|
||||
}forEach _spawnLocations;
|
||||
};
|
||||
//diag_log format["_spawnMissionVehiclePatrols(42): _patrolsThisMission = %1",_patrolsThisMission];
|
||||
#define configureWaypoints false
|
||||
{
|
||||
_x params["_vehName","_pos"];
|
||||
if (_useRelativePos) then {_pos = _coords vectorAdd _pos};
|
||||
_pos = _pos findEmptyPosition[0,50,_vehName];
|
||||
#define vehiclePatrolAreaDimensions [500,500]
|
||||
private _maxCrewConfigs = [_vehName,true] call BIS_fnc_crewCount;
|
||||
private _maxCrewBlck = missionNamespace getVariable[format["GMS_vehCrew_%1",_skillAI],3];
|
||||
private _crewCount = _maxCrewBlck min _maxCrewConfigs;
|
||||
#define offMap [-1,-1,1]
|
||||
private _vehGroup = [offMap,_crewCount,_skillAI,vehiclePatrolAreaDimensions,_uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaGroup] call GMS_fnc_spawnGroup;
|
||||
|
||||
_missionAI append (units _vehGroup);
|
||||
GMS_monitoredMissionAIGroups pushBack _vehGroup;
|
||||
|
||||
#define height 0
|
||||
#define dir 0
|
||||
#define maxDamage 0.5
|
||||
#define removeFuel 0.2
|
||||
#define vehHitCode [GMS_fnc_vehicleHit]
|
||||
#define vehKilledCode [GMS_fnc_vehicleKilled]
|
||||
private _damage = 0.5;
|
||||
private _releaseToPlayers = GMS_allowClaimVehicle;
|
||||
|
||||
private _vehicle = [_vehName,_pos,dir,height,maxDamage,removeFuel,_releaseToPlayers,GMS_vehicleDeleteTimer,vehHitCode,vehKilledCode] call GMSCore_fnc_spawnPatrolVehicle;
|
||||
[_vehicle,_vehGroup] call GMSCore_fnc_loadVehicleCrew;
|
||||
_vehGroup setVariable["GMS_group",true];
|
||||
[_vehicle,GMS_forbidenWeapons,GMS_forbidenMagazines] call GMSCore_fnc_disableVehicleWeapons;
|
||||
[_vehicle,GMS_disabledSensors] call GMSCore_fnc_disableVehicleSensors;
|
||||
if (GMS_disableInfrared) then {_vehicle disableTIEquipment true};
|
||||
_vehicles pushback _vehicle;
|
||||
GMS_landVehiclePatrols pushBack _vehicle;
|
||||
} forEach _patrolsThisMission;
|
||||
GMS_landVehiclePatrols append _vehicles;
|
||||
GMS_monitoredVehicles append _vehicles;
|
||||
[_vehicles, _missionAI, _abort];
|
||||
|
49
@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf
Normal file
49
@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
GMS_fnc_spawnPendingMissions
|
||||
|
||||
Purpose:
|
||||
For each mission for which data was precompiled test if the current time is greater than the time at which a mission of that 'color' should be spawned.
|
||||
If so, that mission is initialized and added to the cue of available missions.
|
||||
|
||||
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"
|
||||
// Need to debug for GMS
|
||||
if (GMS_missionsRunning >= GMS_maxSpawnedMissions) exitWith
|
||||
{
|
||||
[format["_spawnNewMissions (18): GMS_maxSpawnedMissions of %1 Reached",GMS_maxSpawnedMissions]] call GMS_fnc_log;
|
||||
};
|
||||
|
||||
{
|
||||
private _missionDescriptors = _x;
|
||||
_missionDescriptors params["_key","_difficulty","_maxMissions","_activeMissions","_tMin","_tMax","_waitTime","_missions"];
|
||||
|
||||
if (_activeMissions < _maxMissions && {diag_tickTime > _waitTime && {GMS_missionsRunning < GMS_maxSpawnedMissions}}) then
|
||||
{
|
||||
// time to reset timers and spawn something.
|
||||
private _missionSelected = selectRandom _missions;
|
||||
//[format["_spawnNewMissions (29): _key %1 | _difficulty %2 | _maxMissions %3 | _activeMissions %4 | _tMin %5 | _tMax %6 | _waitTime %7",_key,_difficulty,_maxMissions,_activeMissions,_tMin,_tMax,_waitTime]] call GMS_fnc_log;
|
||||
private _missionInitialized = [_key,_missionSelected,GMS_dynamicMissionsSpawned] call GMS_fnc_initializeMission;
|
||||
|
||||
if (_missionInitialized == 1) then
|
||||
{
|
||||
GMS_dynamicMissionsSpawned = GMS_dynamicMissionsSpawned + 1;
|
||||
#define waitTime 6
|
||||
#define noActive 3
|
||||
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin));
|
||||
_x set[waitTime, _wt]; // _x here is the _missionCategoryDescriptors being evaluated
|
||||
private _noActiveMissions = _x select noActive;
|
||||
_x set[noActive, _noActiveMissions + 1];
|
||||
};
|
||||
if (_missionInitialized == 2) then
|
||||
{
|
||||
_missions deleteAt (_missions find _missionSelected);
|
||||
};
|
||||
};
|
||||
} forEach GMS_missionData;
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
GMS_fnc_spawnRandomLandscape
|
||||
|
||||
spawn a group of objects in random locations aligned with the radial from the center of the region to the object.
|
||||
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","_missionLandscape",["_min",3],["_max",15],["_nearest",1]];
|
||||
|
||||
#define maxObjectSpawnRadius 25
|
||||
#define minObjectSpawnRadius 15
|
||||
private _objectSpawnRange = maxObjectSpawnRadius - minObjectSpawnRadius;
|
||||
|
||||
private _newObjs = [];
|
||||
private _hiddenObjs = [];
|
||||
|
||||
{
|
||||
private _spawnPos = _coords getPos[minObjectSpawnRadius + random(maxObjectSpawnRadius), random(359)];
|
||||
private _objClassName = _x;
|
||||
if (_objClassName isKindOf "House" && {GMS_hideRocksAndPlants}) then
|
||||
{
|
||||
private _shrubs = nearestTerrainObjects[_spawnPos,["TREE", "SMALL TREE", "BUSH","FENCE", "WALL","ROCK"], sizeOf _objClassName];
|
||||
if !(_shrubs isEqualTo []) then
|
||||
{
|
||||
_hiddenObjs append _shrubs;
|
||||
{_x hideObjectGlobal true} forEach _shrubs;
|
||||
};
|
||||
};
|
||||
private _obj = createVehicle[_x, _spawnPos, [], 2];
|
||||
_obj allowDamage true;
|
||||
_obj enableSimulation false;
|
||||
_obj enableSimulationGlobal false;
|
||||
_obj enableDynamicSimulation false;
|
||||
_obj setDir (_obj getRelDir _coords);
|
||||
_newObjs pushback _obj;
|
||||
sleep 0.1;
|
||||
} forEach _missionLandscape;
|
||||
|
||||
[_newObjs,_hiddenObjs]
|
23
@GMS/addons/GMS/Compiles/Missions/fn_spawnSDVPatrol.sqf
Normal file
23
@GMS/addons/GMS/Compiles/Missions/fn_spawnSDVPatrol.sqf
Normal 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["_SDV","_pos","_difficulty","_numberAI","_patrolRadius","_respawnTime"];
|
||||
#define SDVpatrolAreadDimensions [50,50]
|
||||
// params[["_pos",[0,0,0]], ["_numbertospawn",0], ["_skillLevel","red"], ["_configureWaypoints",true], ["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false]];
|
||||
private _backpacks = [];
|
||||
private _sidearms = [];
|
||||
private _group = [_pos,_numberAI,_difficulty,SDVpatrolAreadDimensions,GMS_UMS_uniforms,GMS_UMS_headgear,GMS_UMS_vests, _backpacks,GMS_UMS_weapons,_sidearms,true] call GMS_fnc_spawnGroup;
|
||||
private _vehicle = [[_pos select 0, _pos select 1,0],[_pos select 0, _pos select 1,0],_vehType,_patrolRadius - 2,_patrolRadius,_group] call GMS_fnc_spawnVehiclePatrol;
|
||||
private _diveDepth = 0.5 * ([_pos] call GMS_fnc_findWaterDepth);
|
||||
(driver _vehicle) swiminDepth (_diveDepth select 2);
|
||||
|
||||
_group
|
23
@GMS/addons/GMS/Compiles/Missions/fn_spawnScubaGroup.sqf
Normal file
23
@GMS/addons/GMS/Compiles/Missions/fn_spawnScubaGroup.sqf
Normal 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"
|
||||
#define configureWaypoints true
|
||||
#define isScubaGroup true
|
||||
#define UMS_backpacks []
|
||||
#define UMS_sidearms []
|
||||
#define scubaPatrolAreaDimensions [25,25]
|
||||
params["_group","_pos",["_skillLevel","red"],["_numUnits",6],["_patrolRadius",15]];
|
||||
// private _group = [_pos,_numberAI,_difficulty,configureWaypoints,GMS_UMS_uniforms,GMS_UMS_headgear,GMS_UMS_vests,[],GMS_UMS_weapons,_sideArms,true] call GMS_fnc_spawnGroup;
|
||||
|
||||
private _group = [_pos,_numUnits,_skillLevel, scubaPatrolAreaDimensions, GMS_UMS_uniforms, GMS_UMS_headgear, GMS_UMS_vests, [], GMS_UMS_weapons, [], isScubaGroup] call GMS_fnc_spawnGroup;
|
||||
|
||||
|
||||
|
25
@GMS/addons/GMS/Compiles/Missions/fn_spawnSimpleObjects.sqf
Normal file
25
@GMS/addons/GMS/Compiles/Missions/fn_spawnSimpleObjects.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
GMS_fnc_spawnSimpleObjects
|
||||
|
||||
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","_objects","_relative"];
|
||||
private _spawnedObjects = [];
|
||||
{
|
||||
_x params["_className","_relPos","_dir","_booleans"];
|
||||
private _objPos = _center vectorAdd _relPos;
|
||||
private _obj = createSimpleObject [_className,ATLToASL _objPos];
|
||||
_obj setDir _dir;
|
||||
_obj setVectorUp [0,0,1];
|
||||
_spawnedObjects pushBack _obj;
|
||||
} forEach _objects;
|
||||
_spawnedObjects
|
20
@GMS/addons/GMS/Compiles/Missions/fn_spawnSurfacePatrol.sqf
Normal file
20
@GMS/addons/GMS/Compiles/Missions/fn_spawnSurfacePatrol.sqf
Normal 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"
|
||||
|
||||
params["_SDV","_pos","_difficulty","_numAI","_patrolRadius","_respawnTime"];
|
||||
#define surfacePatrolAreaDimensions [150,150]
|
||||
private _group = [_pos,_numAI,_difficulty,surfacePatrolAreaDimensions] call GMS_fnc_spawnGroup;
|
||||
private _vehicle = [_pos,_pos,_vehType,_minDis,_maxDis,_group] call GMS_fnc_spawnVehiclePatrol;
|
||||
|
||||
_vehicle
|
||||
|
106
@GMS/addons/GMS/Compiles/Units/GMS_fnc_handlePlayerUpdates.sqf
Normal file
106
@GMS/addons/GMS/Compiles/Units/GMS_fnc_handlePlayerUpdates.sqf
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
calculate a reward player for AI Kills in crypto.
|
||||
Code fragment adapted from VEMF
|
||||
call as [_unit,_killer] call GMS_fnc_handlePlayerUpdates;
|
||||
--------------------------
|
||||
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"
|
||||
|
||||
_fn_doUpdates = {
|
||||
params["_player","_unit"];
|
||||
private _lastkill = _player getVariable["GMS_lastkill",diag_tickTime];
|
||||
_player setVariable["GMS_lastkill",diag_tickTime];
|
||||
private _kills = (_player getVariable["GMS_kills",0]) + 1;
|
||||
if ((diag_tickTime - _lastkill) < 240) then
|
||||
{
|
||||
_player setVariable["GMS_kills",_kills];
|
||||
} else {
|
||||
_player setVariable["GMS_kills",0];
|
||||
};
|
||||
|
||||
if (toLower(GMSCore_modtype) isEqualTo "epoch") then
|
||||
{
|
||||
#define maxReward 2500
|
||||
private _distanceBonus = floor((_unit distance _player)/100);
|
||||
private _killstreakBonus = 3 * (_player getVariable["GMS_kills",0]);
|
||||
private _reward = 25 + _distanceBonus + _killstreakBonus;
|
||||
[_player,_reward ] call GMSCore_fnc_giveTakeCrypto;
|
||||
[_player, 5] call GMSCore_fnc_setKarma;
|
||||
//if (isNil "GMS_fnc_killedMessages") then {diag_log format["blckeagls: GMS_fnc_killedMessages not defined"]};
|
||||
if (GMS_useKillScoreMessage) then
|
||||
{
|
||||
[["showScore",[_reward,"",_kills],""],[_player]] call GMS_fnc_messageplayers;
|
||||
// params["_unit","_killer","_money","_respect","_killStreak"];
|
||||
//[_unit,_player,_reward,5] call GMS_fnc_killedMessages;
|
||||
};
|
||||
|
||||
// SUggestion to update Epoch player stats from He-Man
|
||||
[_killer, "AIKills", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
if (toLower(GMSCore_modtype) isEqualTo "exile") then
|
||||
{
|
||||
private _distanceBonus = floor((_unit distance _player)/100);
|
||||
private _killstreakBonus = 3 * (_player getVariable["GMS_kills",0]);
|
||||
private _respectGained = 25 + _distanceBonus + _killstreakBonus;
|
||||
private _score = _player getVariable ["ExileScore", 0];
|
||||
_score = _score + (_respectGained);
|
||||
_player setVariable ["ExileScore", _score];
|
||||
format["setAccountScore:%1:%2", _score,getPlayerUID _player] call ExileServer_system_database_query_fireAndForget;
|
||||
private _newKillerFrags = _player getVariable ["ExileKills", 0];
|
||||
_newKillerFrags = _newKillerFrags + 1;
|
||||
_player setVariable ["ExileKills", _newKillerFrags];
|
||||
format["addAccountKill:%1", getPlayerUID _player] call ExileServer_system_database_query_fireAndForget;
|
||||
_player call ExileServer_object_player_sendStatsUpdate;
|
||||
if (GMS_useKillScoreMessage) then
|
||||
{
|
||||
[["showScore",[_respectGained,_distanceBonus,_kills]], [_player]] call GMS_fnc_messageplayers;
|
||||
};
|
||||
};
|
||||
if (toLower(GMSCore_modtype) isEqualTo "default") then
|
||||
{
|
||||
private _newKillerFrags = _player getVariable ["ExileKills", 0];
|
||||
_newKillerFrags = _newKillerFrags + 1;
|
||||
_player setVariable ["ExileKills", _newKillerFrags,true];
|
||||
if (GMS_useKillScoreMessage) then
|
||||
{
|
||||
[["showScore",[_respectGained,_distanceBonus,_kills]], [_player]] call GMS_fnc_messageplayers;
|
||||
};
|
||||
};
|
||||
if (GMS_useKillMessages) then
|
||||
{
|
||||
private _weapon = currentWeapon _player;
|
||||
_killstreakMsg = format[" %1X KILLSTREAK",_kills];
|
||||
private["_message"];
|
||||
if (GMS_useKilledAIName) then
|
||||
{
|
||||
_message = format["[blck] %2: killed by %1 from %3m",name _player,name _unit,round(_unit distance _player)];
|
||||
}else{
|
||||
_message = format["[blck] %1 killed with %2 from %3 meters",name _player,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _player)];
|
||||
};
|
||||
_message =_message + _killstreakMsg;
|
||||
[["aikilled",_message,"victory"],allPlayers] call GMS_fnc_messageplayers;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
params["_unit","_killer"];
|
||||
private _killerType = _killer call BIS_fnc_objectType; // anObject call BIS_fnc_objectType
|
||||
|
||||
if ((_killerType select 0 )isEqualTo "Vehicle") then
|
||||
{
|
||||
{
|
||||
_player = _killer;
|
||||
if (getPlayerUID(_x) isEqualTo getPlayerUID(_killer)) exitWith {
|
||||
[_x,_unit] call _fn_doUpdates;
|
||||
};
|
||||
|
||||
}forEach (crew (vehicle _killer));
|
||||
} else {
|
||||
[_killer,_unit] call _fn_doUpdates;
|
||||
};
|
||||
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
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["_character","_center","_characterBuildingConfigs"];
|
||||
|
||||
private ["_obj"];
|
||||
if !(_characterBuildingConfigs isEqualTo []) then
|
||||
{
|
||||
_obj = createVehicle[(_characterBuildingConfigs select 0),_center vectorAdd (_characterBuildingConfigs select 1),[],0,"CAN_COLLIDE"];
|
||||
_obj setDir (_characterBuildingConfigs select 2);
|
||||
_obj allowDamage true;
|
||||
_obj enableDynamicSimulation true;
|
||||
_character setPosATL (_obj buildingPos (round(random((count ([_obj] call BIS_fnc_buildingPositions)) -1))));
|
||||
};
|
||||
_obj
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
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"
|
||||
|
||||
private["_missionType","_wasRunover","_launcher","_legal"];
|
||||
params["_unit","_killer"];
|
||||
_legal = true;
|
||||
if (vehicle _killer == _killer) exitWith {true};
|
||||
|
||||
// Player not in vehicle, no further checks needed.
|
||||
if (_killer == (driver (vehicle _killer))) then // If the killer is also the driver then the killer must have run the AI over
|
||||
{
|
||||
if(GMS_RunGear && {!((vehicle _killer) isKindOf "Air")}) then // assume aircraft are too fragile to kill AI by moving close to ground
|
||||
{
|
||||
[_unit] call GMS_fnc_removeAllAIgear;
|
||||
if (GMS_VK_RunoverDamage) then
|
||||
{//apply vehicle damage
|
||||
[vehicle _killer] call GMS_fnc_applyVehicleDamagePenalty;
|
||||
[_killer] call GMS_fnc_msgIED;
|
||||
};
|
||||
_legal = false;
|
||||
};
|
||||
} else {
|
||||
if ( GMS_VK_GunnerDamage ) then
|
||||
{
|
||||
if ((typeOf (vehicle _killer)) in GMS_forbidenVehicles || {(currentWeapon _killer) in GMS_forbidenVehicleGuns}) then
|
||||
{
|
||||
if (GMS_VK_Gear) then {[_unit] call GMS_fnc_removeAllAIgear;};
|
||||
[vehicle _killer] call GMS_fnc_applyVehicleDamagePenalty;
|
||||
[_killer] call GMS_fnc_msgIED;
|
||||
_legal = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_legal
|
44
@GMS/addons/GMS/Compiles/Units/GMS_fnc_spawnCharacter.sqf
Normal file
44
@GMS/addons/GMS/Compiles/Units/GMS_fnc_spawnCharacter.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
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["_coords","_charConfigs"];
|
||||
private["_char","_charGroup"];
|
||||
_charConfigs params["_classname","_posn","_dir","_simDamg","_animations","_headgear","_uniforms"];
|
||||
|
||||
_charGroup = createGroup [GMSCore_side, true];
|
||||
_char = _charGroup createUnit [_classname,[0,0,0], [], 0, "NONE"];
|
||||
_char setCaptive true;
|
||||
if (count _headgear > 0) then
|
||||
{
|
||||
_char addHeadgear (selectRandom(_headgear));
|
||||
};
|
||||
if (count _uniforms > 0) then
|
||||
{
|
||||
_char forceAddUniform selectRandom(_uniforms);
|
||||
};
|
||||
_posn = (_coords vectorAdd _posn);
|
||||
_char setPos [_posn select 0, _posn select 1, 0];
|
||||
|
||||
if (GMSCore_modtype isEqualTo "Epoch") then {_char setVariable ["LAST_CHECK",28800,true]};
|
||||
_char setPos (_posn);
|
||||
_char setDir (_dir);
|
||||
removeAllWeapons _char;
|
||||
_char setVariable ["BIS_enableRandomization", false];
|
||||
_char setVariable ["BIS_fnc_animalBehaviour_disable", true];
|
||||
_char disableAI "ALL";
|
||||
_char enableAI "ANIM";
|
||||
_char enableAI "MOVE";
|
||||
_char allowDamage true;
|
||||
_char enableSimulationGlobal true;
|
||||
_char setVariable["GMSAnimations",_animations,true];
|
||||
_char setUnitPos "UP";
|
||||
|
||||
_char
|
22
@GMS/addons/GMS/Compiles/Units/GMS_fnc_spawnHostage.sqf
Normal file
22
@GMS/addons/GMS/Compiles/Units/GMS_fnc_spawnHostage.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
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["_coords","_hostageConfigs"];
|
||||
private["_hostage","_building"];
|
||||
_hostage = [_coords,_hostageConfigs] call GMS_fnc_spawnCharacter;
|
||||
_hostage remoteExec["GMS_fnc_initHostage", -2, true];
|
||||
_hostage setVariable["assetType",1,true];
|
||||
_building = [_hostage,_coords,_hostageConfigs select 7] call GMS_fnc_placeCharacterInBuilding;
|
||||
[_hostage,_building]
|
||||
|
||||
|
||||
|
23
@GMS/addons/GMS/Compiles/Units/GMS_fnc_spawnLeader.sqf
Normal file
23
@GMS/addons/GMS/Compiles/Units/GMS_fnc_spawnLeader.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
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["_coords","_leaderConfigs"];
|
||||
private["_leader","_building"];
|
||||
_leader = [_coords, _leaderConfigs] call GMS_fnc_spawnCharacter;
|
||||
_leader remoteExec["GMS_fnc_initLeader", -2, true];
|
||||
_leader setVariable["assetType",2,true];
|
||||
_leader setVariable["endAnimation",["Acts_CivilShocked_1"],true];
|
||||
_building = [_leader,_coords,_leaderConfigs select 7] call GMS_fnc_placeCharacterInBuilding;
|
||||
[_leader,_building]
|
||||
|
||||
|
||||
|
38
@GMS/addons/GMS/Compiles/Units/fn_cleanupAliveAI.sqf
Normal file
38
@GMS/addons/GMS/Compiles/Units/fn_cleanupAliveAI.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Delete alive AI.
|
||||
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"
|
||||
|
||||
for "_i" from 1 to (count GMS_liveMissionAI) do {
|
||||
if ((_i) <= count GMS_liveMissionAI) then {
|
||||
_units = GMS_liveMissionAI deleteAt 0;
|
||||
_units params ["_missionCenter","_unitsarr","_timer"];
|
||||
|
||||
if (diag_tickTime > _timer) then
|
||||
{
|
||||
private _nearplayer = [_missionCenter,800] call GMS_fnc_nearestPlayers;
|
||||
if (_nearPlayer isEqualTo []) then
|
||||
{
|
||||
{
|
||||
private _unit = _x;
|
||||
if ((alive _unit) && {!(isNull objectParent _unit)}) then {
|
||||
[objectParent _unit] call GMS_fnc_deleteAIvehicle;
|
||||
};
|
||||
[_unit] call GMS_fnc_deleteAI;
|
||||
} forEach _unitsarr;
|
||||
} else {
|
||||
GMS_liveMissionAI pushback _units;
|
||||
};
|
||||
} else {
|
||||
GMS_liveMissionAI pushback _units;
|
||||
};
|
||||
};
|
||||
};
|
29
@GMS/addons/GMS/Compiles/Units/fn_deleteAI.sqf
Normal file
29
@GMS/addons/GMS/Compiles/Units/fn_deleteAI.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Delete a unit.
|
||||
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"
|
||||
|
||||
private["_ai","_group"];
|
||||
params["_unit"];
|
||||
|
||||
{
|
||||
_unit removeAllEventHandlers _x;
|
||||
}forEach ["reloaded"];
|
||||
{
|
||||
_unit removeAllMPEventHandlers _x;
|
||||
} forEach ["MPKilled","MPHit"];
|
||||
_group = (group _unit);
|
||||
deleteVehicle _unit;
|
||||
if (count units _group isEqualTo 0) then
|
||||
{
|
||||
deletegroup _group;
|
||||
};
|
||||
|
14
@GMS/addons/GMS/Compiles/Units/fn_removeAllAIgear.sqf
Normal file
14
@GMS/addons/GMS/Compiles/Units/fn_removeAllAIgear.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
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["_ai"];
|
||||
{deleteVehicle _x}forEach nearestObjects [(getPosATL _ai), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 3]; //Adapted from the AI cleanup logic by KiloSwiss
|
||||
[_ai] call GMSCore_fnc_unitRemoveAllGear;
|
29
@GMS/addons/GMS/Compiles/Units/fn_spawnParaUnits.sqf
Normal file
29
@GMS/addons/GMS/Compiles/Units/fn_spawnParaUnits.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
GMS_fnc_spawnParaUnits
|
||||
|
||||
Author: Ghostrider [GRG]
|
||||
Inspiration: blckeagls / A3EAI / VEMF / IgiLoad / SDROP
|
||||
License: Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
|
||||
--------------------------
|
||||
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"
|
||||
// Acomodate case where para are spawned over water.
|
||||
params["_pos","_numAI","_skilllevel",["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weapons",[]],["_sideArms",[]],["_isScuba",false]];
|
||||
if (_numAI < 1) exitWith {grpNull};
|
||||
#define offMap [0,0,0]
|
||||
#define patrolAreadDimensions [50,50]
|
||||
private _paraGroup = [offMap,_numAI,_skilllevel,patrolAreadDimensions,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScuba] call GMS_fnc_spawnGroup;
|
||||
if !(isNull _paraGroup) then
|
||||
{
|
||||
[_paraGroup,_pos] call GMSCore_fnc_dropParatroops;
|
||||
GMS_monitoredMissionAIGroups pushback _paraGroup;
|
||||
};
|
||||
[format["GMS_fnc_spawnParaUnits: _paragroup = %1",_paraGroup]] call GMS_fnc_log;
|
||||
_paraGroup
|
130
@GMS/addons/GMS/Compiles/Units/fn_spawnUnit.sqf
Normal file
130
@GMS/addons/GMS/Compiles/Units/fn_spawnUnit.sqf
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
GMS_fnc_spawnUnit
|
||||
Original Code by blckeagls
|
||||
Modified 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"
|
||||
|
||||
private ["_i","_weap","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"];
|
||||
|
||||
params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", []],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false],["_garrison",false]];
|
||||
|
||||
if (_weaponList isEqualTo []) then {_weaponList = [_skillLevel] call GMS_fnc_selectAILoadout;[format["Weaponlist for unit set to %1",_weaponList],"warning"] call GMS_fnc_log;};
|
||||
if (_sideArms isEqualTo []) then {_sideArms = [_skillLevel] call GMS_fnc_selectAISidearms};
|
||||
if (_uniforms isEqualTo []) then {_uniforms = [_skillLevel] call GMS_fnc_selectAIUniforms;[format["Uniforms for unit set to %1",_uniforms],"warning"] call GMS_fnc_log;};
|
||||
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};
|
||||
|
||||
if (isNull _aiGroup) exitWith {["NULL-GROUP Provided to _fnc_spawnUnit"] call GMS_fnc_log};
|
||||
|
||||
_unit = ObjNull;
|
||||
GMSCore_unitType createUnit [_pos, _aiGroup, "_unit = this", GMS_baseSkill, "COLONEL"];
|
||||
|
||||
//private _tempPos = _pos findEmptyPosition [0.1, 3, typeOf _unit];
|
||||
|
||||
//if !(_tempPos isEqualTo []) then {_unit setPos _tempPos};
|
||||
|
||||
[_unit] call GMS_fnc_removeGear;
|
||||
if (_scuba) then
|
||||
{
|
||||
_unit swiminDepth (([_pos] call GMS_fnc_findWaterDepth) / 2);
|
||||
};
|
||||
|
||||
//Sets AI Tactics
|
||||
_unit enableAI "ALL";
|
||||
if(_garrison) then
|
||||
{
|
||||
_unit disableAI "PATH";
|
||||
};
|
||||
_unit allowDammage true;
|
||||
_unit setBehaviour "COMBAT";
|
||||
_unit setunitpos "AUTO";
|
||||
|
||||
if !(_uniforms isEqualTo []) then {_unit forceAddUniform (selectRandom _uniforms)};
|
||||
if !(_headGear isEqualTo []) then {_unit addHeadgear (selectRandom _headGear)};
|
||||
if !(_vests isEqualTo []) then {_unit addVest (selectRandom _vests)};
|
||||
if !(_weaponList isEqualTo []) then {
|
||||
_weap = selectRandom _weaponList;
|
||||
_unit addWeaponGlobal _weap;
|
||||
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
|
||||
_unit addMagazines[selectRandom _ammochoices,3];
|
||||
if (random 1 < GMS_chanceMuzzle) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 101] call BIS_fnc_compatibleItems))}; // muzzles
|
||||
if (random 1 < GMS_chanceOptics) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 201] call BIS_fnc_compatibleItems))}; // optics
|
||||
if (random 1 < GMS_chancePointer) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 301] call BIS_fnc_compatibleItems))}; // pointers
|
||||
if (random 1 < GMS_chanceUnderbarrel) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 302] call BIS_fnc_compatibleItems))}; // underbarrel
|
||||
if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then
|
||||
{
|
||||
_unit addMagazine "1Rnd_HE_Grenade_shell";
|
||||
};
|
||||
};
|
||||
if !(_sideArms isEqualTo []) then
|
||||
{
|
||||
_weap = selectRandom _sideArms;
|
||||
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
|
||||
_unit addMagazines [selectRandom _ammoChoices, 2];
|
||||
_unit addWeaponGlobal _weap;
|
||||
};
|
||||
if !(GMS_ConsumableItems isEqualTo []) then
|
||||
{
|
||||
for "_i" from 1 to (1+floor(random(4))) do
|
||||
{
|
||||
_unit addItem (selectRandom GMS_ConsumableItems);
|
||||
};
|
||||
};
|
||||
if !(GMS_specialItems isEqualTo []) then
|
||||
{
|
||||
// Add First Aid or Grenade 50% of the time
|
||||
if (round(random 10) <= 5) then
|
||||
{
|
||||
_unit addItem selectRandom GMS_specialItems;
|
||||
};
|
||||
};
|
||||
|
||||
if !(_backpacks isEqualTo []) then
|
||||
{
|
||||
if (random (1) < GMS_chanceBackpack) then
|
||||
{
|
||||
_unit addBackpack selectRandom _backpacks;
|
||||
} else {
|
||||
// Only add rounds for the specified launcher if a backpack was equiped ?
|
||||
if !(_Launcher isEqualTo "none") then
|
||||
{
|
||||
_unit addBackpack (selectRandom GMS_backpacks);
|
||||
_unit addWeaponGlobal _launcher;
|
||||
_unit setVariable["Launcher",[_launcher,[]]];
|
||||
private _mags = getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines");
|
||||
private _rnds = [];
|
||||
for "_i" from 1 to 3 do
|
||||
{
|
||||
private _mag = selectRandom _mags;
|
||||
_unit addItemToBackpack _mag;
|
||||
_rnds pushBack _mag;
|
||||
};
|
||||
_unit setVariable["Launcher",[_launcher,_rnds]];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if(sunOrMoon < 0.2 && {GMS_useNVG})then
|
||||
{
|
||||
_unit addWeapon selectRandom GMS_NVG;
|
||||
_unit setVariable ["hasNVG", true];
|
||||
}
|
||||
else
|
||||
{
|
||||
_unit setVariable ["hasNVG", false];
|
||||
};
|
||||
|
||||
_unit addWeapon selectRandomWeighted["",4,"Binocular",3,"Rangefinder",1];
|
||||
|
||||
_unit
|
||||
|
||||
|
18
@GMS/addons/GMS/Compiles/Units/fn_unitHit.sqf
Normal file
18
@GMS/addons/GMS/Compiles/Units/fn_unitHit.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
By Ghostrider [GRG]
|
||||
|
||||
Handles the case where a unit is hit.
|
||||
|
||||
--------------------------
|
||||
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 !(local (_this select 0)) exitWith {};
|
||||
params ["_unit", "_source", "_damage", "_instigator"];
|
||||
//[format["GMS_fnc_unitHit: _unit = %1 | _source %2 | vehicle _source %3 | _instigator %4",_unit,_source, vehicle _source, _instigator]] call GMS_fnc_log;
|
||||
if !(isPlayer _instigator) exitWith {};
|
||||
[_unit,_instigator] call GMS_fnc_alertVehicles;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user