Beginning Steps of DMS Rewrite

***!!!THIS COMMIT WILL NOT WORK. DO NOT BOTHER COMPILING IT. THIS IS
SIMPLY A "SAVE POINT"!!!***

I copied a lot of WAI stuff (specifically the config.sqf) as a template
for the desired levels of customization that I want in the end.

Created a couple unique DMS config values w/ comments (all variables
prefixed with DMS_ in config.sqf)

Created BroadCastMissionStatus (with a variety of options)

Edited cleanup.sqf to take ARRAY params. It also won't clean up objects
if there is a player within 20m of it (I will probably improve/replace
the function later)

Replaced original crate function with WAI (because of customizability.
Will probably rewrite using BIS_fnc_param)

Fixed the PBOPREFIX

MissionStatusCheck is set up the way I want it, with all functions it
uses ready as well.

Made Exile and exile_server_config a necessary addon.

Created preInit for compiling code (postInit simply launches it now)

All functions added/changed so far have debug reports (if
DMS_DEBUG=true)
This commit is contained in:
eraser1
2015-08-27 02:44:23 -05:00
parent 2a9a0fc06e
commit 9110ffc675
17 changed files with 508 additions and 167 deletions

View File

@ -1 +0,0 @@
x\addons\DMS

View File

@ -1,37 +0,0 @@
// Loads compiles
// Made by Defent for Defents Mission System
// And for Numenadayz.com
if(isServer) then {
// compilation list
DMS_findSafePos = compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_findSafePos.sqf";
DMS_createBox = compile preprocessFileLineNumbers "\x\addons\dms\crates\DMS_CreateBox.sqf";
DMS_CreateMarker = compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CreateMarker.sqf";
DMS_spawnAI = compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_spawnAI.sqf";
DMS_selectMission = compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_selectMission.sqf";
DMS_CleanUp = compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CleanUp.sqf";
//DMS_Config = compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_Config.sqf";
// CONFIGS
//DMS_UseMissions = true;
//DMS_DetectNearWater = true;
//DMS_MissionMin = 60; // Timers in seconds
//DMS_MissionMax = 120; // Timers in seconds
//DMS_player_minDist = 700;
// CONFIGS
uiSleep 2;
//[] call compile preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_selectMission.sqf";
//[] execVM "\x\addons\dms\scripts\DMS_selectMission.sqf";
[] call DMS_selectMission;
diag_log "DMS :: Functions loaded - starting the rest of the script.";
};

View File

@ -1 +0,0 @@
x\addons\dms

View File

@ -4,13 +4,17 @@ class CfgPatches {
weapons[] = {};
a3_DMS_version = 1.0;
requiredVersion = 1.36;
requiredAddons[] = {};
requiredAddons[] = {"exile_client","exile_server_config"};
};
};
class CfgFunctions {
class dms {
class main {
file = "\x\addons\dms";
class init_dms
{
preInit = 1;
};
class start_dms {
postInit = 1;
};

View File

@ -0,0 +1,215 @@
/* GENERAL CONFIG */
DMS_DEBUG = false; // enable debug
blacklist = // I'm not using it
[
];
/* END GENERAL CONFIG */
/*
[_delay, _function, _params, _persistance] call ExileServer_system_thread_addTask;
*/
DMS_CompletedMissionCleanup = true; // Cleanup mission-spawned buildings and AI bodies after some time
DMS_CompletedMissionCleanup_Time = 3600; // How long until mission-spawned buildings and AI are cleaned up
DMS_player_reset_timeout = true; // If a player is this close to a mission then it won't time-out
DMS_player_reset_timeout_range = true; // If a player is this close to a mission then it won't time-out
DMS_player_notification_types = ["standardHintRequest"]; // Notification types. Supported values are: ["advancedHintRequest","dynamicTextRequest","standardHintRequest","systemChatRequest"]
DMS_dynamicText_Size = 0.55; // Dynamic Text size for "dynamicTextRequest" notification type.
DMS_dynamicText_Color = "#FFCC00"; // Dynamic Text color for "dynamicTextRequest" notification type.
/* AI CONFIG */
ai_clear_body = false; // instantly clear bodies
ai_clean_dead = true; // clear bodies after certain amount of time
ai_cleanup_time = 3600; // time to clear bodies in seconds
ai_clean_roadkill = false; // clean bodies that are roadkills
ai_roadkill_damageweapon = 0; // percentage of chance a roadkill will destroy weapon AI is carrying
wai_bandit_side = east;
ai_bandit_combatmode = "RED"; // combatmode of bandit AI
ai_bandit_behaviour = "COMBAT"; // behaviour of bandit AI
ai_share_info = true; // AI share info on player position
ai_share_distance = 300; // distance from killed AI for AI to share your rough position
// https://community.bistudio.com/wiki/AI_Sub-skills#general
ai_skill_extreme = [["aimingAccuracy",1.00],["aimingShake",1.00],["aimingSpeed",1.00],["spotDistance",1.00],["spotTime",1.00],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",1.00]]; // Extreme
ai_skill_hard = [["aimingAccuracy",0.70],["aimingShake",0.70],["aimingSpeed",0.70],["spotDistance",0.70],["spotTime",0.80],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",0.70]]; // Hard
ai_skill_medium = [["aimingAccuracy",0.60],["aimingShake",0.60],["aimingSpeed",0.60],["spotDistance",0.60],["spotTime",0.60],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",0.60]]; // Medium
ai_skill_easy = [["aimingAccuracy",0.30],["aimingShake",0.50],["aimingSpeed",0.50],["spotDistance",0.50],["spotTime",0.50],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",0.50]]; // Easy
ai_skill_random = [ai_skill_extreme,ai_skill_hard,ai_skill_hard,ai_skill_hard,ai_skill_hard,ai_skill_medium,ai_skill_medium,ai_skill_medium,ai_skill_medium,ai_skill_easy];
ai_static_useweapon = true; // Allows AI on static guns to have a loadout
ai_static_weapons = ["O_HMG_01_F","O_HMG_01_high_F"]; // static guns
ai_static_skills = false; // Allows you to set custom array for AI on static weapons. (true: On false: Off)
ai_static_array = [["aimingAccuracy",0.20],["aimingShake",0.70],["aimingSpeed",0.75],["endurance",1.00],["spotDistance",0.70],["spotTime",0.50],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",1.00]];
ai_assault_wep = ["arifle_Katiba_GL_F","arifle_MX_GL_Black_F","arifle_Mk20_GL_F","arifle_TRG21_GL_F","arifle_Katiba_F","arifle_MX_Black_F","arifle_TRG21_F","arifle_TRG20_F","arifle_Mk20_plain_F","arifle_Mk20_F"]; // Assault
ai_assault_scope = ["optic_Arco","optic_Hamr","optic_Aco","optic_Holosight","optic_MRCO","optic_DMS"];
ai_assault_gear = ["ItemGPS","Binocular"];
ai_assault_skin = ['U_O_CombatUniform_ocamo','U_O_PilotCoveralls','U_B_Wetsuit','U_BG_Guerilla3_1','U_BG_Guerilla2_3','U_BG_Guerilla2_2','U_BG_Guerilla1_1','U_BG_Guerrilla_6_1','U_IG_Guerilla3_2','U_B_SpecopsUniform_sgg','U_I_OfficerUniform','U_B_CTRG_3','U_I_G_resistanceLeader_F'];
ai_assault_skin = ai_assault_skin + ["U_I_Protagonist_VR"];//Give the VR suit half as much of a chance to spawn as another
ai_assault_backpack = ["B_Bergen_rgr","B_Carryall_oli","B_Kitbag_mcamo","B_Carryall_cbr","B_FieldPack_oucamo","B_FieldPack_cbr","B_Bergen_blk"];
ai_assault_vest = ["V_PlateCarrierH_CTRG","V_PlateCarrierSpec_rgr","V_PlateCarrierGL_blk","V_PlateCarrierGL_mtp","V_PlateCarrierGL_rgr","V_PlateCarrierSpec_blk","V_PlateCarrierSpec_mtp","V_PlateCarrierL_CTRG","V_TacVest_blk_POLICE","V_PlateCarrierIA2_dgtl"];
ai_assault = [ai_assault_wep,ai_assault_scope,ai_assault_gear,ai_assault_skin,ai_assault_backpack,ai_assault_vest];
ai_machine_wep = ["LMG_Zafir_F","LMG_Mk200_F","arifle_MX_SW_Black_F","MMG_01_hex_F"]; // Light machine guns
ai_machine_scope = ["optic_Arco","optic_Hamr","optic_Aco","optic_Holosight","optic_MRCO","optic_DMS"];
ai_machine_gear = ["ItemWatch","ItemMap","ItemCompass"];
ai_machine_skin = ai_assault_skin;//Use the same skins as assault :P
ai_machine_backback = ["B_Bergen_rgr","B_Carryall_oli","B_Kitbag_mcamo","B_Carryall_cbr","B_Bergen_blk"];
ai_machine_vest = ai_assault_vest + ["V_HarnessO_brn","V_HarnessO_gry"];
ai_machine = [ai_machine_wep,ai_machine_scope,ai_machine_gear,ai_machine_skin,ai_machine_backback,ai_machine_vest];
ai_sniper_wep = ["srifle_EBR_F","srifle_DMR_01_F","srifle_GM6_F","srifle_LRR_F","arifle_MXM_F","arifle_MXM_Black_F","srifle_DMR_02_F"]; // Sniper rifles
ai_sniper_scope = ["optic_SOS","optic_DMS","optic_LRPS"];
ai_sniper_scope = ai_sniper_scope + ai_sniper_scope + ["optic_Nightstalker","optic_tws"];//Approximately 1/3rd as much chance to spawn thermal sight
ai_sniper_gear = ["Rangefinder","ItemGPS"];
ai_sniper_skin = ["U_O_GhillieSuit","U_B_FullGhillie_ard","U_B_FullGhillie_lsh","U_B_FullGhillie_sard","U_B_GhillieSuit","U_I_FullGhillie_ard","U_I_FullGhillie_lsh","U_I_FullGhillie_sard","U_I_GhillieSuit","U_O_FullGhillie_ard","U_O_FullGhillie_lsh","U_O_FullGhillie_sard"];
ai_sniper_backpack = ai_machine_backback;//Same backpacks as machinegunners
ai_sniper_vest = ai_machine_vest;//Same vests as machinegunners
ai_sniper = [ai_sniper_wep,ai_sniper_scope,ai_sniper_gear,ai_sniper_skin,ai_sniper_backpack,ai_sniper_vest];
ai_headgear_list = ["H_PilotHelmetHeli_I","H_PilotHelmetHeli_O","H_PilotHelmetFighter_I","H_PilotHelmetFighter_O","H_HelmetCrew_O","H_CrewHelmetHeli_I","H_HelmetSpecB_paint1","H_HelmetIA_camo","H_HelmetLeaderO_ocamo","H_HelmetLeaderO_oucamo"];
ai_random = [ai_assault,ai_assault,ai_assault,ai_sniper,ai_machine]; // random weapon 60% chance assault rifle,20% light machine gun,20% sniper rifle
// Weapons accessories
ai_wep_item = ["acc_pointer_IR","acc_flashlight"];
ai_wep_Suppressor = ["muzzle_snds_H","muzzle_snds_L","muzzle_snds_M","muzzle_snds_B","muzzle_snds_H_MG","muzzle_snds_acp"];
ai_pistols = ["hgun_PDW2000_F","hgun_ACPC2_F","hgun_Rook40_F","hgun_P07_F","hgun_Pistol_heavy_01_F","hgun_Pistol_heavy_02_F"];
ai_wep_water = ["arifle_SDAR_F"];
// AT/AA launchers
ai_wep_launchers_AT = [];
ai_wep_launchers_AA = [];
/* END AI CONFIG */
/* WAI MISSIONS CONFIG */
wai_mission_system = true; // use built in mission system
wai_mission_markers = [];
wai_avoid_missions = 2000; // avoid spawning missions this close to other missions, these are defined in wai_mission_markers
//wai_avoid_traders = 0; // avoid spawning missions this close to traders
//wai_avoid_town = 0; // avoid spawning missions this close to towns, *** doesn't function with infiSTAR enabled ***
//wai_avoid_road = 0; // avoid spawning missions this close to roads
wai_near_water = 500; // avoid spawning missions this close to water
wai_blacklist_players_range = 2000; // distance to players
wai_blacklist_range = 2000; // distance to base, traders, spawnpoint
wai_mission_timer = [600,900]; // time between missions 10-15 minutes
wai_mission_timeout = [900,1800]; // time each missions takes to despawn if inactive 15-30 minutes
wai_timeout_bomb = 1800; // How long bomb missions is, when it times out it gos BOOM
wai_clean_mission = true; // clean all mission buildings after a certain period
wai_clean_mission_time = 900; // time after a mission is complete to clean mission buildings
//wai_mission_fuel = [5,60]; // fuel inside mission spawned vehicles [min%,max%]
//wai_vehicle_damage = [20,70]; // damages to spawn vehicles with [min%,max%]
//wai_keep_vehicles = true; // save vehicles to database and keep them after restart
//wai_lock_vehicles = true; // lock mission vehicles and add keys to random AI bodies (be careful with ai_clean_dead if this is true
wai_crates_smoke = true; // pop smoke on crate when mission is finished during daytime
wai_crates_flares = true; // pop flare on crate when mission is finished during nighttime
wai_players_online = 0; // number of players online before mission starts
wai_server_fps = 10; // missions only starts if server FPS is over wai_server_fps
// Don't use might be buged
wai_kill_percent = 0; // percentage of AI players that must be killed at "crate" missions to be able to trigger completion
wai_high_value = true; // enable the possibility of finding a high value item (defined below crate_items_high_value) inside a crate
wai_high_value_chance = 10; // chance in percent you find above mentioned item
wai_enable_minefield = false; // enable minefields to better defend missions
wai_use_launchers = false; // add a rocket launcher to each spawned AI group
wai_remove_launcher = true; // remove rocket launcher from AI on death
// Missions
wai_announce = "text"; // Setting this to true will announce the missions to those that hold a radio only "radio", "global", "hint", "text"
wai_bandit_limit = 1; // define how many bandit missions can run at once
//Syntax ["MISSION NAME","CHANGE"] Change must equal 100 when put together
wai_bandit_missions = [
// ["nuke",2],
["sniper_team",1],
["rebel_base",1],
["medi_camp",1],
// ["ikea_convoy",30],
["patrol",0],
["armed_vehicle",0],
["black_hawk_crash",0],
["captured_mv22",0],
["broken_down_ural",0],
["presidents_mansion",0],
["weapon_cache",1],
["debug",0]
];
// Vehicle arrays
armed_vehicle = ["Exile_Car_Offroad_Armed_Guerilla01"];
armed_chopper = ["Exile_Chopper_Orca_BlackCustom"];
refuel_trucks = ["Exile_Car_Van_Fuel_Guerilla01"];
civil_chopper = ["Exile_Chopper_Hummingbird_Green","Exile_Chopper_Orca_BlackCustom","Exile_Chopper_Mohawk_FIA","Exile_Chopper_Huron_Black","Exile_Chopper_Hellcat_Green","Exile_Chopper_Taru_Transport_Black"];
military_unarmed = ["Exile_Car_Strider","Exile_Car_Hunter","Exile_Car_Ifrit"];
cargo_trucks = ["Exile_Car_Van_Guerilla01","Exile_Car_Van_Black"];
civil_vehicles = ["Exile_Car_Hatchback_Rusty1","Exile_Car_Hatchback_Rusty2","Exile_Car_Hatchback_Sport_Red","Exile_Car_SUV_Red","Exile_Car_Offroad_Rusty2","Exile_Bike_QuadBike_Fia"];
boots = [];
wreck_water = ["Land_UWreck_FishingBoat_F","Land_UWreck_Heli_Attack_02_F","Land_UWreck_MV22_F","Land_Wreck_Traw2_F","Land_Wreck_Traw_F"];
wreck = [];
// Dynamic box array
crates_large = ["Box_NATO_AmmoVeh_F"];
crates_medium = ["C_supplyCrate_F"];
crates_small = ["Box_NATO_WpsSpecial_F"];
// weapons
crate_weapons_buildables = ["Exile_Melee_Axe"];//<--- TODO Setup Ikea Mission
crate_tools = ["Binocular","Rangefinder","ItemGPS","NVGoggles"];
crate_tools_sniper = ["Laserdesignator","Rangefinder","NVGoggles","ItemGPS"];
//item
crate_tools_buildable = [];//<--- TODO Setup Ikea Mission
crate_items = ["Exile_Item_Catfood_Cooked","Exile_Item_SausageGravy_Cooked","Exile_Item_BBQSandwich_Cooked","Exile_Item_GloriousKnakworst","Exile_Item_PlasticBottleFreshWater","Exile_Item_PlasticBottleFreshWater","Exile_Item_Energydrink","Exile_Item_Beer","Exile_Item_Matches","Exile_Item_CookingPot","Exile_Item_DuctTape","Exile_Item_InstaDoc"];
crate_items_high_value = ["Exile_Item_SafeKit"];
crate_items_food = ["Exile_Item_Catfood_Cooked","Exile_Item_SausageGravy_Cooked","Exile_Item_BBQSandwich_Cooked","Exile_Item_PlasticBottleFreshWater","Exile_Item_PlasticBottleFreshWater","Exile_Item_Matches","Exile_Item_CookingPot"];
crate_items_buildables = [];//<--- TODO Setup Ikea Mission
crate_items_vehicle_repair = [];
crate_items_medical = ["Exile_Item_BBQSandwich_Cooked","Exile_Item_PlasticBottleFreshWater","Exile_Item_InstaDoc"];
crate_items_sniper = ["U_O_GhillieSuit",["Exile_Item_InstaDoc",2]];//<--- Not used
crate_items_president = ["Exile_Item_InstaDoc"];//<--- Not used
crate_backpacks_all = ai_assault_backpack;
crate_backpacks_large = ["B_Carryall_cbr","B_Carryall_khk","B_Carryall_mcamo"];
crate_random = [crate_items,crate_items_food,crate_items_vehicle_repair,crate_items_medical];
/* END WAI MISSIONS CONFIG */
// DEBUG SETTINGS
if(DMS_DEBUG) then {
wai_remove_launcher = false;
wai_mission_timer = [60,60];
wai_mission_timeout = [300,300];
//wai_bandit_missions = [["debug",100]];
//wai_bandit_missions = [["nuke",100]];
//wai_bandit_missions = [["treasure_hunt_water",100]];
};
/* STATIC MISSIONS CONFIG */
static_missions = false; // use static mission file
custom_per_world = false; // use a custom mission file per world

View File

@ -1,56 +0,0 @@
// The content of the boxes.
private ["_type","_crate"];
_type = _this select 0;
_crate = _this select 1;
clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearItemCargoGlobal _crate;
switch (_type) do
{
// Intermediate loot
case 1:
{
_crate addMagazineCargoGlobal ["Exile_Item_WoodWallKit",6];
_crate addMagazineCargoGlobal ["Exile_Item_WoodWallHalfKit",2];
_crate addMagazineCargoGlobal ["Exile_Item_DoorwayKit",1];
_crate addMagazineCargoGlobal ["Exile_Item_PlasticBottleFreshWater",5];
_crate addMagazineCargoGlobal ["Exile_Melee_Axe",2];
_crate addMagazineCargoGlobal ["Exile_Item_BBQ_Sandwich",2];
_crate addMagazineCargoGlobal ["Exile_Item_Beer",3];
_crate addMagazineCargoGlobal ["Exile_Item_CamoTentKit",3];
_crate addMagazineCargoGlobal ["Exile_Item_CampFireKit",5];
_crate addMagazineCargoGlobal ["Exile_Item_InstaDoc",5];
_crate addMagazineCargoGlobal ["Exile_Item__JunkMetal",2];
_crate addMagazineCargoGlobal ["Exile_Item_SafeKit",1];
_crate addMagazineCargoGlobal ["Exile_Item_MetalBoard",2];
_crate addMagazineCargoGlobal ["Exile_Item_DuctTape",2];
_crate addMagazineCargoGlobal ["Exile_Item_ExtensionCord",2];
_crate addMagazineCargoGlobal ["Exile_Item_PortableGeneratorkit",1];
};
// Much loot
case 2:
{
_crate addMagazineCargoGlobal ["Exile_Item_WoodWallKit",5];
_crate addMagazineCargoGlobal ["Exile_Item_WoodWallHalfKit",5];
_crate addMagazineCargoGlobal ["Exile_Item_DoorwayKit",1];
_crate addMagazineCargoGlobal ["Exile_Item_PlasticBottleFreshWater",5];
_crate addMagazineCargoGlobal ["Exile_Melee_Axe",5];
_crate addMagazineCargoGlobal ["Exile_Item_BBQ_Sandwich",5];
_crate addMagazineCargoGlobal ["Exile_Item_Beer",5];
_crate addMagazineCargoGlobal ["Exile_Item_CamoTentKit",5];
_crate addMagazineCargoGlobal ["Exile_Item_CampFireKit",5];
_crate addMagazineCargoGlobal ["Exile_Item_InstaDoc",5];
_crate addMagazineCargoGlobal ["Exile_Item__JunkMetal",5];
_crate addMagazineCargoGlobal ["Exile_Item_SafeKit",5];
_crate addMagazineCargoGlobal ["Exile_Item_MetalBoard",5];
_crate addMagazineCargoGlobal ["Exile_Item_DuctTape",5];
_crate addMagazineCargoGlobal ["Exile_Item_ExtensionCord",5];
_crate addMagazineCargoGlobal ["Exile_Item_PortableGeneratorkit",5];
};
// add more cases if you want.
};

View File

@ -0,0 +1,32 @@
/*
DMS Pre-init (compiles)
Written by eraser1 (trainwreckdayz.com)
*/
// compiles
DMS_findSafePos = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_findSafePos.sqf";
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CreateMarker.sqf";
DMS_spawnAI = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_spawnAI.sqf";
DMS_selectMission = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_selectMission.sqf";
spawn_group = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_group.sqf";
spawn_soldier = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_soldier.sqf";
spawn_static = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_static.sqf";
group_waypoints = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\group_waypoints.sqf";
heli_para = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_para.sqf";
heli_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_patrol.sqf";
vehicle_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_patrol.sqf";
on_kill = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\on_kill.sqf";
bandit_behaviour = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\bandit_behaviour.sqf";
vehicle_monitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_monitor.sqf";
find_position = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\find_position.sqf";
load_ammo = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\load_ammo.sqf";
//Completed
DMS_MissionStatusCheck = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionStatusCheck.sqf";
DMS_MissionSuccessState = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionSuccessState.sqf";
DMS_BroadcastMissionStatus = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\BroadcastMissionStatus.sqf";
DMS_CleanUp = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CleanUp.sqf";
DMS_isPlayerNearbyARRAY = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\isPlayerNearbyARRAY.sqf";
DMS_FillCrate = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FillCrate.sqf";

View File

@ -1,2 +1,25 @@
[] execVM "\x\addons\dms\dms_init.sqf";
diag_log format ["DMS :: Loading Defents Mission System"];
// Loads compiles
// Made by Defent for Defents Mission System
// And for Numenadayz.com
// Rewritten by eraser1
//Load config
#include "config.sqf";
RESISTANCE setFriend[WEST,0];
WEST setFriend[RESISTANCE,0];
RESISTANCE setFriend[EAST,0];
EAST setFriend[RESISTANCE,0];
EAST setFriend[WEST,0];
WEST setFriend[EAST,0];
[1, DMS_MissionStatusCheck, [], true] call ExileServer_system_thread_addTask;
if(static_missions) then {
call compileFinal preprocessFileLineNumbers "\x\addons\dms\static\init.sqf";
};
if (mission_system) then {
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\init.sqf";
};

View File

@ -0,0 +1,14 @@
if (DMS_DEBUG) then
{
diag_log format["DMS :: Notification types: |%1| for broadcasting mission status: %2",DMS_player_notification_types,_this];
};
{
switch (_x) do
{
case "advancedHintRequest":{[_x, [_this]] call ExileServer_system_network_send_broadcast;};
case "dynamicTextRequest":{[_x, [_this,0,DMS_dynamicText_Size,DMS_dynamicText_Color]] call ExileServer_system_network_send_broadcast;};
case "standardHintRequest":{[_x, [_this]] call ExileServer_system_network_send_broadcast;};
case "systemChatRequest":{[_x, [_this]] call ExileServer_system_network_send_broadcast;};
};
false;
} count DMS_player_notification_types;

View File

@ -0,0 +1,27 @@
if (DMS_DEBUG) then
{
diag_log ("DMS:: CLEANING UP: "+str _this);
};
if !((typeName _this) isEqualTo "ARRAY") then
{
_this = [_this];
};
if ([_this,20] call DMS_isPlayerNearbyARRAY) exitWith //<---TODO: Improve/Replace?
{
[30, DMS_CleanUp, _this, false] call ExileServer_system_thread_addTask;
};
{
_x enableSimulationGlobal false;
_x removeAllMPEventHandlers "mpkilled";
_x removeAllMPEventHandlers "mphit";
_x removeAllMPEventHandlers "mprespawn";
_x removeAllEventHandlers "FiredNear";
_x removeAllEventHandlers "HandleDamage";
_x removeAllEventHandlers "Killed";
_x removeAllEventHandlers "Fired";
_x removeAllEventHandlers "GetOut";
_x removeAllEventHandlers "GetIn";
_x removeAllEventHandlers "Local";
deleteVehicle _x;
false;
} count _this;

View File

@ -1,16 +0,0 @@
DMS_Config = {
if(isServer) then {
diag_log "DMS :: Config starting to load..";
//Settings
DMS_UseMissions = true;
//DMS_DetectNearWater = true;
// Timers in seconds
//DMS_MissionMin = 60;
//DMS_MissionMax = 120;
// Finalize
DMS_Loaded = true;
};
};

View File

@ -1,19 +0,0 @@
_this enableSimulation false;
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "Local";
// clearVehicleInit _this;
deleteVehicle _this;
deleteGroup (group _this);
_this = nil;
diag_log format ["DMS :: Markers, vehicles, AI and loot boxes and other items have been cleaned up!"];

View File

@ -1,34 +0,0 @@
DMS_fnc_nearbyPlayers = {
private ["_pos", "_isNearList", "_isNear"];
_pos = [_this, 0, objNull, [objNull,[]], [2,3]] call BIS_fnc_param;
_dis = [_this, 1, DMS_player_minDist, [0]] call BIS_fnc_param;
_isNearList = _pos nearEntities ["Exile_Unit_Player",_dis];
_isNear = false;
// Check for Players
if ((count(_isNearList)) > 0) then {
{
if (isPlayer _x) exitWith {
_isNear = true;
};
false;
} count _isNearList;
};
// Check for Players in Vehicles
if !(_isNear) then {
_isNearList = _pos nearEntities [["LandVehicle", "Air", "Ship"], _dis];
{
if (_isNear) exitWith {};
{
if (isPlayer _x) exitWith {
_isNear = true;
};
false;
} count (crew _x);
false;
} count _isNearList;
};
_isNear
};

View File

@ -0,0 +1,112 @@
private ["_ammo","_tool","_crate","_weapon","_item","_backpack","_num_tools","_num_items","_num_backpacks","_num_weapons","_weapons_array","_tool_array","_item_array","_backpack_array"];
_crate = _this select 0;
_crate allowdamage true;
// WEAPONS
if(typeName (_this select 1) == "ARRAY") then {
_num_weapons = (_this select 1) select 0;
_weapons_array = (_this select 1) select 1;
} else {
_num_weapons = _this select 1;
_weapons_array = [ai_assault_wep,ai_machine_wep,ai_sniper_wep] call BIS_fnc_selectRandom;
};
// TOOLS
if(typeName (_this select 2) == "ARRAY") then {
_num_tools = (_this select 2) select 0;
_tool_array = (_this select 2) select 1;
} else {
_num_tools = _this select 2;
_tool_array = crate_tools + ai_assault_scope + crate_tools;
};
// RANDOM
if(typeName (_this select 3) == "ARRAY") then {
_num_items = (_this select 3) select 0;
_item_array = (_this select 3) select 1;
} else {
_num_items = _this select 3;
_item_array = crate_random call BIS_fnc_selectRandom;
};
// BACKPACK
if(typeName (_this select 4) == "ARRAY") then {
_num_backpacks = (_this select 4) select 0;
_backpack_array = (_this select 4) select 1;
} else {
_num_backpacks = _this select 4;
_backpack_array = crate_backpacks_all;
};
if(DMS_DEBUG) then {
diag_log format["DMS :: Spawning in a dynamic crate with %1 guns, %2 tools, %3 items and %4 backpacks",_num_weapons,_num_tools,_num_items,_num_backpacks];
};
if(_num_weapons > 0) then {
_num_weapons = (ceil((_num_weapons) / 2) + floor(random (_num_weapons / 2)));
for "_i" from 1 to _num_weapons do {
_weapon = _weapons_array call BIS_fnc_selectRandom;
_ammo = _weapon call find_suitable_ammunition;
_crate addWeaponCargoGlobal [_weapon,1];
_crate addMagazineCargoGlobal [_ammo, (1 + floor(random 5))];
};
};
if(_num_tools > 0) then {
_num_tools = (ceil((_num_tools) / 2) + floor(random (_num_tools / 2)));
for "_i" from 1 to _num_tools do {
_tool = _tool_array call BIS_fnc_selectRandom;
if(typeName (_tool) == "ARRAY") then {
_crate addItemCargoGlobal [_tool select 0,_tool select 1];
} else {
_crate addItemCargoGlobal [_tool,1];
};
};
};
if(_num_items > 0) then {
_num_items = (ceil((_num_items) / 2) + floor(random (_num_items / 2)));
for "_i" from 1 to _num_items do {
_item = _item_array call BIS_fnc_selectRandom;
if(typeName (_item) == "ARRAY") then {
_crate addItemCargoGlobal [_item select 0,_item select 1];
} else {
_crate addItemCargoGlobal [_item,1];
};
};
};
if(_num_backpacks > 0) then {
_num_backpacks = (ceil((_num_backpacks) / 2) + floor(random (_num_backpacks / 2)));
for "_i" from 1 to _num_backpacks do {
_backpack = _backpack_array call BIS_fnc_selectRandom;
if(typeName (_backpack) == "ARRAY") then {
_crate addBackpackCargoGlobal [_backpack select 0,_backpack select 1];
} else {
_crate addBackpackCargoGlobal [_backpack,1];
};
};
};
if(wai_high_value) then {
if(random 100 < wai_high_value_chance) then {
_item = crate_items_high_value call BIS_fnc_selectRandom;
_crate addItemCargoGlobal [_item,1];
};
};

View File

@ -0,0 +1,54 @@
/*
[
_position,
[_completionType,_completionArgs],
[_timeStarted,_timeUntilFail],
[_AIUnit1,_AIUnit2,...,_AIUnitX],
[
[_cleanupObj1,_cleanupObj2,...,_cleanupObjX],
[_crate,_vehicle1,_vehicle2,...,_vehicleX]
],
[_msgWIN,_msgLose]
]
*/
if !(DMS_Mission_Arr isEqualTo []) then {
_index = 0;
{
_index = _index + 1;
call {
if (DMS_DEBUG) then
{
diag_log ("DMS :: Checking Mission Status: "+str _x);
};
_position = _x select 0;
_success = (_x select 1) call MissionSuccessState;
_timeStarted = _x select 2 select 0;
_timeUntilFail = _x select 2 select 1;
_units = _x select 3;
_buildings = _x select 4 select 0;
_loot = _x select 4 select 1;
_msgSuccess = _x select 5 select 0;
_msgFail = _x select 5 select 1;
if (_success) exitWith {
[DMS_CompletedMissionCleanup_Time,DMS_CleanUp,(_units+_buildings),false] call ExileServer_system_thread_addTask;
_arr = DMS_Mission_Arr deleteAt _index;
(_loot select 0) call DMS_FillCrate;
_msgSuccess call DMS_BroadcastMissionStatus;
};
if (DMS_player_reset_timeout && {[_position,DMS_player_reset_timeout_range] call ExileServer_util_position_isPlayerNearby}) exitWith
{
_x set [2,[diag_tickTime,_timeUntilFail]];
};
if ((diag_tickTime-_timeStarted)>_timeUntilFail) exitWith
{
_arr = DMS_Mission_Arr deleteAt _index;
(_units+_buildings+_loot) call DMS_CleanUp;
_msgFail call DMS_BroadcastMissionStatus;
};
};
false;
} count DMS_Mission_Arr;
};

View File

@ -0,0 +1,24 @@
private["_posArray","_radius","_result"];
_posArray = _this select 0;
_radius = _this select 1;
_result = false;
{
if (_result) exitWith {};
_plyr = _x;
if (alive _plyr) then
{
{
if (_plyr distance _x <= _radius) exitWith
{
_result = true;
if (DMS_DEBUG) then
{
diag_log format["DMS :: %1 is within %2m of %3!",_plyr,_radius,_x];
};
};
false;
} count _posArray;
};
false;
} count allPlayers;
_result