mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
afb4833a65
#### September 13, 2015 (11:45 PM CST-America): * NEW CONFIG VALUES: DMS_MaxAIDistance and DMS_AIDistanceCheckFrequency * You can now use the above config values to kill AI that flee from their spawn position. Only "Soldier" AI will be killed. * Removed "O_HMG_01_F" from AI Static Weapons. AI were pretty useless on it... unless the AI were facing the right direction. * Reduced AI count and removed the "playerNear" parameter from testmission for easier testing. * NEW: When an AI vehicle gunner is killed, and the driver is still alive, after a little delay, the driver is then switched to the gunner seat. You should no longer have AI vehicles with a dead gunner that's driving around aimlessly :) There is a 5-8 second delay to simulate reaction time. Then the driver is ejected, then after 1.5 seconds the AI is then forced into the gunner seat. * NOTE: The above feature only works when the AI is still local (not offloaded). If the AI is offloaded, the AI is simply ejected and becomes a foot soldier. * AI assigned vehicles are destroyed when the crew is empty. Simulation is also disabled on them. * Reduced some of the "params" RPT spam, from DMS_fnc_SetGroupBehavior. * Tweaked AI Vehicle spawning logic. The AI are initially assigned to a temporary group and then behavior is set, then they join the assigned group to prevent overriding behavior of other ground units. * Non-persistent vehicles should now be fit properly to the terrain.
86 lines
2.6 KiB
Plaintext
86 lines
2.6 KiB
Plaintext
/*
|
|
DMS_fnc_SpawnAIVehicle
|
|
Created by eraser1
|
|
|
|
Usage:
|
|
[
|
|
[
|
|
_spawnPos, // The position at which the AI vehicle will spawn
|
|
_gotoPos // (OPTIONAL) The position to which the AI vehicle will drive to. If it isn't defined, _spawnPos is used
|
|
],
|
|
_group, // Group to which the AI units belongs to
|
|
_class, // Class: "random","assault","MG","sniper" or "unarmed"
|
|
_difficulty, // Difficulty: "random","static","hardcore","difficult","moderate", or "easy"
|
|
_side, // "bandit","hero", etc.
|
|
_vehClass // (OPTIONAL) String: classname of the Vehicle. Use "random" to select a random one from DMS_ArmedVehicles
|
|
] call DMS_fnc_SpawnAIVehicle;
|
|
|
|
Returns the spawned vehicle.
|
|
*/
|
|
|
|
private ["_OK", "_positions", "_veh", "_spawnPos", "_gotoPos", "_vehClass", "_driver", "_gunner", "_tmpGroup", "_group", "_class", "_difficulty", "_side"];
|
|
|
|
|
|
_OK = params
|
|
[
|
|
["_positions",[],[[]],[2]],
|
|
["_group",grpNull,[grpNull]],
|
|
["_class","random",[""]],
|
|
["_difficulty","static",[""]],
|
|
["_side","bandit",[""]]
|
|
];
|
|
if (!_OK) exitWith
|
|
{
|
|
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid parameters: %1",_this];
|
|
};
|
|
|
|
|
|
// Using another params-exitwith structure just for _spawnPos because it's pretty important...
|
|
_OK = _positions params
|
|
[
|
|
["_spawnPos",[],[[]],[2,3]]
|
|
];
|
|
if (!_OK) exitWith
|
|
{
|
|
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid _positions parameters: %1",_positions];
|
|
};
|
|
|
|
// Simply use _spawnPos if _gotoPos isn't defined. Yes, you might get "param"/"params" RPT spam. Deal with it ;)
|
|
_gotoPos = _positions param [1,_spawnPos,[[]],[2,3]];
|
|
|
|
|
|
_vehClass = param [5,"random",[""]];
|
|
|
|
if (_vehClass == "random") then
|
|
{
|
|
_vehClass = DMS_ArmedVehicles call BIS_fnc_selectRandom;
|
|
};
|
|
|
|
_tmpGroup = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
|
|
|
|
_veh = createVehicle [_vehClass, _spawnPos, [], 0, "NONE"];
|
|
_veh setDir (random 360);
|
|
_veh setPosATL _spawnPos;
|
|
_veh lock 2;
|
|
|
|
|
|
_driver = [_tmpGroup,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
|
|
_gunner = [_tmpGroup,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
|
|
|
|
_driver moveInDriver _veh;
|
|
_gunner moveInGunner _veh;
|
|
|
|
_driver setVariable ["DMS_AssignedVeh",_veh];
|
|
_gunner setVariable ["DMS_AssignedVeh",_veh];
|
|
|
|
|
|
[_tmpGroup,_gotoPos,_difficulty,"AWARE"] call DMS_fnc_SetGroupBehavior;
|
|
|
|
[_driver,_gunner] joinSilent _group;
|
|
|
|
if (DMS_DEBUG) then
|
|
{
|
|
diag_log format ["DMS_DEBUG SpawnAIVehicle :: Created a %1 armed vehicle (%2) at %3 with %4 difficulty to group %5",_side,_vehClass,_spawnPos,_difficulty,_group];
|
|
};
|
|
|
|
_veh |