Tweaks to Zupa's "SpawnNonPersistentVehicle" and comments

Used function "params" to parse input.

Decrease the initial "maxDistance"

Added debug log for the function

Improved explanation of a couple of configs
This commit is contained in:
eraser1 2015-09-01 19:43:17 -05:00
parent 26ded8908c
commit 3760bc9826
2 changed files with 43 additions and 14 deletions

View File

@ -4,6 +4,8 @@
Created by eraser1 Created by eraser1
*/ */
// If you're gonna make any changes to DMS functions and/or create any new missions, it's a good idea to enable this :)
DMS_DEBUG = false; DMS_DEBUG = false;
@ -385,7 +387,7 @@ DMS_DEBUG = false;
DMS_ai_use_launchers = true; // Enable/disable spawning an AI in a group with a launcher DMS_ai_use_launchers = true; // Enable/disable spawning an AI in a group with a launcher
DMS_ai_use_launchers_chance = 50; // Percentage chance to actually spawn the launcher (per-group) DMS_ai_use_launchers_chance = 50; // Percentage chance to actually spawn the launcher (per-group)
DMS_AI_launcher_ammo_count = 2; // How many rockets an AI will get with its launcher DMS_AI_launcher_ammo_count = 2; // How many rockets an AI will get with its launcher
DMS_ai_remove_launchers = true; // Remove rocket launchers on AI death DMS_ai_remove_launchers = true; // Remove rocket launchers on AI death
DMS_AI_wep_launchers_AT = [ // AT Launchers DMS_AI_wep_launchers_AT = [ // AT Launchers
"launch_NLAW_F", "launch_NLAW_F",
@ -400,7 +402,7 @@ DMS_DEBUG = false;
/* Loot Settings */ /* Loot Settings */
DMS_BoxWeapons = [ //List of weapons that can potentially spawn in a crate DMS_BoxWeapons = [ // List of weapons that can spawn in a crate
"Exile_Melee_Axe", "Exile_Melee_Axe",
"arifle_Katiba_GL_F", "arifle_Katiba_GL_F",
"arifle_MX_GL_Black_F", "arifle_MX_GL_Black_F",
@ -424,7 +426,7 @@ DMS_DEBUG = false;
"arifle_MXM_Black_F", "arifle_MXM_Black_F",
"srifle_DMR_02_F" "srifle_DMR_02_F"
]; ];
DMS_BoxSurvivalSupplies = [ //List of survival supplies (food/drink/meds) DMS_BoxSurvivalSupplies = [ //List of survival supplies (food/drink/meds) that can spawn in a crate
"Exile_Item_Catfood_Cooked", "Exile_Item_Catfood_Cooked",
"Exile_Item_SausageGravy_Cooked", "Exile_Item_SausageGravy_Cooked",
"Exile_Item_BBQSandwich_Cooked", "Exile_Item_BBQSandwich_Cooked",
@ -433,7 +435,7 @@ DMS_DEBUG = false;
"Exile_Item_Matches", "Exile_Item_Matches",
"Exile_Item_CookingPot" "Exile_Item_CookingPot"
]; ];
DMS_BoxBuildingSupplies = [ //List of building supplies DMS_BoxBuildingSupplies = [ // List of building supplies that can spawn in a crate
"Exile_Item_CamoTentKit", "Exile_Item_CamoTentKit",
"Exile_Item_MetalPole", "Exile_Item_MetalPole",
"Exile_Item_MetalBoard", "Exile_Item_MetalBoard",
@ -442,7 +444,7 @@ DMS_DEBUG = false;
"Exile_Item_ExtensionCord", "Exile_Item_ExtensionCord",
"Exile_Item_DuctTape" "Exile_Item_DuctTape"
]; ];
DMS_BoxOptics = [ DMS_BoxOptics = [ // List of optics that can spawn in a crate
"optic_Arco", "optic_Arco",
"optic_Hamr", "optic_Hamr",
"optic_Aco", "optic_Aco",
@ -453,7 +455,7 @@ DMS_DEBUG = false;
"optic_LRPS", "optic_LRPS",
"optic_Nightstalker" "optic_Nightstalker"
]; ];
DMS_BoxBackpacks = [ //List of backpacks that can potentially spawn in a crate DMS_BoxBackpacks = [ //List of backpacks that can spawn in a crate
"B_Bergen_rgr", "B_Bergen_rgr",
"B_Carryall_oli", "B_Carryall_oli",
"B_Kitbag_mcamo", "B_Kitbag_mcamo",

View File

@ -1,23 +1,50 @@
/* /*
DMS_SpawnNonPersistentVehicle
Spawn a non-saved vehicle in Exile Spawn a non-saved vehicle in Exile
_exampleVeh = ['Exile_Chopper_Hummingbird_Green',_pos] call DMS_SpawnNonPersistentVehicle;
Created by Zupa Created by Zupa
Edited by eraser1
Usage:
[
_vehicleClass, // STRING: Classname of the vehicle
_pos // ARRAY: Position to spawn it at (roughly)
] call DMS_SpawnNonPersistentVehicle;
Returns the vehicle object of the created vehicle.
*/ */
private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"]; private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"];
_vehicleClass = _this select 0; _OK = params
_position = _this select 1; [
_vehpos = []; ["_vehicleClass","",[""]],
_maxDistance = 40; ["_position","",[[]],[2,3]]
];
while{count _vehpos < 1} do { if (!_OK) exitWith
_vehpos = _position findEmptyPosition[20,_maxDistance,_vehicleClass]; {
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); _maxDistance = (_maxDistance + 15);
}; };
_vehObj = ObjNull; _vehObj = ObjNull;
_vehObj = [_vehicleClass, _vehpos, (random 360), true] call ExileServer_object_vehicle_createNonPersistentVehicle; _vehObj = [_vehicleClass, _vehpos, (random 360), true] call ExileServer_object_vehicle_createNonPersistentVehicle;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SpawnNonPersistentVehicle :: Created %1 at %2 with calling parameters: %3",_vehObj,_vehpos,_this];
};
_vehObj _vehObj