2015-09-10 02:05:46 +00:00
|
|
|
/*
|
|
|
|
DMS_fnc_SpawnAIStatic
|
|
|
|
Created by eraser1
|
|
|
|
Influenced by WAI
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
[
|
|
|
|
[ // Array of static gun positions
|
|
|
|
_pos1,
|
|
|
|
_pos2,
|
|
|
|
...
|
|
|
|
_pos3
|
|
|
|
],
|
|
|
|
_group, // Group to which the AI unit(s) belongs to
|
|
|
|
_class, // Class: "random","assault","MG","sniper" or "unarmed"
|
|
|
|
_difficulty, // Difficulty: "random","static","hardcore","difficult","moderate", or "easy"
|
2015-09-15 03:50:09 +00:00
|
|
|
_side, // "bandit","hero", etc.
|
2015-09-13 06:15:21 +00:00
|
|
|
_MGClass // !OPTIONAL) String: classname of the MG. Use "random" to select a random one from DMS_static_weapons
|
2015-09-10 02:05:46 +00:00
|
|
|
] call DMS_fnc_SpawnAIStatic;
|
|
|
|
|
|
|
|
Returns an array of static gun objects.
|
|
|
|
*/
|
|
|
|
|
2015-09-13 06:15:21 +00:00
|
|
|
private ["_OK", "_guns", "_pos", "_MGClassInput", "_MGClass", "_gun", "_unit", "_group", "_class", "_difficulty", "_side", "_positions"];
|
2015-09-10 02:18:30 +00:00
|
|
|
|
2015-09-10 02:05:46 +00:00
|
|
|
|
|
|
|
_OK = params
|
|
|
|
[
|
|
|
|
["_positions",[],[[]]],
|
|
|
|
["_group",grpNull,[grpNull]],
|
|
|
|
["_class","random",[""]],
|
|
|
|
["_difficulty","static",[""]],
|
|
|
|
["_side","bandit",[""]]
|
|
|
|
];
|
|
|
|
|
|
|
|
if (!_OK) exitWith
|
|
|
|
{
|
|
|
|
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStatic with invalid parameters: %1",_this];
|
|
|
|
};
|
|
|
|
|
2015-09-13 06:15:21 +00:00
|
|
|
_MGClassInput = param [5,"random",[""]];
|
|
|
|
|
2015-09-10 02:05:46 +00:00
|
|
|
|
|
|
|
_guns = [];
|
|
|
|
|
|
|
|
{
|
|
|
|
_pos = _x;
|
2015-09-13 06:15:21 +00:00
|
|
|
|
|
|
|
_MGClass = _MGClassInput;
|
|
|
|
if (_MGClass == "random") then
|
|
|
|
{
|
|
|
|
_MGClass = DMS_static_weapons call BIS_fnc_selectRandom;
|
|
|
|
};
|
2015-09-10 02:05:46 +00:00
|
|
|
|
2015-09-13 06:15:21 +00:00
|
|
|
_gun = createVehicle [_MGClass, _pos, [], 0, "CAN_COLLIDE"];
|
2015-09-10 02:05:46 +00:00
|
|
|
_gun setDir (random 360);
|
|
|
|
_gun setPosATL _pos;
|
|
|
|
_gun addEventHandler ["GetOut",{(_this select 0) setDamage 1;}];
|
|
|
|
_gun lock 2;
|
|
|
|
|
|
|
|
_guns pushBack _gun;
|
|
|
|
|
|
|
|
_unit = [_group,_pos,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier;
|
|
|
|
|
2015-09-15 03:50:09 +00:00
|
|
|
_unit moveInGunner _gun;
|
2015-09-10 02:05:46 +00:00
|
|
|
reload _unit;
|
2015-09-15 03:50:09 +00:00
|
|
|
_unit setVariable ["DMS_AssignedVeh",_gun];
|
2015-09-10 02:05:46 +00:00
|
|
|
|
|
|
|
if (DMS_DEBUG) then
|
|
|
|
{
|
|
|
|
diag_log format ["DMS_DEBUG SpawnAIStatic :: Created unit %1 at %2 as static gunner in %3",_unit,_pos,_gun];
|
|
|
|
};
|
|
|
|
} forEach _positions;
|
|
|
|
|
|
|
|
|
|
|
|
if (DMS_DEBUG) then
|
|
|
|
{
|
|
|
|
diag_log format ["DMS_DEBUG SpawnAIStatic :: Created %1 static AI with parameters: %2",count _positions,_this];
|
|
|
|
};
|
|
|
|
|
|
|
|
_guns
|