DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf
eraser1 afb4833a65 Fixes + Tweaks + Features
#### 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.
2015-09-16 22:37:17 -05:00

57 lines
1.3 KiB
Plaintext

/*
DMS_fnc_SpawnNonPersistentVehicle
Spawn a non-saved vehicle in Exile
Created by Zupa
Edited by eraser1
Usage:
[
_vehicleClass, // STRING: Classname of the vehicle
_pos // ARRAY: Position to spawn it at (roughly)
] call DMS_fnc_SpawnNonPersistentVehicle;
Returns the vehicle object of the created vehicle.
EXAMPLE:
_exampleVeh = ['Exile_Chopper_Hummingbird_Green',_pos] call DMS_fnc_SpawnNonPersistentVehicle;
*/
private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"];
_OK = params
[
["_vehicleClass","",[""]],
["_position","",[[]],[2,3]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_SpawnNonPersistentVehicle with invalid parameters: %1",_this];
};
_vehpos = [];
_maxDistance = 10;
while{count _vehpos < 1} do
{
_vehpos = _position findEmptyPosition [20,_maxDistance,_vehicleClass];
_maxDistance = (_maxDistance + 15);
};
_vehObj = [_vehicleClass, _vehpos, (random 360), true] call ExileServer_object_vehicle_createNonPersistentVehicle;
_vehObj allowDamage false;
_vehObj setFuel 1;
_vehObj lock 2;
_vehObj setVectorUp (surfaceNormal _vehpos);
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SpawnNonPersistentVehicle :: Created %1 at %2 with calling parameters: %3",_vehObj,_vehpos,_this];
};
_vehObj