Merge branch 'eraser_rewrite'

This commit is contained in:
eraser1 2015-08-31 14:47:03 -05:00
commit d3b5a7170b
40 changed files with 3185 additions and 26 deletions

View File

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

View File

@ -0,0 +1,221 @@
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, dms_main">*/
/*%FSM<HEAD>*/
/*
item0[] = {"",7,210,821.012817,321.000000,829.012817,329.000000,0.000000,""};
item1[] = {"INIT",0,250,516.749146,-106.908607,606.749146,-56.908607,0.000000,"INIT"};
item2[] = {"true",8,218,775.000000,25.000000,875.000000,75.000000,0.000000,"true"};
item3[] = {"Waiting",2,250,775.000000,100.000000,875.000000,150.000000,0.000000,"Waiting"};
item4[] = {"",7,210,596.000000,321.000000,604.000000,329.000000,0.000000,""};
item5[] = {"___min_loop_1",4,218,625.012756,175.000000,725.012756,225.000000,1.000000,"1 min loop"};
item6[] = {"Check_Mission_Running",2,250,624.311890,250.000000,724.311890,300.000000,0.000000,"Check Mission" \n "Running" \n "Status"};
item7[] = {"",7,210,521.000000,321.000000,529.000000,329.000000,0.000000,""};
item8[] = {"___min_loop",4,218,777.816040,173.598328,867.816040,223.598328,2.000000,"1 min loop"};
item9[] = {"",7,210,521.000000,46.000000,529.000000,54.000000,0.000000,""};
item10[] = {"",7,210,670.311951,321.000000,678.311951,329.000000,0.000000,""};
item11[] = {"Mission_Cleanup",2,250,774.311890,250.000000,874.311890,300.000000,0.000000,"Mission Cleanup"};
item12[] = {"INITIALIZE",4,218,655.694763,-107.164581,745.694763,-57.164581,0.000000,"INITIALIZE"};
item13[] = {"PREPARE",2,250,780.348511,-108.565193,870.348511,-58.565193,0.000000,"PREPARE"};
item14[] = {"___Min_loop",4,218,914.967773,173.130890,1004.967773,223.130890,3.000000,"1 Min loop"};
item15[] = {"Select_Mission",2,4346,915.668457,249.519714,1005.668518,299.519714,0.000000,"Select Mission"};
item16[] = {"",7,210,956.270142,321.086121,964.270142,329.086121,0.000000,""};
link0[] = {0,10};
link1[] = {1,12};
link2[] = {2,3};
link3[] = {3,5};
link4[] = {3,8};
link5[] = {3,14};
link6[] = {4,7};
link7[] = {5,6};
link8[] = {6,10};
link9[] = {7,9};
link10[] = {8,11};
link11[] = {9,2};
link12[] = {10,4};
link13[] = {11,0};
link14[] = {12,13};
link15[] = {13,2};
link16[] = {14,15};
link17[] = {15,16};
link18[] = {16,0};
globals[] = {0.000000,0,0,0,0,640,480,2,451,6316128,1,326.983643,1179.875732,440.842163,-196.198654,1217,1041,1};
window[] = {2,-1,-1,-1,-1,784,50,1344,50,3,1235};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "dms_main";
class States
{
/*%FSM<STATE "INIT">*/
class INIT
{
name = "INIT";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "INITIALIZE">*/
class INITIALIZE
{
priority = 0.000000;
to="PREPARE";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Waiting">*/
class Waiting
{
name = "Waiting";
init = /*%FSM<STATEINIT""">*/"// Waiting for next task to proceed with."/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "___Min_loop">*/
class ___Min_loop
{
priority = 3.000000;
to="Select_Mission";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _selectMission) > 60)" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___min_loop">*/
class ___min_loop
{
priority = 2.000000;
to="Mission_Cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _cleanupTime) > 60)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_cleanupTime = time;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___min_loop_1">*/
class ___min_loop_1
{
priority = 1.000000;
to="Check_Mission_Running";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _missionsMonitor) > 60)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_missionsMonitor = time;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Check_Mission_Running">*/
class Check_Mission_Running
{
name = "Check_Mission_Running";
init = /*%FSM<STATEINIT""">*/"if(DMS_DEBUG) then {" \n
" diag_log format [""DMS_DEBUG FSM CHECK :: calling DMS_MissionsMonitor""];" \n
"};" \n
"" \n
"_missionsMonitor = diag_tickTime;" \n
"call DMS_MissionsMonitor;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Mission_Cleanup">*/
class Mission_Cleanup
{
name = "Mission_Cleanup";
init = /*%FSM<STATEINIT""">*/"if(DMS_DEBUG) then {" \n
" diag_log format [""DMS_DEBUG FSM CHECK :: calling DMS_CleanUpManager""];" \n
"};" \n
"" \n
"_cleanupTime = diag_tickTime;" \n
"call DMS_CleanUpManager;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "PREPARE">*/
class PREPARE
{
name = "PREPARE";
init = /*%FSM<STATEINIT""">*/"private [""_missionsMonitor"",""_cleanupTime"",""_selectMission""];" \n
"diag_log (""DMS :: Initializing FSM mission script"");" \n
"" \n
"_missionsMonitor = diag_tickTime;" \n
"_cleanupTime = diag_tickTime;" \n
"_selectMission = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Select_Mission">*/
class Select_Mission
{
name = "Select_Mission";
init = /*%FSM<STATEINIT""">*/"if(DMS_DEBUG) then {" \n
" diag_log format [""DMS_DEBUG FSM CHECK :: calling DMS_selectMission""];" \n
"};" \n
"" \n
"_selectMission = diag_tickTime;" \n
"call DMS_selectMission;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="INIT";
finalStates[] =
{
};
};
/*%FSM</COMPILE>*/

View File

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

View File

@ -2,18 +2,22 @@ class CfgPatches {
class A3_dms {
units[] = {};
weapons[] = {};
a3_DMS_version = 1.0;
a3_DMS_version = 2.0;
requiredVersion = 1.36;
requiredAddons[] = {};
requiredAddons[] = {"exile_client","exile_server_config"};
};
};
class CfgFunctions {
class dms {
class main {
file = "\x\addons\dms";
class start_dms {
class DMS_preInit
{
preInit = 1;
};
class DMS_postInit {
postInit = 1;
};
};
};
};
};

View File

@ -0,0 +1,520 @@
/*
A lot of these configs are influenced from WAI :P
https://github.com/nerdalertdk/WICKED-AI
Created by eraser1
*/
DMS_DEBUG = false;
/* Mission System Settings */
DMS_DynamicMission = true; // Enable/disable dynamic mission system
DMS_MaxBanditMissions = 3; // Maximum number of Bandit Missions
DMS_StaticMission = false; // Enable/disable static missions
DMS_TimeBetweenMissions = [600,900]; // [Minimum,Maximum] time between missions (if mission limit is not reached) | DEFAULT: 10-15 mins
DMS_MissionTimeOut = [900,1800]; // [Minimum,Maximum] time it will take for a mission to timeout | Default: 15-30 mins
DMS_playerNearRadius = 75; // How close a player has to be to a mission in order to satisfy the "playerNear" mission requirement (can be customized per mission).
DMS_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement (NOT IMPLEMENTED)
DMS_BanditMoneyGainOnKill = 250; // The amount of Poptabs gained for killing a bandit
DMS_BanditRepGainOnKill = 100; // The amount of Respect gained for killing a bandit
DMS_MissionMarkerWinDot = true; // Keep the mission marker dot with a "win" message after mission is over
DMS_MissionMarkerLoseDot = true; // Keep the mission marker dot with a "lose" message after mission is over
DMS_MissionMarkerWinDotTime = 30; // How many seconds the "win" mission dot will remain on the map
DMS_MissionMarkerLoseDotTime = 30; // How many seconds the "lose" mission dot will remain on the map
DMS_MissionMarkerWinDotColor = "ColorBlue"; // The color of the "win" marker dot
DMS_MissionMarkerLoseDotColor = "ColorRed"; // The color of the "lose" marker dot
DMS_CompletedMissionCleanup = true; // Cleanup mission-spawned buildings and AI bodies after some time
DMS_CompletedMissionCleanupTime = 3600; // Minimum time until mission-spawned buildings and AI are cleaned up
DMS_CleanUp_PlayerNearLimit = 20; // Cleanup of an object is aborted if a player is this many meters close to the object
DMS_MissionTimeoutReset = true; // Enable mission timeout timer reset if a player is close
DMS_MissionTimeoutResetRange = 1000; // If a player is this close to a mission then it won't time-out
DMS_PlayerNearBlacklist = 2000; // Missions won't spawn in a position this many meters close to a player
DMS_SpawnZoneNearBlacklist = 2500; // Missions won't spawn in a position this many meters close to a spawn zone
DMS_TraderZoneNearBlacklist = 3000; // Missions won't spawn in a position this many meters close to a trader zone
DMS_MissionNearBlacklist = 4000; // Missions won't spawn in a position this many meters close to another mission
DMS_WaterNearBlacklist = 750; // Missions won't spawn in a position this many meters close to water
DMS_SpawnBoxSmoke = true; // Spawn a smoke grenade on mission box upon misson completion
DMS_SpawnBoxIRGrenade = true; // Spawn an IR grenade on mission box upon misson completion
DMS_MinPlayerCount = 0; // Minimum number of players until mission start
DMS_MinServerFPS = 10; // Minimum server FPS for missions to start
//Mission notification settings
DMS_PlayerNotificationTypes = [ // Notification types. Supported values are: ["dynamicTextRequest", "standardHintRequest", "systemChatRequest"]
"dynamicTextRequest",
"systemChatRequest"
];
DMS_dynamicText_Size = "0.55"; // Dynamic Text size for "dynamicTextRequest" notification type.
DMS_dynamicText_Color = "#FFCC00"; // Dynamic Text color for "dynamicTextRequest" notification type.
DMS_MissionTypes = [ // List of missions with spawn chances. If they add up to 100%, they represent the percentage chance each one will spawn
["mission1",25],
["mission2",50],
["mission3",15],
["mission4",10]
];
DMS_findSafePosBlacklist = [ // For BIS_fnc_findSafePos position blacklist info refer to: https://community.bistudio.com/wiki/BIS_fnc_findSafePos
];
/* Mission System Settings */
/* AI Settings */
DMS_banditSide = EAST; // The side (team) that AI Bandits will spawn on
DMS_clear_AI_body = false; // Clear AI body as soon as they die
DMS_remove_roadkill = false; // Remove gear from AI bodies that are roadkilled
DMS_remove_roadkill_chance = 0; // Percentage chance that roadkilled AI bodies will be deleted
DMS_RemoveNVG = false; // Remove NVGs from AI bodies
DMS_ai_offload_to_client = true; // Offload spawned AI groups to random clients. Helps with server performance.
DMS_ai_share_info = true; // Share info about killer
DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI
DMS_ai_nighttime_accessory_chance = 75; // Percentage chance that AI will have a flashlight or laser pointer on their guns if spawned during nighttime
DMS_ai_enable_water_equipment = true; // Enable/disable overriding default weapons of an AI if it spawns on/in water
// https://community.bistudio.com/wiki/AI_Sub-skills#general
DMS_ai_static_skills = true; // Use "DMS_ai_skill_static" for AI on static guns
DMS_ai_skill_static = [["aimingAccuracy",0.20],["aimingShake",0.70],["aimingSpeed",0.75],["spotDistance",0.70],["spotTime",0.50],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",1.00]]; // Static AI Skills
DMS_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
DMS_ai_skill_moderate = [["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]]; // Moderate
DMS_ai_skill_difficult = [["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]]; // Difficult
DMS_ai_skill_hardcore = [["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]]; // Hardcore
DMS_ai_skill_random = ["hardcore","difficult","difficult","difficult","moderate","moderate","moderate","moderate","easy","easy"]; // Skill frequencies for "random" AI skills | Default: 10% hardcore, 30% difficult, 40% moderate, and 20% easy
DMS_AI_WP_Radius_easy = 20; // Waypoint radius for "easy" AI
DMS_AI_WP_Radius_moderate = 40; // Waypoint radius for "moderate" AI
DMS_AI_WP_Radius_difficult = 75; // Waypoint radius for "difficult" AI
DMS_AI_WP_Radius_hardcore = 150; // Waypoint radius for "hardcore" AI
DMS_static_weapons = [ // Static weapons for AI
"O_HMG_01_F",
"O_HMG_01_high_F"
];
DMS_ai_default_items = [ // Toolbelt items each AI will spawn with
"ItemWatch",
"ItemMap",
"ItemCompass",
"ItemRadio"
];
DMS_ai_BipodList = [
"bipod_01_F_blk",
"bipod_01_F_mtp",
"bipod_01_F_snd",
"bipod_02_F_blk",
"bipod_02_F_hex",
"bipod_02_F_tan",
"bipod_03_F_blk",
"bipod_03_F_oli"
];
//Assault Class
DMS_assault_weps = [ // Assault Rifles
"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"
];
DMS_assault_pistols = [ // Pistols for Assault Class (Set to empty array if you don't want to give them any pistols)
"hgun_ACPC2_F",
"hgun_Rook40_F",
"hgun_P07_F",
"hgun_Pistol_heavy_01_F",
"hgun_Pistol_heavy_02_F"
];
DMS_assault_optics = [ // Optics for Assault Class
"optic_Arco",
"optic_Hamr",
"optic_Aco",
"optic_Holosight",
"optic_MRCO",
"optic_DMS"
];
DMS_assault_optic_chance = 75; // Percentage chance that an Assault Class AI will get an optic
DMS_assault_bipod_chance = 25; // Percentage chance that an Assault Class AI will get a bipod
DMS_assault_suppressor_chance = 25; // Percentage chance that an Assault Class AI will get a suppressor
DMS_assault_items = [ // Items for Assault Class AI (Loot stuff that goes in uniform/vest/backpack)
"Exile_Item_InstaDoc",
"Exile_Item_BBQSandwich",
"Exile_Item_Energydrink"
];
DMS_assault_equipment = [ // Equipment for Assault Class AI (stuff that goes in toolbelt slots)
"ItemGPS"
];
DMS_assault_helmets = [ // Helmets for Assault Class
"H_HelmetSpecB_paint1",
"H_HelmetIA_camo",
"H_HelmetLeaderO_ocamo",
"H_HelmetLeaderO_oucamo"
];
DMS_assault_clothes = [ // Uniforms for Assault Class
"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"
];
DMS_assault_vests = [ // Vests for Assault Class
"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"
];
DMS_assault_backpacks = [ // Backpacks for Assault Class
"B_Bergen_rgr",
"B_Carryall_oli",
"B_Kitbag_mcamo",
"B_Carryall_cbr",
"B_FieldPack_oucamo",
"B_FieldPack_cbr",
"B_Bergen_blk"
];
//Machine Gun Class
DMS_MG_weps = [ // Machine Guns
"LMG_Zafir_F",
"LMG_Mk200_F",
"arifle_MX_SW_Black_F",
"MMG_01_hex_F"
];
DMS_MG_pistols = [ // Pistols for MG Class (Set to empty array if you don't want to give them any pistols)
"hgun_ACPC2_F",
"hgun_Rook40_F",
"hgun_P07_F",
"hgun_Pistol_heavy_01_F",
"hgun_Pistol_heavy_02_F"
];
DMS_MG_optics = [ // Optics for MG Class
"optic_Hamr",
"optic_Aco",
"optic_Holosight",
"optic_MRCO"
];
DMS_MG_optic_chance = 50; // Percentage chance that an MG Class AI will get an optic
DMS_MG_bipod_chance = 90; // Percentage chance that an MG Class AI will get a bipod
DMS_MG_suppressor_chance = 10; // Percentage chance that an MG Class AI will get a suppressor
DMS_MG_items = [ // Items for MG Class AI (Loot stuff that goes in uniform/vest/backpack)
"Exile_Item_InstaDoc",
"Exile_Item_Catfood_Cooked",
"Exile_Item_PlasticBottleFreshWater",
"Exile_Item_CookingPot"
];
DMS_MG_equipment = [ // Equipment for MG Class AI (stuff that goes in toolbelt slots)
"Binocular"
];
DMS_MG_helmets = [ // Helmets for MG Class
"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"
];
DMS_MG_clothes = [ // Uniforms for MG Class
"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"
];
DMS_MG_vests = [ // Vests for MG Class
"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",
"V_HarnessO_brn",
"V_HarnessO_gry"
];
DMS_MG_backpacks = [ // Backpacks for MG Class
"B_Bergen_rgr",
"B_Carryall_oli",
"B_Kitbag_mcamo",
"B_Carryall_cbr",
"B_Bergen_blk"
];
//Sniper Class
DMS_sniper_weps = [ // Sniper Rifles
"srifle_EBR_F",
"srifle_DMR_01_F",
"srifle_GM6_F",
"srifle_LRR_F",
"arifle_MXM_F",
"arifle_MXM_Black_F",
"srifle_DMR_02_F"
];
DMS_sniper_pistols = [ // Pistols for Sniper Class (Set to empty array if you don't want to give them any pistols)
"hgun_ACPC2_F",
"hgun_Rook40_F",
"hgun_P07_F",
"hgun_Pistol_heavy_01_F",
"hgun_Pistol_heavy_02_F"
];
DMS_sniper_optics = [ // Optics for Sniper Class
"optic_SOS",
"optic_DMS",
"optic_LRPS"
];
DMS_sniper_optic_chance = 100; // Percentage chance that a Sniper Class AI will get an optic
DMS_sniper_bipod_chance = 90; // Percentage chance that a Sniper Class AI will get a bipod
DMS_sniper_suppressor_chance = 15; // Percentage chance that a Sniper Class AI will get a suppressor
DMS_sniper_items = [ // Items for Sniper Class AI (Loot stuff that goes in uniform/vest/backpack)
"Exile_Item_InstaDoc",
"Exile_Item_Surstromming_Cooked",
"Exile_Item_PlasticBottleFreshWater",
"Exile_Item_PlasticBottleFreshWater",
"Exile_Item_Matches"
];
DMS_sniper_equipment = [ // Equipment for Sniper Class AI (stuff that goes in toolbelt slots)
"Rangefinder",
"ItemGPS"
];
DMS_sniper_helmets = [ // Helmets for Sniper Class
"H_HelmetSpecB_paint1",
"H_HelmetIA_camo",
"H_HelmetLeaderO_ocamo",
"H_HelmetLeaderO_oucamo"
];
DMS_sniper_clothes = [ // Uniforms for Sniper Class
"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"
];
DMS_sniper_vests = [ // Vests for Sniper Class
"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",
"V_HarnessO_brn",
"V_HarnessO_gry"
];
DMS_sniper_backpacks = [ // Backpacks for Sniper Class
"B_Bergen_rgr",
"B_Carryall_oli",
"B_Kitbag_mcamo",
"B_Carryall_cbr",
"B_Bergen_blk"
];
DMS_ai_SupportedClasses = [ // Allowed AI classes. If you want to create your own class, make sure you define everything as I've defined above, and add it here
"assault",
"MG",
"sniper"
];
DMS_random_AI = [ // The classes that a "random" AI can spawn as | DEFAULT: 60% Assault, 20% MG, 20% Sniper
"assault",
"assault",
"assault",
"MG",
"sniper"
];
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_launcher_ammo_count = 2; // How many rockets an AI will get with its launcher
DMS_ai_remove_launchers = false; // Remove rocket launchers on AI death
DMS_AI_wep_launchers_AT = [ // AT Launchers
"launch_NLAW_F",
"launch_RPG32_F",
"launch_B_Titan_short_F"
];
DMS_AI_wep_launchers_AA = [ // AA Launchers
"launch_B_Titan_F"
];
/* AI Settings */
/* Loot Settings */
DMS_BoxWeapons = [ //List of weapons that can potentially spawn in a crate
"Exile_Melee_Axe",
"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",
"LMG_Zafir_F",
"LMG_Mk200_F",
"arifle_MX_SW_Black_F",
"MMG_01_hex_F",
"srifle_EBR_F",
"srifle_DMR_01_F",
"srifle_GM6_F",
"srifle_LRR_F",
"arifle_MXM_F",
"arifle_MXM_Black_F",
"srifle_DMR_02_F"
];
DMS_BoxSurvivalSupplies = [ //List of survival supplies (food/drink/meds)
"Exile_Item_Catfood_Cooked",
"Exile_Item_SausageGravy_Cooked",
"Exile_Item_BBQSandwich_Cooked",
"Exile_Item_PlasticBottleFreshWater",
"Exile_Item_PlasticBottleFreshWater",
"Exile_Item_Matches",
"Exile_Item_CookingPot"
];
DMS_BoxBuildingSupplies = [ //List of building supplies
"Exile_Item_CamoTentKit",
"Exile_Item_MetalPole",
"Exile_Item_MetalBoard",
"Exile_Item_LightBulb",
"Exile_Item_JunkMetal",
"Exile_Item_ExtensionCord",
"Exile_Item_DuctTape"
];
DMS_BoxOptics = [
"optic_Arco",
"optic_Hamr",
"optic_Aco",
"optic_Holosight",
"optic_MRCO",
"optic_SOS",
"optic_DMS",
"optic_LRPS",
"optic_Nightstalker"
];
DMS_BoxBackpacks = [ //List of backpacks that can potentially spawn in a crate
"B_Bergen_rgr",
"B_Carryall_oli",
"B_Kitbag_mcamo",
"B_Carryall_cbr",
"B_FieldPack_oucamo",
"B_FieldPack_cbr",
"B_Bergen_blk"
];
DMS_BoxItems = DMS_BoxSurvivalSupplies+DMS_BoxBuildingSupplies+DMS_BoxOptics; // Random "items" can spawn optics, survival supplies, or building supplies
DMS_RareLoot = true; // Potential chance to spawn rare loot in any crate.
DMS_RareLootList = [ // List of rare loot to spawn
"Exile_Item_SafeKit",
"Exile_Item_CodeLock"
];
DMS_RareLootChance = 10; // Percentage Chance to spawn rare loot in any crate | Default: 10%
// Vehicles
DMS_ArmedVehicles = [ // List of armed vehicles that can spawn
"Exile_Car_Offroad_Armed_Guerilla01"
];
DMS_MilitaryVehicles = [ // List of military vehicles that can spawn
"Exile_Car_Strider",
"Exile_Car_Hunter",
"Exile_Car_Ifrit"
];
DMS_TransportTrucks = [ // List of transport trucks that can spawn
"Exile_Car_Van_Guerilla01",
"Exile_Car_Van_Black"
];
DMS_RefuelTrucks = [ // List of refuel trucks that can spawn
"Exile_Car_Van_Fuel_Black",
"Exile_Car_Van_Fuel_White",
"Exile_Car_Van_Fuel_Red",
"Exile_Car_Van_Fuel_Guerilla01",
"Exile_Car_Van_Fuel_Guerilla02",
"Exile_Car_Van_Fuel_Guerilla03"
];
DMS_CivilianVehicles = [ // List of civilian vehicles that can spawn
"Exile_Car_SUV_Red",
"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"
];
DMS_TransportHelis = [ // List of transport helis that can spawn
"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"
];
/* Loot Settings */
// Debug Overwrites
if(DMS_DEBUG) then {
DMS_TimeBetweenMissions = [30,60];
DMS_MissionTimeOut = [240,300];
diag_log format ["DMS_DEBUG CONFIG :: Overriding DMS_TimeBetweenMissions (%1) and DMS_MissionTimeOut (%2)",DMS_TimeBetweenMissions,DMS_MissionTimeOut];
};

View File

@ -0,0 +1,25 @@
/*
Launches mission functions
Made for Defent for Defents Mission System
And for Numenadayz.com
Written by eraser1
[_delay, _function, _params, _persistance] call ExileServer_system_thread_addTask;
*/
RESISTANCE setFriend[WEST,0];
WEST setFriend[RESISTANCE,0];
RESISTANCE setFriend[EAST,0];
EAST setFriend[RESISTANCE,0];
EAST setFriend[WEST,0];
WEST setFriend[EAST,0];
if(DMS_StaticMission) then {
call compileFinal preprocessFileLineNumbers "\x\addons\dms\static\static_init.sqf";//<---- TODO
};
if (DMS_DynamicMission) then {
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_init.sqf";
execFSM "\x\addons\dms\FSM\missions.fsm";
};

View File

@ -0,0 +1,38 @@
/*
DMS Pre-init (compiles)
Written by eraser1 (trainwreckdayz.com)
*/
/* compiles
spawn_static = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_static.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";
vehicle_monitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_monitor.sqf";
*/
//Completed or WIP
DMS_selectMission = compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\SelectMission.sqf";
DMS_MissionsMonitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionsMonitor.sqf";
DMS_MissionSuccessState = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\MissionSuccessState.sqf";
DMS_findSafePos = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FindSafePos.sqf";
DMS_BroadcastMissionStatus = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\BroadcastMissionStatus.sqf";
DMS_CleanUp = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CleanUp.sqf";
DMS_CleanUpManager = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CleanUpManager.sqf";
DMS_isPlayerNearbyARRAY = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\IsPlayerNearbyARRAY.sqf";
DMS_FillCrate = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FillCrate.sqf";
DMS_isNearWater = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\IsNearWater.sqf";
DMS_RemoveMarkers = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\RemoveMarkers.sqf";
DMS_selectMagazine = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SelectMagazine.sqf";
DMS_TargetsKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\TargetsKilled.sqf";
DMS_SpawnAIGroup = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnAIGroup.sqf";
DMS_SpawnAISoldier = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnAISoldier.sqf";
DMS_OnKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\OnKilled.sqf";
DMS_SetGroupBehavior = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetGroupBehavior.sqf";
DMS_AddMissionToMonitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\AddMissionToMonitor.sqf";
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CreateMarker.sqf";
DMS_FindSuppressor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FindSuppressor.sqf";//<--- TODO add new suppressors
DMS_SpawnCrate = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnCrate.sqf";
//Load config
call compileFinal preprocessFileLineNumbers "\x\addons\dms\config.sqf";

View File

@ -1,2 +0,0 @@
[] execVM "\x\addons\dms\dms_init.sqf";
diag_log format ["DMS :: Loading Defents Mission System"];

View File

@ -0,0 +1,35 @@
/*
DMS_selectMission
Influenced by WAI
Created by eraser1
Selects/Spawns missions. Takes no arguments, returns nothing.
*/
private "_time";
_time = diag_tickTime;
if (DMS_RunningBMissionCount isEqualTo DMS_MaxBanditMissions) then
{
DMS_BMissionLastStart = _time;
};
if ((_time - DMS_BMissionLastStart > DMS_BMissionDelay) && {diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}}) then
{
private "_mission";
DMS_MissionCount = DMS_MissionCount + 1;
DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1;
DMS_BMissionLastStart = _time;
_mission = DMS_MissionTypesArray call BIS_fnc_selectRandom;
DMS_BMissionDelay = (DMS_TimeBetweenMissions select 0) + random((DMS_TimeBetweenMissions select 1) - (DMS_TimeBetweenMissions select 0));
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SelectMission :: Spawning mission: %1 | DMS_BMissionDelay set to %2",_mission,DMS_BMissionDelay];
};
call compile preprocessFileLineNumbers (format ["\x\addons\DMS\missions\%1.sqf",_mission]);
};

View File

@ -0,0 +1,149 @@
/*
Sample mission
Created by Defent and eraser1
Called from DMS_selectMission
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
// Set mission side (only "bandit" is supported for now)
_side = "bandit";
// find position
_pos = [10,100] call DMS_findSafePos;
// Set general mission difficulty
_difficulty = "moderate";
// Create AI
// TODO: Spawn AI only when players are nearby
_AICount = 6 + (round (random 2));
_group =
[
_pos, // Position of AI
_AICount, // Number of AI
"random", // "random","hardcore","difficult","moderate", or "easy"
"random", // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
_side // "bandit","hero", etc.
] call DMS_SpawnAIGroup;
// Create Crate
_crate = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
// Set crate loot values
_crate_loot_values =
[
5, // Weapons
10, // Items
3 // Backpacks
];
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group";
// Create Markers
_markers =
[
_pos,
_missionName,
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
[
[
"kill",
_group
],
[
"playerNear",
[_pos,DMS_playerNearRadius]
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
// Notify players
_msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -0,0 +1,146 @@
/*
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
// Set mission side (only "bandit" is supported for now)
_side = "bandit";
// find position
_pos = call DMS_findSafePos;
// Set general mission difficulty
_difficulty = "easy";
// Create AI
// TODO: Spawn AI only when players are nearby
_AICount = 6 + (round (random 2));
_group =
[
_pos, // Position of AI
_AICount, // Number of AI
"random", // "random","hardcore","difficult","moderate", or "easy"
"random", // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
_side // "bandit","hero", etc.
] call DMS_SpawnAIGroup;
// Create Crate
_crate = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
// Set crate loot values
_crate_loot_values =
[
5, // Weapons
10, // Items
3 // Backpacks
];
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group2";
// Create Markers
_markers =
[
_pos,
_missionName,
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
[
[
"kill",
_group
],
[
"playerNear",
[_pos,DMS_playerNearRadius]
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
// Notify players
_msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -0,0 +1,146 @@
/*
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
// Set mission side (only "bandit" is supported for now)
_side = "bandit";
// find position
_pos = call DMS_findSafePos;
// Set general mission difficulty
_difficulty = "difficult";
// Create AI
// TODO: Spawn AI only when players are nearby
_AICount = 6 + (round (random 2));
_group =
[
_pos, // Position of AI
_AICount, // Number of AI
"random", // "random","hardcore","difficult","moderate", or "easy"
"random", // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
_side // "bandit","hero", etc.
] call DMS_SpawnAIGroup;
// Create Crate
_crate = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
// Set crate loot values
_crate_loot_values =
[
5, // Weapons
10, // Items
3 // Backpacks
];
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group3";
// Create Markers
_markers =
[
_pos,
_missionName,
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
[
[
"kill",
_group
],
[
"playerNear",
[_pos,DMS_playerNearRadius]
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
// Notify players
_msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -0,0 +1,146 @@
/*
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_missionAIUnits", "_missionObjs", "_markers", "_time", "_added"];
// For logging purposes
_num = DMS_MissionCount;
// Set mission side (only "bandit" is supported for now)
_side = "bandit";
// find position
_pos = call DMS_findSafePos;
// Set general mission difficulty
_difficulty = "hardcore";
// Create AI
// TODO: Spawn AI only when players are nearby
_AICount = 6 + (round (random 2));
_group =
[
_pos, // Position of AI
_AICount, // Number of AI
"random", // "random","hardcore","difficult","moderate", or "easy"
"random", // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
_side // "bandit","hero", etc.
] call DMS_SpawnAIGroup;
// Create Crate
_crate = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate;
// Set crate loot values
_crate_loot_values =
[
5, // Weapons
10, // Items
3 // Backpacks
];
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
[], // No spawned buildings
[_crate],
_crate_loot_values
];
// Define Mission Start message
_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos];
// Define Mission Win message
_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos];
// Define Mission Lose message
_msgLOSE = format["The mercenaries are no longer at %1!",mapGridPosition _pos];
// Define mission name (for map marker and logging)
_missionName = "Mercenary Group4";
// Create Markers
_markers =
[
_pos,
_missionName,
_difficulty
] call DMS_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
[
[
"kill",
_group
],
[
"playerNear",
[_pos,DMS_playerNearRadius]
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
false;
} count _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
_cleanup call DMS_CleanUp;
// Delete the markers directly
{deleteMarker _x;false;} count _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
// Notify players
_msgStart call DMS_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -0,0 +1,31 @@
/*
DMS: mission_init.sqf
Created by eraser1
Initializes variables for DMS
*/
diag_log "DMS :: Initializing Mission Variables";
// Initialize Variables
DMS_Mission_Arr = [];
DMS_CleanUpList = [];
DMS_MissionCount = 0;
DMS_RunningBMissionCount = 0;
DMS_BMissionLastStart = diag_tickTime;
DMS_BMissionDelay = (DMS_TimeBetweenMissions select 0) + random((DMS_TimeBetweenMissions select 1) - (DMS_TimeBetweenMissions select 0));
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG mission_init :: Random time between missions is initially set to %1s | DMS_BMissionLastStart: %2",DMS_BMissionDelay,DMS_BMissionLastStart];
};
// Set mission frequencies from config
DMS_MissionTypesArray = [];
{
for "_i" from 1 to (_x select 1) do {
DMS_MissionTypesArray pushBack (_x select 0);
};
false;
} count DMS_MissionTypes;

View File

@ -0,0 +1,178 @@
/*
DMS_AddMissionToMonitor
Created by eraser1
Parses and adds mission information to "DMS_Mission_Arr" for Mission Monitoring.
Usage:
[
_position,
[
[
_completionType1,
_completionArgs1
],
[
_completionType2,
_completionArgs3
],
...
[
_completionTypeN,
_completionArgsN
],
],
[
_timeStarted,
_timeUntilFail
],
[
_AIUnitOrGroup1,
_AIUnitOrGroup2,
...,
_AIUnitOrGroupN
],
[
[_cleanupObj1,_cleanupObj2,...,_cleanupObjX],
[_crate,_vehicle1,_vehicle2,...,_vehicleX],
_crate_loot_values
],
[_msgWIN,_msgLose],
[_markerDot,_markerCircle],
_side
] call DMS_AddMissionToMonitor;
Returns whether or not info was added successfully
"_completionInfo", "_timeOutInfo", "_inputUnits", "_missionObjs", "_messages", "_markers", "_side", "_timeStarted", "_timeUntilFail"
*/
private ["_added", "_pos", "_OK", "_completionInfo", "_timeOutInfo", "_inputUnits", "_missionObjs", "_messages", "_markers", "_timeStarted", "_timeUntilFail", "_buildings", "_loot", "_crate_loot_values", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_side","_arr"];
_added = false;
_OK = params
[
["_pos","",[[]],[2,3]],
["_completionInfo","",[[]]],
["_timeOutInfo","",[[]],[1,2]],
["_inputUnits","",[[]]],
["_missionObjs","",[[]],[3]],
["_messages","",[[]],[2]],
["_markers","",[[]],[2]],
["_side","bandit",[""]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_AddMissionToMonitor with invalid parameters: %1",_this];
false;
};
try
{
if (_completionInfo isEqualTo []) then
{
throw "_completionInfo is empty!";
};
_timeOutInfo params
[
["_timeStarted",diag_tickTime,[0]],
["_timeUntilFail",(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0)),[0]]
];
_units = [];
{
if (((typeName _x) == "OBJECT") && {!isNull _x}) then
{
_units pushBack _x;
}
else
{
if (((typeName _x) == "GROUP") && {!isNull _x}) then
{
{
_units pushBack _x;
false;
} count (units _x);
};
};
false;
} count _inputUnits;
_OK = _missionObjs params
[
["_buildings","",[[]]],
["_loot","",[[]]],
["_crate_loot_values","",[[]],[3]]
];
if (!_OK) then
{
throw format["_missionObjs |%1|",_missionObjs];
};
_OK = _messages params
[
["_msgWIN","",[""]],
["_msgLose","",[""]]
];
if (!_OK) then
{
throw format["_messages |%1|",_messages];
};
_OK = _markers params
[
["_markerDot","",[""]],
["_markerCircle","",[""]]
];
if (!_OK) then
{
throw format["_markers |%1|",_markers];
};
_arr =
[
_pos,
_completionInfo,
[
_timeStarted,
_timeUntilFail
],
_units,
[
_buildings,
_loot,
_crate_loot_values
],
[
_msgWIN,
_msgLose
],
[
_markerDot,
_markerCircle
],
_side
];
DMS_Mission_Arr pushBack _arr;
_added = true;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG AddMissionToMonitor :: Added |%1| to DMS_Mission_Arr!",_arr];
};
}
catch
{
diag_log format ["DMS_AddMissionToMonitor ERROR :: Invalid parameter: %1",_exception];
};
_added

View File

@ -0,0 +1,35 @@
/*
DMS_BroadcastMissionStatus
Created by eraser1
Usage:
_message call DMS_BroadcastMissionStatus;
Requires "DMS_PlayerNotificationTypes".
Notification type "dynamicTextRequest" requires "DMS_dynamicText_Size" and "DMS_dynamicText_Color".
*/
if (DMS_DEBUG) then
{
diag_log format["DMS_DEBUG BroadcastMissionStatus :: Notification types: |%1| for broadcasting mission status: %2",DMS_PlayerNotificationTypes,_this];
};
if ((typeName _this) != "STRING") then
{
_this = str _this;
};
{
private "_args";
_args = // Only include extra parameters if using "dynamicTextRequest"
[
[_x, [_this]],
[_x, [_this,0,DMS_dynamicText_Size,DMS_dynamicText_Color]]
] select (_x == "dynamicTextRequest");
_args call ExileServer_system_network_send_broadcast;
false;
} count DMS_PlayerNotificationTypes;

View File

@ -0,0 +1,119 @@
/*
DMS_CleanUp
Created by eraser1
Usage:
[
_objectOrGroup1,
_objectOrGroup2,
...
_objectOrGroupN
] call DMS_CleanUp;
Alternative Usage:
_objectOrGroup call DMS_CleanUp;
*/
if (DMS_DEBUG) then
{
diag_log ("DMS_DEBUG CleanUp :: CLEANING UP: "+str _this);
};
if !((typeName _this) == "ARRAY") then
{
if (DMS_DEBUG) then
{
diag_log ("DMS_DEBUG CleanUp :: Converting single object into array: "+str _this);
};
_this = [_this];
};
/*
if ([_this,20] call DMS_isPlayerNearbyARRAY) exitWith //<-----Not sure if it's more/less efficient
{
[30, DMS_CleanUp, _this, false] call ExileServer_system_thread_addTask;
};
*/
private ["_skippedObjects","_clean"];
_skippedObjects = [];
_clean =
{
_this enableSimulationGlobal 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";
deleteVehicle _this;
};
{
if ((typeName _x) == "OBJECT") then
{
if (isNull _x) exitWith {};
if !([_x,DMS_CleanUp_PlayerNearLimit] call ExileServer_util_position_isPlayerNearby) then
{
_x call _clean;
}
else
{
_skippedObjects pushBack _x;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG CleanUp :: Skipping cleanup for |%1|, player within %2 meters!",_x,DMS_CleanUp_PlayerNearLimit];
};
};
}
else
{
if ((typeName _x) == "GROUP") exitWith
{
if (!isNull _x) then
{
// Group cleanup should only be called when it has to be deleted regardless, so no need to check for nearby players
{
_x call _clean;
false;
} count (units _x);
if(local _x)then
{
deleteGroup _x;
}
else
{
[groupOwner _x,"DeleteGroupPlz",[_x]] call ExileServer_system_network_send_to;
};
};
};
if ((typeName _x) == "ARRAY") exitWith
{
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG CleanUp :: Doing recursive call for ARRAY: %1",_x];
};
_x call DMS_CleanUp;
};
diag_log format ["DMS ERROR :: Attempted to call DMS_CleanUp on non- group or object %1 from array %2",_x,_this];
};
false;
} count _this;
if !(_skippedObjects isEqualTo []) then
{
DMS_CleanUpList pushBack [_skippedObjects,diag_tickTime,30];
};

View File

@ -0,0 +1,55 @@
/*
DMS_CleanUpManager
Created by eraser1
Objects to be cleaned up together have an entry in "DMS_CleanUpList"
The list is formatted as:
[
[
_objectToClean1,
_objectToClean2,
...
_objectToCleanN
],
_timeAddedToList,
_timeUntilClean
]
A single object can also be used for (_this select 0)
*/
if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to clean :)
{
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG CleanUpManager :: Checking Cleaning Status for: %1",_x];
};
private ["_objs","_timeAddedToList","_timeUntilClean"];
_OK = params
[
["_objs",[objNull],[objNull,[]]],
["_timeAddedToList",diag_tickTime,[0]],
["_timeUntilClean",DMS_CompletedMissionCleanupTime,[0]]
];
if (!_OK) then
{
diag_log format ["DMS ERROR :: Invalid parameters for DMS_CleanUpManager: %1 replaced with %2",_x,[_objs,_timeAddedToList,_timeUntilClean]];
};
if ((diag_tickTime-_timeAddedToList)>=_timeUntilClean) then
{
_objs call DMS_CleanUp;
}
else
{
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG CleanUpManager :: %1 is not yet ready to clean!",_x];
};
};
false;
} count DMS_CleanUpList;

View File

@ -0,0 +1,66 @@
/*
DMS_CreateMarker
Created by Defent and eraser1
Usage:
[
_pos, // Array: Position of the markers
_text, // String: The text on the map marker that will appear on the map
_difficulty, // !!!OPTIONAL!!! String: "hardcore","difficult","moderate", "easy", OR custom color
] call DMS_CreateMarker;
Returns markers in format:
[
_markerDot,
_markerCircle
]
*/
private["_pos", "_text", "_difficulty", "_num", "_color", "_dot", "_circle"];
params
[
["_pos","ERROR",[[]],[2,3]],
["_text","ERROR",[""]],
["_difficulty","moderate",[""]]
];
if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_CreateMarker with invalid parameters: %1",_this];
[];
};
_num = DMS_MissionCount;
call
{
if(_difficulty == "easy") exitWith {_color = "ColorGreen"};
if(_difficulty == "moderate") exitWith {_color = "ColorYellow"};
if(_difficulty == "difficult") exitWith {_color = "ColorRed"};
if(_difficulty == "hardcore") exitWith {_color = "ColorBlack"};
_color = _difficulty;
};
_circle = createMarker [format ["DMS_MissionMarkerCircle%1",_num], _pos];
_circle setMarkerColor _color;
_circle setMarkerShape "ELLIPSE";
_circle setMarkerBrush "Grid";
_circle setMarkerSize [150,150];
_dot = createMarker [format ["DMS_MissionMarkerDot%1",_num], _pos];
_dot setMarkerColor "ColorBlack";
_dot setMarkerType "mil_dot";
_dot setMarkerText _text;
if (DMS_DEBUG) then
{
diag_log format ["Created markers |%1| at %2 with text |%3| colored %4",[_dot,_circle],_pos,_text,_color];
};
[_dot,_circle];

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

@ -0,0 +1,143 @@
/*
DMS_FillCrate
Original credit goes to WAI: https://github.com/nerdalertdk/WICKED-AI
Edited by eraser1
Usage:
[
_crate,
[
_weapons,
_items,
_backpacks
]
] call DMS_FillCrate;
Each loot argument can be an explicitly defined array of weapons with a number to spawn, or simply a number and weapons defined in the config.sqf are used
*/
if (isNil "_this") exitWith
{
diag_log "DMS ERROR :: Calling DMS_FillCrate with nil argument!";
};
private ["_box","_lootValues","_wepCount","_weps","_itemCount","_items","_backpackCount","_backpacks","_weapon","_ammo","_item","_backpack"];
_OK = params
[
["_box",objNull,[objNull]],
["_lootValues",[0,0,0],[[]],[3]]
];
if (!_OK || {isNull _box}) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_FillCrate with invalid parameters: %1",_this];
};
// Weapons
if(typeName (_lootValues select 0) == "ARRAY") then
{
_wepCount = (_lootValues select 0) select 0;
_weps = (_lootValues select 0) select 1;
}
else
{
_wepCount = _lootValues select 0;
_weps = DMS_boxWeapons;
};
// Items
if(typeName (_lootValues select 1) == "ARRAY") then
{
_itemCount = (_lootValues select 1) select 0;
_items = (_lootValues select 1) select 1;
}
else
{
_itemCount = _lootValues select 1;
_items = DMS_boxItems;
};
// Backpacks
if(typeName (_lootValues select 2) == "ARRAY") then
{
_backpackCount = (_lootValues select 2) select 0;
_backpacks = (_lootValues select 2) select 1;
}
else
{
_backpackCount = _lootValues select 2;
_backpacks = DMS_boxBackpacks;
};
if(DMS_DEBUG) then
{
diag_log format["DMS_DEBUG FillCrate :: Filling %4 with %1 guns, %2 items and %3 backpacks",_wepCount,_itemCount,_backpackCount,_box];
};
if ((_wepCount>0) && {count _weps>0}) then
{
// Add weapons + mags
for "_i" from 1 to _wepCount do
{
_weapon = _weps call BIS_fnc_selectRandom;
_ammo = _weapon call DMS_selectMagazine;
if ((typeName _weapon)=="STRING") then
{
_weapon = [_weapon,1];
};
_box addWeaponCargoGlobal _weapon;
_box addItemCargoGlobal [_ammo, (4 + floor(random 3))];
};
};
if ((_itemCount > 0) && {count _items>0}) then
{
// Add items
for "_i" from 1 to _itemCount do
{
_item = _items call BIS_fnc_selectRandom;
if ((typeName _item)=="STRING") then
{
_item = [_item,1];
};
_box addItemCargoGlobal _item;
};
};
if ((_backpackCount > 0) && {count _backpacks>0}) then
{
// Add backpacks
for "_i" from 1 to _backpackCount do
{
_backpack = _backpacks call BIS_fnc_selectRandom;
if ((typeName _backpack)=="STRING") then
{
_backpack = [_backpack,1];
};
_box addBackpackCargoGlobal _backpack;
};
};
if(DMS_RareLoot && {count DMS_RareLootList>0}) then
{
// (Maybe) Add rare loot
if(random 100 < DMS_RareLootChance) then
{
_item = DMS_RareLootList call BIS_fnc_selectRandom;
if ((typeName _item)=="STRING") then
{
_item = [_item,1];
};
_box addItemCargoGlobal _item;
};
};

View File

@ -0,0 +1,40 @@
/*
DMS_FindSuppressor
Taken from WAI
Modified by eraser1
Usage:
_weaponClassName call DMS_FindSuppressor;
*/
private["_weapon","_result","_ammoName"];
_result = "";
_weapon = _this;
// Zafir accepts no suppressors :(
if (_weapon=="LMG_Zafir_F") exitWith {""};
_ammoName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName");
if ((_ammoName find "5.56") > -1) then
{
_result = "muzzle_snds_M";
};
if ((_ammoName find "6.5") > -1) then
{
_result = "muzzle_snds_H";
};
if ((_ammoName find "7.62") > -1) then
{
_result = "muzzle_snds_H";
};
//TODO Add functionality for 9.3 and .338
_result

View File

@ -0,0 +1,15 @@
private["_result","_position","_radius"];
_result = false;
_position = _this select 0;
_radius = _this select 1;
for "_i" from 0 to 359 step 45 do {
_position = [(_position select 0) + (sin(_i)*_radius), (_position select 1) + (cos(_i)*_radius)];
if (surfaceIsWater _position) exitWith {
_result = true;
};
};
_result

View File

@ -0,0 +1,64 @@
/*
DMS_MissionSuccessState
Created by eraser1
Usage:
[
[_completionType1,_completionArgs1],
[_completionType2,_completionArgs2],
...
[_completionTypeN,_completionArgsN]
] call DMS_MissionSuccessState;
*/
if !((typeName _this) == "ARRAY") exitWith
{
diag_log format ["DMS ERROR :: DMS_MissionSuccessState called with invalid parameter: %1",_this];
};
private "_success";
_success = true;
{
if (!_success) exitWith
{
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MissionSuccessState :: Mission not completed with parameters: %1 | at time %2",_this,diag_tickTime];
};
};
private ["_OK","_completionType","_completionArgs"];
_OK = _x params
[
["_completionType", "", [""] ],
["_completionArgs", [], [[],grpNull] ]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: DMS_MissionSuccessState has invalid parameters in: %1",_x];
};
switch (_completionType) do
{
// Using switch-do so that future cases can be added easily
case "kill":
{
_success = _completionArgs call DMS_TargetsKilled;
};
case "killPercent":
{
_success = _completionArgs call DMS_TargetsKilledPercent;//<---TODO
};
case "playerNear":
{
_success = _completionArgs call ExileServer_util_position_isPlayerNearby;
};
};
false;
} count _this;
_success;

View File

@ -0,0 +1,117 @@
/*
DMS_MissionStatusCheck
Created by eraser1
Each mission has its own index in "DMS_Mission_Arr".
Every index is a subarray with the values:
[
_pos,
_completionInfo, //<--- More info in "DMS_AddMissionToMonitor"
[_timeStarted,_timeUntilFail],
[_AIUnit1,_AIUnit2,...,_AIUnitX],
[
[_cleanupObj1,_cleanupObj2,...,_cleanupObjX],
[_crate,_vehicle1,_vehicle2,...,_vehicleX],
[_crate_loot_values]
],
[_msgWIN,_msgLose],
[_markerDot,_markerCircle],
_side
]
*/
if (DMS_Mission_Arr isEqualTo []) exitWith // Empty array, no missions running
{
/* Removed because RPT spam
if (DMS_DEBUG) then
{
diag_log "DMS_DEBUG MissionStatusCheck :: DMS_Mission_Arr is empty!";
};
*/
};
_index = 0;
{
call
{
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MissionStatusCheck :: Checking Mission Status (index %1): %2",_index,_x];
};
_pos = _x select 0;
_success = (_x select 1) call DMS_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;
_crate_loot_values = _x select 4 select 2;
_msgWIN = _x select 5 select 0;
_msgLose = _x select 5 select 1;
_markers = _x select 6;
_missionSide = _x select 7;
if (_success) exitWith
{
DMS_CleanUpList pushBack [_units+_buildings,diag_tickTime,DMS_CompletedMissionCleanupTime];
if (_missionSide == "bandit") then
{
DMS_RunningBMissionCount = DMS_RunningBMissionCount - 1;
}
else
{
// Not yet implemented
};
_arr = DMS_Mission_Arr deleteAt _index;
[_loot select 0,_crate_loot_values] call DMS_FillCrate;
_msgWIN call DMS_BroadcastMissionStatus;
[_markers,"win"] call DMS_RemoveMarkers;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MissionStatusCheck :: Mission Success at %1 with message %2.",_pos,_msgWIN];
};
};
if (DMS_MissionTimeoutReset && {[_pos,DMS_MissionTimeoutResetRange] call ExileServer_util_position_isPlayerNearby}) exitWith
{
_x set [2,[diag_tickTime,_timeUntilFail]];
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MissionStatusCheck :: Mission Timeout Extended at %1 with timeout after %2 seconds. Position: %3",diag_tickTime,_timeUntilFail,_pos];
};
};
if ((diag_tickTime-_timeStarted)>_timeUntilFail) exitWith
{
//Nobody is nearby so just cleanup objects from here
(_units+_buildings+_loot) call DMS_CleanUp;
if (_missionSide == "bandit") then
{
DMS_RunningBMissionCount = DMS_RunningBMissionCount - 1;
}
else
{
// Not yet implemented
};
_arr = DMS_Mission_Arr deleteAt _index;
_msgLose call DMS_BroadcastMissionStatus;
[_markers,"lose"] call DMS_RemoveMarkers;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MissionStatusCheck :: Mission Fail at %1 with message %2.",_pos,_msgLose];
};
};
};
_index = _index + 1;
false;
} count DMS_Mission_Arr;

View File

@ -0,0 +1,127 @@
/*
DMS_OnKilled
Created by eraser1 and Defent
Influenced by WAI
Usage:
[
[
_killedUnit,
_killer
],
_side, // "bandit" only for now
_type // not currently used
] call DMS_OnKilled;
*/
private ["_unit", "_player", "_playerObj", "_side", "_type", "_launcher", "_rockets", "_money", "_respect", "_moneyGain", "_repGain"];
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG OnKilled :: Logging AI death with parameters: %1",_this];
};
_unit = _this select 0 select 0;
_player = _this select 0 select 1;
_side = _this select 1;
_type = _this select 2;
_launcher = secondaryWeapon _unit;
if (isPlayer _player) then
{
_playerObj = _player;
if (DMS_ai_share_info) then
{
{
if (((position _x) distance (position _unit)) <= DMS_ai_share_info_distance ) then {
_x reveal [_player, 4.0];
};
} count allUnits;
};
}
else
{
_playerObj = gunner _player;
if (isNull _playerObj) then
{
_playerObj = driver _player;
};
if (DMS_clear_AI_body || {DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}}) then
{
removeAllWeapons _unit;
removeAllAssignedItems _unit;
removeAllItemsWithMagazines _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
};
};
if(DMS_ai_remove_launchers && {_launcher != ""}) then
{
_rockets = _launcher call DMS_selectMagazine;
_unit removeWeapon _launcher;
{
if(_x == _rockets) then {
_unit removeMagazine _x;
};
false;
} count magazines _unit;
};
if(DMS_RemoveNVG) then
{
_unit unlinkItem "NVGoggles";
};
if ((!isNull _playerObj) && {(getPlayerUID _playerObj) != ""}) then
{
_moneyGain = missionNamespace getVariable [format ["DMS_%1MoneyGainOnKill",_side],0];
_repGain = missionNamespace getVariable [format ["DMS_%1RepGainOnKill",_side],0];
if ((_moneyGain>0) || (_repGain>0)) then
{
_money = _playerObj getVariable ["ExileMoney", 0];
_respect = _playerObj getVariable ["ExileScore", 0];
if (_moneyGain>0) then
{
// Set client's money
_money = _money + _moneyGain;
_playerObj setVariable ["ExileMoney",_money];
// Send notification and update client's money stats
// Somebody done fucked up so you don't see the sender for the money sending ;)
[_playerObj, "moneyReceivedRequest", [str _money, "AI KILL"]] call ExileServer_system_network_send_to;
};
if (_repGain>0) then
{
// Set client's respect
_respect = _respect + _repGain;
_playerObj setVariable ["ExileScore",_respect];
// Send frag message
[_playerObj, "showFragRequest", [ [["AI KILL",_repGain]] ] ] call ExileServer_system_network_send_to;
// Send updated respect value to client
ExileClientPlayerScore = _respect;
(owner _playerObj) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
};
// Update client database entry
format["setAccountMoneyAndRespect:%1:%2:%3", _money, _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;
};
};
DMS_CleanUpList pushBack [_unit,diag_tickTime,DMS_CompletedMissionCleanupTime];

View File

@ -0,0 +1,55 @@
/*
DMS_RemoveMarkers
Created by eraser1
Usage:
[
[
_markerDot,
_markerCircle
],
_status
] call DMS_RemoveMarkers;
*/
private ["_markerDot","_markerCircle","_status"];
_markerDot = _this select 0 select 0;
_markerCircle = _this select 0 select 1;
_status = _this select 1;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG RemoveMarkers :: Calling DMS_RemoveMarkers with parameters %1.",_this];
};
deleteMarker _markerCircle;
if (_status == "win") then
{
if (!DMS_MissionMarkerWinDot) exitWith {
deleteMarker _markerDot;
};
_markerDot setMarkerText ("COMPLETED: "+markerText _markerDot);
_markerDot setMarkerColor DMS_MissionMarkerWinDotColor;
[DMS_MissionMarkerWinDotTime, {deleteMarker _this;}, _markerDot, false] call ExileServer_system_thread_addTask;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG RemoveMarkers :: %1 Marker will be removed in %2 seconds!",_markerDot,DMS_MissionMarkerWinDotTime];
};
}
else
{
if (!DMS_MissionMarkerLoseDot) exitWith {
deleteMarker _markerDot;
};
_markerDot setMarkerText ("FAILED: "+markerText _markerDot);
_markerDot setMarkerColor DMS_MissionMarkerLoseDotColor;
[DMS_MissionMarkerLoseDotTime, {deleteMarker _this;}, _markerDot, false] call ExileServer_system_thread_addTask;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG RemoveMarkers :: %1 Marker will be removed in %2 seconds!",_markerDot,DMS_MissionMarkerLoseDotTime];
};
};

View File

@ -0,0 +1,21 @@
/*
DMS_selectMagazine
Created by eraser1
Usage:
_weaponClassName call DMS_selectMagazine;
Apply magazine type filters if needed
*/
private["_result","_ammoArray"];
_result = "";
_ammoArray = getArray (configFile >> "CfgWeapons" >> _this >> "magazines");
if (count _ammoArray > 0) then {
_result = _ammoArray select 0;
};
_result

View File

@ -0,0 +1,46 @@
/*
DMS_SetGroupBehavior
Created by eraser1
Usage:
[
_group,
_pos,
_difficulty
] call DMS_SetGroupBehavior;
*/
private ["_OK", "_group", "_pos", "_difficulty", "_radius", "_npos", "_i", "_wp"];
_OK = params
[
["_group",grpNull,[grpNull]],
["_pos",[0,0,0],[[]],[2,3]],
["_difficulty","moderate",[""]]
];
if (!_OK) then
{
diag_log format ["DMS ERROR :: Calling DMS_SetGroupBehavior with invalid params: %1",_this];
};
_group setCombatMode "RED";
_group setBehaviour "COMBAT";
if(_difficulty == "random") then
{
_difficulty = DMS_ai_skill_random call BIS_fnc_selectRandom;
};
_radius = missionNamespace getVariable [format["DMS_AI_WP_Radius_%1"],40];
for "_i" from 0 to 359 step 45 do {
_npos = [(_pos select 0) + (sin(_i)*_radius), (_pos select 1) + (cos(_i)*_radius)];
_wp = _group addWaypoint [_npos,(_radius/5)];
_wp setWaypointType "MOVE";
};
_wp = _group addWaypoint [_pos,_radius];
_wp setWaypointType "CYCLE";

View File

@ -0,0 +1,120 @@
/*
DMS_SpawnAIGroup
Created by eraser1
Based off of WAI
Usage:
[
_pos, // Position of AI
_count, // Number of AI
_difficulty, // "random","hardcore","difficult","moderate", or "easy"
_type // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
_side // "bandit","hero", etc.
] call DMS_SpawnAIGroup;
Returns AI Group
*/
private ["_OK", "_pos", "_count", "_difficulty", "_type", "_side", "_pos_x", "_pos_y", "_pos_z", "_launcher", "_unit", "_client"];
_OK = params
[
["_pos",[0,0,0],[[]],[3]],
["_count",0,[0]],
["_difficulty","random",[""]],
["_type","random",[""]],
["_side","bandit",[""]]
];
if (!_OK) then
{
diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with invalid parameters: %1",_this];
};
if (_count < 1) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_SpawnAIGroup with less than 1 _count! _this: %1",_this];
};
_pos_x = _pos select 0;
_pos_y = _pos select 1;
_pos_z = _pos select 2;
if(DMS_DEBUG) then
{
diag_log format["DMS_DEBUG SpawnAIGroup :: Spawning %1 %2 %3 AI at %4 with %5 difficulty.",_count,_type,_side,_pos,_difficulty];
};
// if soldier have AT/AA weapons
if (typeName _type == "ARRAY") then
{
_launcher = _type select 1;
_type = _type select 0;
};
// Randomize position
if(_pos_z == 0) then
{
if(round(random 1) == 1) then
{
_pos_x = _pos_x - (5 + random(10));
} else {
_pos_x = _pos_x + (5 + random(10));
};
if(round(random 1) == 1) then
{
_pos_y = _pos_y - (5 + random(10));
} else {
_pos_y = _pos_y + (5 + random(10));
};
};
_group = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
for "_i" from 1 to _count do {
_unit = [_group,[_pos_x,_pos_y,_pos_z],_type,_difficulty,_side] call DMS_SpawnAISoldier;
};
if (DMS_ai_use_launchers && {(!isNil "_launcher") && {(random 100) <= DMS_ai_use_launchers_chance}}) then
{
_launcher = ((missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcher],["launch_NLAW_F"]]) call BIS_fnc_selectRandom);
_unit addBackpack "B_Carryall_mcamo";
[_unit, _launcher, DMS_AI_launcher_ammo_count] call BIS_fnc_addWeapon;
if(DMS_DEBUG) then
{
diag_log format["DMS_DEBUG SpawnAIGroup :: Giving %1 a %2 launcher.",_unit,_launcher];
};
};
_group selectLeader ((units _group) select 0);
_group setFormation "WEDGE";
if(_pos_z == 0) then
{
[_group,_pos,_difficulty] call DMS_SetGroupBehavior;
};
/*
if (DMS_ai_offload_to_client) then
{
_client = (allPlayers call BIS_fnc_selectRandom);
ExileServerOwnershipSwapQueue pushBack [_client,_group];
if(DMS_DEBUG) then
{
diag_log format["DMS_DEBUG SpawnAIGroup :: Swapping group ownership of %1 to %2",_group,_client];
};
};
*/
diag_log format ["DMS_SpawnAIGroup :: Spawned %1 AI at %2.",_count,_pos];
_group

View File

@ -0,0 +1,286 @@
/*
DMS_SpawnAISoldier
Created by eraser1
Based off of WAI
Usage:
[
_group, // Group the AI will belong to
_pos, // Position of AI
_type, // "random","assault","MG","sniper" or "unarmed"
_difficulty, // "random","hardcore","difficult","moderate", or "easy"
_side, // "bandit","hero", etc.
_customGearSet // OPTIONAL: Manually defined AI gear.
] call DMS_SpawnAIGroup;
Usage for _customGearSet:
[
_weapon, // String | EG: "LMG_Zafir_F"
_weaponAttachments, // Array of strings | EG: ["optic_dms","bipod_03_F_blk"]
_magazines, // Array of arrays | EG: [["150Rnd_762x54_Box",2],["16Rnd_9x21_Mag",3]]
_pistol, // String | EG: "hgun_Pistol_heavy_01_snds_F"
_pistolAttachments, // Array of strings | EG: ["optic_MRD","muzzle_snds_acp"]
_items, // Array of strings | EG: ["Rangefinder","ItemGPS","Exile_Item_InstaDoc"]
_helmet, // String | EG: "H_HelmetLeaderO_ocamo"
_uniform, // String | EG: "U_O_GhillieSuit"
_vest, // String | EG: "V_PlateCarrierGL_blk"
_backpack // String | EG: "B_Carryall_oli"
]
Returns AI Unit
*/
private ["_OK", "_useCustomGear", "_unarmed", "_type", "_customGear", "_unit", "_side", "_nighttime", "_weapon", "_muzzle", "_suppressor", "_pistols", "_pistol", "_customGearSet", "_helmet", "_uniform", "_vest", "_backpack", "_magazines", "_weaponAttachments", "_pistolAttachments", "_items", "_difficulty", "_skillArray"];
_OK = params
[
["_group",grpNull,[grpNull]],
["_pos",[0,0,0],[[]],[3]],
["_type","random",[""]],
["_difficulty","random",[""]],
["_side","bandit",[""]]
];
_useCustomGear = false;
_unarmed = false;
if (!_OK) then
{
diag_log format ["DMS ERROR :: DMS_SpawnAISoldier called with invalid parameters: %1",_this];
}
else
{
if ((_type == "custom") && {((count _this)>5)}) then
{
_customGear = _this select 5;
_useCustomGear = true;
};
};
if(_difficulty == "random") then
{
_difficulty = DMS_ai_skill_random call BIS_fnc_selectRandom;
};
//Create unit
_unit = _group createUnit ["O_recon_F", _pos, [], 0,"FORM"];
_unit allowFleeing 0;
[_unit] joinSilent _group;
// Remove existing gear
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
// Give default items
if !(DMS_ai_default_items isEqualTo []) then
{
{_unit linkItem _x;false;} count DMS_ai_default_items;
};
call
{
if (_type == "random") exitWith { _type = DMS_random_AI call BIS_fnc_selectRandom;};
if (_type == "unarmed") exitWith { _type = "assault";_unarmed = true; };
};
// Unit name
_unit setName format["[DMS_Unit_%1%2]",_type,floor(random 1000)];
if (!_useCustomGear) then
{
if !(_type in DMS_ai_SupportedClasses) exitWith
{
diag_log format ["DMS ERROR :: DMS_SpawnAISoldier called with unsupported _type: %1 | _this: %2",_type,_this];
};// No more idiot-proofing for the following configs
// Equipment (Stuff that goes in the toolbelt slots)
{_unit linkItem _x;false;} count (missionNamespace getVariable [format ["DMS_%1_equipment",_type],[]]);
// Items (Loot stuff that goes in uniform/vest/backpack)
{_unit addItem _x;false;} count (missionNamespace getVariable [format ["DMS_%1_items",_type],[]]);
// Clothes
_unit addHeadgear ((missionNamespace getVariable [format ["DMS_%1_helmets",_type],[]]) call BIS_fnc_selectRandom);
_unit forceAddUniform ((missionNamespace getVariable [format ["DMS_%1_clothes",_type],[]]) call BIS_fnc_selectRandom);
_unit addVest ((missionNamespace getVariable [format ["DMS_%1_vests",_type],[]]) call BIS_fnc_selectRandom);
_unit addBackpack ((missionNamespace getVariable [format ["DMS_%1_backpacks",_type],[]]) call BIS_fnc_selectRandom);
// Make AI effective at night
_nighttime = (sunOrMoon != 1);
if (_nighttime) then
{
_unit linkItem "NVGoggles";
};
if (!_unarmed) then
{
_weapon = (missionNamespace getVariable [format ["DMS_%1_weps",_type],[]]) call BIS_fnc_selectRandom;
[_unit, _weapon, 4 + floor(random 3)] call BIS_fnc_addWeapon;
_unit selectWeapon _weapon;
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_optic_chance",_type],0])) then
{
_unit addPrimaryWeaponItem ((missionNamespace getVariable [format ["DMS_%1_optics",_type],[]]) call BIS_fnc_selectRandom);
};
if (_nighttime && {(random 100) <= DMS_ai_nighttime_accessory_chance}) then
{
_unit addPrimaryWeaponItem (["acc_pointer_IR","acc_flashlight"] call BIS_fnc_selectRandom);
};
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_bipod_chance",_type],0])) then
{
_unit addPrimaryWeaponItem (DMS_ai_BipodList call BIS_fnc_selectRandom);
};
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_type],0])) then
{
_suppressor = _weapon call DMS_FindSuppressor;
if(_suppressor != "") then
{
_unit addPrimaryWeaponItem _suppressor;
};
};
// In case spawn position is water
if (DMS_ai_enable_water_equipment && {surfaceIsWater _pos}) then
{
removeHeadgear _unit;
removeAllWeapons _unit;
_unit forceAddUniform "U_O_Wetsuit";
_unit addVest "V_RebreatherIA";
_unit addGoggles "G_Diving";
[_unit, "arifle_SDAR_F", 4 + floor(random 3), "20Rnd_556x45_UW_mag"] call BIS_fnc_addWeapon;
};
_pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_type],[]];
if !(_pistols isEqualTo []) then
{
_pistol = _pistols call BIS_fnc_selectRandom;
[_unit, _pistol, 2 + floor(random 2)] call BIS_fnc_addWeapon;
};
// Infinite Ammo
_unit addeventhandler ["Fired", {(_this select 0) setvehicleammo 1;}];
};
}
else
{
_OK = _customGearSet params
[
["_weapon","",[""]],
["_weaponAttachments",[],[[]]],
["_magazines",[],[[]]],
["_pistol","",[""]],
["_pistolAttachments",[],[[]]],
["_items",[],[[]]],
["_helmet","",[""]],
["_uniform","",[""]],
["_vest","",[""]],
["_backpack","",[""]]
];
if (!_OK) then
{
diag_log format ["DMS ERROR :: Calling DMS_SpawnAISoldier with invalid _customGearSet: %1 | _this: %2",_customGearSet,_this];
};
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SpawnAISoldier :: Equipping unit %1 with _customGearSet: %2",_unit,_customGearSet];
};
// Clothes
if !(_helmet isEqualTo "") then
{
_unit addHeadgear _helmet;
};
if !(_uniform isEqualTo "") then
{
_unit forceAddUniform _uniform;
};
if !(_vest isEqualTo "") then
{
_unit addVest _vest;
};
if !(_backpack isEqualTo "") then
{
_unit addBackpack _backpack;
};
// Add Magazines before weapon so that gun will be loaded
{
if ((typeName _x) isEqualTo "STRING") then
{
_x = [_x,1];
};
_unit addMagazines _x;
false;
} count _magazines;
// Add gun and attachments
if !(_weapon isEqualTo "") then
{
_muzzle = [_unit, _weapon, 0] call BIS_fnc_addWeapon;
{
_unit addPrimaryWeaponItem _x;
false;
} count _weaponAttachments;
_unit selectWeapon _weapon;
};
// Add pistol and attachments
if !(_pistol isEqualTo "") then
{
_muzzle = [_unit, _pistol, 0] call BIS_fnc_addWeapon;
{
_unit addPrimaryWeaponItem _x;
false;
} count _pistolAttachments;
};
// Add items
{
_unit addItem _x;
false;
} count _items;
};
{
_unit setSkill [(_x select 0),(_x select 1)];
false;
} count (missionNamespace getVariable [format["DMS_ai_skill_%1",_difficulty],[]]);
// Soldier killed event handler
_unit addMPEventHandler ["MPKilled",'[_this, '+str _side+', "soldier"] call DMS_OnKilled;'];
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
_unit enableAI "MOVE";
_unit enableAI "ANIM";
_unit enableAI "FSM";
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SpawnAISoldier :: Spawned a %1 %2 AI at %3 with %4 difficulty to group %5",_type,_side,_pos,_difficulty,_group];
};
_unit

View File

@ -0,0 +1,34 @@
/*
DMS_SpawnCrate
Created by eraser1
Usage:
[
_crateClassName,
_pos
] call DMS_SpawnCrate;
Returns crate object
*/
private ["_crateClassName", "_pos", "_crate"];
_OK = params
[
["_crateClassName","ERROR",[""]],
["_pos","ERROR",[[]],[3]]
];
if (!_OK) then
{
diag_log format ["DMS ERROR :: Calling DMS_SpawnCrate with invalid parameters: %1",_this];
};
_crate = createVehicle [_crateClassName,_pos,[], 0, "CAN_COLLIDE"];
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
_crate;

View File

@ -0,0 +1,63 @@
/*
DMS_TargetsKilled
Created by eraser1
Usage:
[
_unit,
_group,
_object
] call DMS_TargetsKilled;
Will accept non-array argument of group, unit, or object.
*/
if ((typeName _this) in ["GROUP","OBJECT"]) then
{
_this = [_this];
};
if (_this isEqualTo []) exitWith
{
diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!";
};
private "_killed";
_killed = false;
try
{
{
if (((typeName _x) == "OBJECT") && {!isNull _x && {alive _x}}) then
{
throw _x;
}
else
{
if !((typeName _x) == "GROUP") exitWith
{
diag_log format ["DMS ERROR :: %1 is neither OBJECT nor GROUP!",_x];
};
{
if (!isNull _x && {alive _x}) exitWith
{
throw _x;
};
false;
} count (units _x);
};
false;
} count _this;
_killed = true;
}
catch
{
if (DMS_DEBUG) then {
diag_log format ["DMS_DEBUG TargetsKilled :: %1 is still alive! All of %2 are not yet killed!",_exception,_this];
};
};
_killed;

View File

@ -0,0 +1,81 @@
/*
DMS_findSafePos
Created by eraser1
Usage:
[
_nearestObjectMinDistance, // (OPTIONAL) Number: Minimum distance from nearest object
_maxTerrainGradient // (OPTIONAL) Number: Maximum terrain gradient (slope)
] call DMS_findSafePos;
*/
private ["_nearestObjectMinDistance","_maxTerrainGradient","_safePosParams","_validspot","_i","_pos"];
params
[
["_nearestObjectMinDistance",25,[0]],
["_maxTerrainGradient",10,[0]]
];
_safePosParams =
[
[[],0,-1,_nearestObjectMinDistance,0,_maxTerrainGradient,0,DMS_findSafePosBlacklist],
[[16000,16000],0,16000,_nearestObjectMinDistance,0,_maxTerrainGradient,0,DMS_findSafePosBlacklist] //[16000,16000] w/ radius of 16000 works well for Altis
] select (worldName=="Altis");
_validspot = false;
_i = 0;
while{!_validspot} do {
_pos = _safePosParams call BIS_fnc_findSafePos;
_i = _i+1;
try
{
// Check for nearby water
if ([_pos,DMS_WaterNearBlacklist] call DMS_isNearWater) exitWith
{
throw ("water");
};
// Check for nearby players
if ([_pos,DMS_PlayerNearBlacklist] call ExileServer_util_position_isPlayerNearby) exitWith
{
throw ("players");
};
{
// Check for nearby spawn points
if (((markertype _x) == "ExileSpawnZone") && {((getMarkerPos _x) distance2D _pos)<=DMS_SpawnZoneNearBlacklist}) exitWith
{
throw ("a spawn zone");
};
// Check for nearby trader zones
if (((markertype _x) == "ExileTraderZone") && {((getMarkerPos _x) distance2D _pos)<=DMS_TraderZoneNearBlacklist}) exitWith
{
throw ("a trader zone");
};
// Check for nearby missions
if (((_x find "DMS_MissionMarkerDot")>-1) && {((getMarkerPos _x) distance2D _pos)<=DMS_MissionNearBlacklist}) exitWith
{
throw ("another mission");
};
false;
} count allMapMarkers;
// No exceptions found
_validspot = true;
}
catch
{
if (DMS_DEBUG) then {
diag_log format ["DMS_DEBUG findSafePos :: Exception in attempt %1 | Position %2 is too close to %3!",_i,_pos,_exception];
};
};
};
if(DMS_DEBUG) then {
diag_log format["DMS_DEBUG findSafePos :: Mission position %1 with %2 params found in %3 attempts.",_pos,_safePosParams,_i];
};
_pos set [2, 0];
_pos;

View File

@ -0,0 +1,46 @@
/*
DMS_isPlayerNearbyARRAY
Created by eraser1
Usage:
[
[
_position_or_object1,
_position_or_object2,
...
_position_or_objectN
],
_radius
] call DMS_isPlayerNearbyARRAY;
***DEPRECATED***
*/
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_DEBUG IsPlayerNearbyARRAY :: %1 is within %2m of %3!",_plyr,_radius,_x];
};
};
false;
} count _posArray;
};
false;
} count allPlayers;
_result

View File

@ -0,0 +1 @@
/*TODO*/

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,10 @@
http://www.exilemod.com/forums/topic/dms-defents-mission-system/page/5/#post-12008
http://www.exilemod.com/forums/topic/dms-defents-mission-system/#post-10434
To install.
To install:
Put the pre-packed PBO in your "@ExileServer\addons\" directory. It should be alongside "exile_server" and "exile_server_config".
OPTIONAL:
Download the a3_dms folder and edit the config.sqf to your preferences.
Repack the a3_dms folder with a PBO tool and follow the "To install:" steps :D