2015-08-29 06:09:50 +00:00
|
|
|
/*
|
2015-09-05 03:40:00 +00:00
|
|
|
DMS_fnc_SpawnAIGroup
|
2015-08-29 06:09:50 +00:00
|
|
|
Created by eraser1
|
|
|
|
Based off of WAI
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
[
|
|
|
|
_pos, // Position of AI
|
|
|
|
_count, // Number of AI
|
2015-09-10 02:05:46 +00:00
|
|
|
_difficulty, // AI Difficulty: "random","hardcore","difficult","moderate", or "easy"
|
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
|
|
|
_class, // AI Class: "random","assault","MG","sniper" or "unarmed" OR [_class,_launcher]
|
2015-09-01 06:24:42 +00:00
|
|
|
_side // Only "bandit" is supported atm
|
2015-09-05 03:40:00 +00:00
|
|
|
] call DMS_fnc_SpawnAIGroup;
|
2015-08-29 19:46:07 +00:00
|
|
|
|
|
|
|
Returns AI Group
|
2015-08-29 06:09:50 +00:00
|
|
|
*/
|
2015-09-10 02:05:46 +00:00
|
|
|
private ["_OK", "_pos", "_count", "_difficulty", "_class", "_side", "_pos_x", "_pos_y", "_pos_z", "_launcher", "_unit", "_client"];
|
2015-08-29 19:46:07 +00:00
|
|
|
|
|
|
|
_OK = params
|
|
|
|
[
|
|
|
|
["_pos",[0,0,0],[[]],[3]],
|
|
|
|
["_count",0,[0]],
|
|
|
|
["_difficulty","random",[""]],
|
2015-09-10 02:05:46 +00:00
|
|
|
["_class","random",[""]],
|
2015-08-29 19:46:07 +00:00
|
|
|
["_side","bandit",[""]]
|
|
|
|
];
|
|
|
|
|
|
|
|
if (!_OK) then
|
|
|
|
{
|
|
|
|
diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with invalid parameters: %1",_this];
|
|
|
|
};
|
2015-08-29 06:09:50 +00:00
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
_pos_x = _pos select 0;
|
|
|
|
_pos_y = _pos select 1;
|
|
|
|
_pos_z = _pos select 2;
|
2015-08-29 06:09:50 +00:00
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
|
Readme changes, new debug fnc, fixes, tweaks
Created disclaimer for DMS. Now mentioning that HC for DMS isn't that
good.
Some structure stuff in readme (let's see if it works lol)
* **NEW CONFIG VALUE: DMS_Use_Map_Config**
* You can now overwrite "main config values" with map-specific config
values located in the new "map_configs" folder. This should allow you to
use one DMS PBO if you have multiple servers with different maps.
Included examples for Altis, Bornholm, Esseker, and Tavi (Taviana).
* Because of the above implementation, DMS by default will not include
the salt flats blacklist for findSafePos. In addition, it is
preconfigured to the hilly terrains in Esseker and Taviana, as well as
reducing all of the blacklist distances due to the smaller map size in
Esseker.
* Created new function "DMS_fnc_DebugLog". All DMS files (that produced
debug logs) have been changed, including mission files. However,
updating them is not important (and completely pointless if you don't
even use DMS_DEBUG).
* Fixed a few locations where it said "sized" instead of "seized".
Thanks to [icomrade](https://github.com/icomrade) for pointing them out.
* DMS now utilizes the "ARMA_LOG" DLL (if it exists) by infiSTAR to
produce debug logs (if enabled). All debug logs now also include server
uptime (in seconds) and server FPS.
* The FSM no longer produces debug logs.
* AI Locality manager will now run every minute.
* Debug logs for "DMS_fnc_MissionsMonitor" will only output the mission
name and the position, instead of all of the parameters.
* "DMS_fnc_IsNearWater" will now check the provided position itself for
water.
* "DMS_fnc_IsValidPosition" will now do a surfaceNormal check within a 5
meter radius of the provided position as well.
* "_customGearSet" should now actually work for
"DMS_fnc_SpawnAISoldier", and the function title comment has been
updated for the slightly tweaked syntax.
2015-10-10 01:35:07 +00:00
|
|
|
(format["SpawnAIGroup :: Spawning %1 %2 %3 AI at %4 with %5 difficulty.",_count,_class,_side,_pos,_difficulty]) call DMS_fnc_DebugLog;
|
2015-08-29 06:09:50 +00:00
|
|
|
|
|
|
|
// if soldier have AT/AA weapons
|
2015-09-10 02:05:46 +00:00
|
|
|
if (typeName _class == "ARRAY") then
|
2015-08-29 19:46:07 +00:00
|
|
|
{
|
2015-09-10 02:05:46 +00:00
|
|
|
_launcher = _class select 1;
|
|
|
|
_class = _class select 0;
|
2015-08-29 06:09:50 +00:00
|
|
|
};
|
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
// Randomize position
|
|
|
|
if(_pos_z == 0) then
|
|
|
|
{
|
|
|
|
if(round(random 1) == 1) then
|
|
|
|
{
|
2015-08-29 06:09:50 +00:00
|
|
|
_pos_x = _pos_x - (5 + random(10));
|
|
|
|
} else {
|
|
|
|
_pos_x = _pos_x + (5 + random(10));
|
|
|
|
};
|
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
if(round(random 1) == 1) then
|
|
|
|
{
|
2015-08-29 06:09:50 +00:00
|
|
|
_pos_y = _pos_y - (5 + random(10));
|
|
|
|
} else {
|
|
|
|
_pos_y = _pos_y + (5 + random(10));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
|
|
|
|
_group = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
|
|
|
|
|
2015-09-18 23:26:36 +00:00
|
|
|
_group setVariable ["DMS_LockLocality",nil];
|
2015-09-20 05:37:13 +00:00
|
|
|
_group setVariable ["DMS_SpawnedGroup",true];
|
2015-09-18 23:26:36 +00:00
|
|
|
|
2015-09-26 00:28:04 +00:00
|
|
|
if (_count < 1) exitWith
|
|
|
|
{
|
|
|
|
diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with less than 1 _count! _this: %1",_this];
|
|
|
|
_group
|
|
|
|
};
|
|
|
|
|
2015-09-14 04:52:02 +00:00
|
|
|
for "_i" from 1 to _count do
|
|
|
|
{
|
2015-09-10 02:05:46 +00:00
|
|
|
_unit = [_group,[_pos_x,_pos_y,_pos_z],_class,_difficulty,_side,"Soldier"] call DMS_fnc_SpawnAISoldier;
|
2015-08-29 06:09:50 +00:00
|
|
|
};
|
|
|
|
|
2015-09-01 06:25:14 +00:00
|
|
|
// An AI will definitely spawn with a launcher if you define type
|
|
|
|
if ((!isNil "_launcher") || {DMS_ai_use_launchers && {(random 100) <= DMS_ai_use_launchers_chance}}) then
|
2015-08-29 19:46:07 +00:00
|
|
|
{
|
2015-09-01 17:15:49 +00:00
|
|
|
if (isNil "_launcher") then
|
2015-09-01 06:24:42 +00:00
|
|
|
{
|
|
|
|
_launcher = "AT";
|
|
|
|
};
|
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
_launcher = ((missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcher],["launch_NLAW_F"]]) call BIS_fnc_selectRandom);
|
|
|
|
|
2015-09-14 04:52:02 +00:00
|
|
|
removeBackpackGlobal _unit;
|
2015-08-29 06:09:50 +00:00
|
|
|
_unit addBackpack "B_Carryall_mcamo";
|
2015-09-14 04:52:02 +00:00
|
|
|
_rocket = _launcher call DMS_fnc_selectMagazine;
|
2015-08-29 19:46:07 +00:00
|
|
|
|
2015-09-14 04:52:02 +00:00
|
|
|
[_unit, _launcher, DMS_AI_launcher_ammo_count,_rocket] call BIS_fnc_addWeapon;
|
2015-09-18 23:26:36 +00:00
|
|
|
|
|
|
|
_unit setVariable ["DMS_AI_Launcher",_launcher];
|
2015-08-29 06:09:50 +00:00
|
|
|
|
Readme changes, new debug fnc, fixes, tweaks
Created disclaimer for DMS. Now mentioning that HC for DMS isn't that
good.
Some structure stuff in readme (let's see if it works lol)
* **NEW CONFIG VALUE: DMS_Use_Map_Config**
* You can now overwrite "main config values" with map-specific config
values located in the new "map_configs" folder. This should allow you to
use one DMS PBO if you have multiple servers with different maps.
Included examples for Altis, Bornholm, Esseker, and Tavi (Taviana).
* Because of the above implementation, DMS by default will not include
the salt flats blacklist for findSafePos. In addition, it is
preconfigured to the hilly terrains in Esseker and Taviana, as well as
reducing all of the blacklist distances due to the smaller map size in
Esseker.
* Created new function "DMS_fnc_DebugLog". All DMS files (that produced
debug logs) have been changed, including mission files. However,
updating them is not important (and completely pointless if you don't
even use DMS_DEBUG).
* Fixed a few locations where it said "sized" instead of "seized".
Thanks to [icomrade](https://github.com/icomrade) for pointing them out.
* DMS now utilizes the "ARMA_LOG" DLL (if it exists) by infiSTAR to
produce debug logs (if enabled). All debug logs now also include server
uptime (in seconds) and server FPS.
* The FSM no longer produces debug logs.
* AI Locality manager will now run every minute.
* Debug logs for "DMS_fnc_MissionsMonitor" will only output the mission
name and the position, instead of all of the parameters.
* "DMS_fnc_IsNearWater" will now check the provided position itself for
water.
* "DMS_fnc_IsValidPosition" will now do a surfaceNormal check within a 5
meter radius of the provided position as well.
* "_customGearSet" should now actually work for
"DMS_fnc_SpawnAISoldier", and the function title comment has been
updated for the slightly tweaked syntax.
2015-10-10 01:35:07 +00:00
|
|
|
(format["SpawnAIGroup :: Giving %1 a %2 launcher with %3 %4 rockets",_unit,_launcher,DMS_AI_launcher_ammo_count,_rocket]) call DMS_fnc_DebugLog;
|
2015-08-29 06:09:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
_group selectLeader ((units _group) select 0);
|
|
|
|
_group setFormation "WEDGE";
|
|
|
|
|
|
|
|
|
|
|
|
if(_pos_z == 0) then
|
|
|
|
{
|
2015-09-17 03:37:17 +00:00
|
|
|
[_group,_pos,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior;
|
2015-08-29 06:09:50 +00:00
|
|
|
};
|
|
|
|
|
2015-08-29 19:46:07 +00:00
|
|
|
|
|
|
|
diag_log format ["DMS_SpawnAIGroup :: Spawned %1 AI at %2.",_count,_pos];
|
2015-08-29 06:09:50 +00:00
|
|
|
|
2015-09-01 17:31:51 +00:00
|
|
|
_group
|