2023-09-23 14:05:31 +00:00
|
|
|
/*
|
|
|
|
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;
|
2023-10-03 00:05:16 +00:00
|
|
|
|
|
|
|
private "_group";
|
|
|
|
_group = [
|
2023-09-23 14:05:31 +00:00
|
|
|
_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;
|
|
|
|
//[format["GMS_fnc_spawnGroup: _group = %1",_group]] call GMS_fnc_log;
|
2023-10-03 00:05:16 +00:00
|
|
|
_group setVariable["GMS_difficulty",_skillLevel];
|
|
|
|
|
2023-09-23 14:05:31 +00:00
|
|
|
[_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;
|
2023-10-03 00:05:16 +00:00
|
|
|
|
|
|
|
private _veh = vehicle (leader _group);
|
|
|
|
private _type = [_veh] call BIS_fnc_objectType;
|
|
|
|
_type params["_typeObj","_subtypeObj"];
|
|
|
|
//diag_log format["GMS_fnc_spawnGroup: _veh %3 | _typeObj %1 | _subTypeObj %2",_typeObj,_subtypeObj,_veh];
|
|
|
|
|
|
|
|
private "_waypointClass";
|
|
|
|
switch (_typeObj) do {
|
|
|
|
case "Soldier": {_waypointClass =_typeObj};
|
|
|
|
case "Vehicle": {_waypointClass = _subtypeObj};
|
|
|
|
case "VehicleAutonomous": {_waypointClass = _subtypeObj};
|
|
|
|
default {_waypointClass = "Soldier"};
|
2023-09-23 14:05:31 +00:00
|
|
|
};
|
2023-10-03 00:05:16 +00:00
|
|
|
/*
|
|
|
|
params[
|
|
|
|
["_group",grpNull], // group for which to configure / initialize waypoints
|
|
|
|
["_blackListed",[]], // areas to avoid within the patrol region
|
|
|
|
["_patrolAreaMarker",""], // a marker or array defining the patrol area center, size and shape
|
|
|
|
["_timeout",300],
|
|
|
|
["_garrisonChance",0], // chance that an infantry group will garison an building of type house - ignored for vehicles.
|
|
|
|
["_type",GMS_infrantryPatrol], // "infantry","vehicle","air","submersible", "staticweapon"
|
|
|
|
["_deletemarker",false]
|
|
|
|
];
|
|
|
|
*/
|
|
|
|
|
|
|
|
if !(_areaDimensions isEqualTo []) then {[_group,[],[_pos,_areaDimensions],-1,0,_waypointClass,true] call GMSCore_fnc_initializeWaypointsAreaPatrol};
|
2023-09-23 14:05:31 +00:00
|
|
|
|
|
|
|
_group selectLeader ((units _group) select 0);
|
|
|
|
//[format["GMS_fnc_spawnGroup: _group = %1",_group]] call GMS_fnc_log;
|
|
|
|
_group
|
|
|
|
|