DMS_Exile/@ExileServer/addons/a3_dms/scripts/DMS_spawnAI.sqf
2015-08-28 14:41:37 +02:00

117 lines
3.6 KiB
Plaintext

private ["_group", "_pos","_soldier","_skill","_units","_playerObject"];
_pos = _this select 0;
_units = _this select 1;
_skill = _this select 2;
_group = createGroup EAST;
_group setBehaviour "COMBAT";
_group setCombatMode "RED";
_group allowFleeing 0;
// Set AI owner to Player.
//_group setGroupOwner (owner player);
// Not tested this one, may need to apply above one.
//ExileServerOwnershipSwapQueue pushBack [_group,_playerObject];
for "_i" from 1 to _units do {
_soldier = _group createUnit ["i_g_soldier_unarmed_f", [_pos select 0, _pos select 1, 0], [], 1, "Form"];
// Unlimmited ammo
_soldier addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];
removeAllAssignedItems _soldier;
removeUniform _soldier;
removeHeadgear _soldier;
removeAllItems _soldier;
removeAllWeapons _soldier;
uiSleep 1;
_soldier forceaddUniform "U_I_officerUniform";
_soldier addVest " V_TacVest_blk_POLICE ";
_soldier addGoggles "G_Tactical_Clear";
for "_i" from 1 to 3 do {
_soldier addItemToVest "30Rnd_65x39_caseless_mag";
};
_soldier addWeapon "arifle_MXC_Holo_pointer_F";
_soldier setRank "Private";
{
_soldier enableAI _x;
}forEach ["TARGET","AUTOTARGET","MOVE","ANIM"];
_soldier disableAI "FSM";
_soldier allowDammage true;
// FIX FOR Ai vs Ai killing.
[_soldier] joinSilent _group;
// Trigger for AI being killed.
//_soldier addEventHandler ["Killed",{ [(_this select 0), (_this select 1)] call on_kill; }];
switch (_skill) do
{
case 1:
{
_soldier setSkill ["aimingspeed", 0.05];
_soldier setSkill ["spotdistance", 0.05];
_soldier setSkill ["aimingaccuracy", 0.02];
_soldier setSkill ["aimingshake", 0.02];
_soldier setSkill ["spottime", 0.1];
_soldier setSkill ["spotdistance", 0.3];
_soldier setSkill ["commanding", 0.3];
_soldier setSkill ["general", 0.2];
};
case 2:
{
_soldier setSkill ["spotdistance", 0.1];
_soldier setSkill ["aimingaccuracy", 0.05];
_soldier setSkill ["aimingshake", 0.05];
_soldier setSkill ["spottime", 0.2];
_soldier setSkill ["spotdistance", 0.4];
_soldier setSkill ["commanding", 0.4];
_soldier setSkill ["general", 0.3];
};
case 3:
{
_soldier setSkill ["aimingspeed", 0.15];
_soldier setSkill ["spotdistance", 0.15];
_soldier setSkill ["aimingaccuracy", 0.1];
_soldier setSkill ["aimingshake", 0.1];
_soldier setSkill ["spottime", 0.3];
_soldier setSkill ["spotdistance", 0.5];
_soldier setSkill ["commanding", 0.5];
_soldier setSkill ["general", 0.6];
};
case 4:
{
_soldier setSkill ["aimingspeed", 0.3];
_soldier setSkill ["spotdistance", 0.3];
_soldier setSkill ["aimingaccuracy", 0.3];
_soldier setSkill ["aimingshake", 0.3];
_soldier setSkill ["spottime", 0.4];
_soldier setSkill ["spotdistance", 0.6];
_soldier setSkill ["commanding", 0.6];
_soldier setSkill ["general", 0.7];
};
case 5:
{
_soldier setSkill ["aimingspeed", 0.9];
_soldier setSkill ["spotdistance", 0.9];
_soldier setSkill ["aimingaccuracy", 0.9];
_soldier setSkill ["aimingshake", 0.9];
_soldier setSkill ["spottime", 0.9];
_soldier setSkill ["spotdistance", 0.9];
_soldier setSkill ["commanding", 0.8];
};
case 6: // Stupidly fucking OP.
{
_soldier setSkill ["aimingspeed", 1];
_soldier setSkill ["spotdistance", 1];
_soldier setSkill ["aimingaccuracy", 1];
_soldier setSkill ["aimingshake", 1];
_soldier setSkill ["spottime", 1];
_soldier setSkill ["spotdistance", 1];
_soldier setSkill ["commanding", 1];
};
};
};
_soldier