DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf
eraser1 2650157577 Bunch of stuff...
* NEW CONFIG VALUES: ```DMS_GodmodeCrates``` and
```DMS_CrateCase_Sniper```. DMS_GodmodeCrates is pretty self-explanatory
:P
* NEW FEATURE FOR "DMS_fnc_FillCrate": You can now define "crate cases"
in the config (such as "DMS_CrateCase_Sniper"). Passing the "crate case"
name (such as "Sniper") will make the crate spawn with the exact gear
defined in the config. Refer to the testmission.sqf (line 80) and
"DMS_CrateCase_Sniper" config for an example.
* Spawned vehicles will now be LOCKED and INVINCIBLE until the mission
is completed.
* Spawned vehicles spawn with 100% fuel.
* "Fixed" some cases where killing from a mounted gun would reset your
money/respect (maybe).
* Fixed some spelling errors and incorrect names in some of the mission
messages/markers.
* Fixed DMS_fnc_FindSafePos for Bornholm. If you have any issues with
custom maps, please let us know.
* Fixed backpack spawning on the ground behind an AI unit that was
supposed to get a launcher.
2015-09-11 20:21:58 -05:00

56 lines
1.2 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;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SpawnNonPersistentVehicle :: Created %1 at %2 with calling parameters: %3",_vehObj,_vehpos,_this];
};
_vehObj