From 0c4e56f697dfc262c4f0cfa116eb786bd946a1cb Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 30 Aug 2015 21:42:02 -0500 Subject: [PATCH] First mission(s)! --- @ExileServer/addons/a3_dms/config.sqf | 11 +- @ExileServer/addons/a3_dms/missions/MM1.sqf | 37 ------ .../addons/a3_dms/missions/mission1.sqf | 118 ++++++++++++++++++ .../addons/a3_dms/missions/mission2.sqf | 115 +++++++++++++++++ .../addons/a3_dms/missions/mission3.sqf | 115 +++++++++++++++++ .../addons/a3_dms/missions/mission4.sqf | 115 +++++++++++++++++ .../addons/a3_dms/scripts/DMS_spawnAI.sqf | 116 ----------------- .../addons/a3_dms/scripts/findSafePos.sqf | 10 +- 8 files changed, 477 insertions(+), 160 deletions(-) delete mode 100644 @ExileServer/addons/a3_dms/missions/MM1.sqf create mode 100644 @ExileServer/addons/a3_dms/missions/mission1.sqf create mode 100644 @ExileServer/addons/a3_dms/missions/mission2.sqf create mode 100644 @ExileServer/addons/a3_dms/missions/mission3.sqf create mode 100644 @ExileServer/addons/a3_dms/missions/mission4.sqf delete mode 100644 @ExileServer/addons/a3_dms/scripts/DMS_spawnAI.sqf diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 22c24eb..0945e63 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -15,7 +15,10 @@ DMS_DEBUG = false; 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_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement + 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 @@ -66,7 +69,7 @@ DMS_DEBUG = false; /* AI Settings */ DMS_banditSide = EAST; // The side (team) that AI Bandits will spawn on - DMS_clear_AI_body = false; // Clear AI body when they die + 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 @@ -513,6 +516,6 @@ DMS_DEBUG = false; // Debug Overwrites if(DMS_DEBUG) then { - DMS_TimeBetweenMissions = [60,60]; - DMS_MissionTimeOut = [300,300]; + DMS_TimeBetweenMissions = [30,60]; + DMS_MissionTimeOut = [240,300]; }; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/MM1.sqf b/@ExileServer/addons/a3_dms/missions/MM1.sqf deleted file mode 100644 index e743c93..0000000 --- a/@ExileServer/addons/a3_dms/missions/MM1.sqf +++ /dev/null @@ -1,37 +0,0 @@ -private ["_crate","_pos","_missname","_aiAmmount","_misText","_missEnd","_group"]; - - -// associate pos with find safe pos fnc -_pos = call DMS_findSafePos; - -_missname = "Main Mission 1"; -diag_log format ["DMS :: Main Mission 1 started at (%1)",_pos]; - - -["standardHintRequest",["Mission starting! Check your map"]] call ExileServer_system_network_send_broadcast; - - -// Spawn Marker -[_pos,_missname] call DMS_CreateMarker; - -// Spawn Box -_crate = createVehicle ["Box_NATO_Wps_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; -[1,_crate] call DMS_createBox; -uiSleep 2; -//_crate = [_pos,40,4,2,2] execVM "mission\crates\MM_Box1.sqf"; - -// spawn AI -//[_pos,5,4] call DMS_SpawnAI; -//[(_pos),(5),(4)] call DMS_SpawnAI; -[_pos,5,4] call DMS_SpawnAI; - - waitUntil{sleep 1; {(isPlayer _x) && (_x distance _pos < 30) } count playableUnits > 0}; - - -["standardHintRequest",["Mission has ended, good job!"]] call ExileServer_system_network_send_broadcast; - -// Run Cleanup -[_pos,_crate] call DMS_CleanUp; - - -[] call DMS_SelectMission; diff --git a/@ExileServer/addons/a3_dms/missions/mission1.sqf b/@ExileServer/addons/a3_dms/missions/mission1.sqf new file mode 100644 index 0000000..4e18eee --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/mission1.sqf @@ -0,0 +1,118 @@ +/* + 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", "_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 = "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 = createVehicle ["Box_NATO_Wps_F",_pos,[], 0, "CAN_COLLIDE"]; + +// Set crate loot values +_crate_loot_values = +[ + 5, // Weapons + 10, // Items + 3 // Backpacks +]; + + +// Setup Mission Start message +_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos]; + +// Setup Mission Win message +_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos]; + +// Setup Mission Lose message +_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos]; + + +// Set mission name (for map marker and logging) +_missionName = "Mercenary Group"; + +// Create Markers +_markers = +[ + _pos, + _missionName, + _difficulty +] call DMS_CreateMarker; + +_time = diag_tickTime; +_added = +[ + _pos, + [ + [ + "kill", + _group + ], + [ + "playerNear", + [_pos,DMS_playerNearRadius] + ], + ], + [ + _time, + (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0)) + ], + [ + _group + ], + [ + [], // No spawned buildings + [_crate], + [_crate_loot_values] + ], + [_msgWIN,_msgLose], + _markers, + _side +] call DMS_AddMissionToMonitor; + +if !(_added) exitWith +{ + diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName]; +}; + + +// Notify players +_msgStart call DMS_BroadcastMissionStatus; + + + +if (DMS_DEBUG) then +{ + diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/mission2.sqf b/@ExileServer/addons/a3_dms/missions/mission2.sqf new file mode 100644 index 0000000..d5d9904 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/mission2.sqf @@ -0,0 +1,115 @@ +/* + Sample mission (duplicate for testing purposes) +*/ + +private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_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 = "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 = createVehicle ["Box_NATO_Wps_F",_pos,[], 0, "CAN_COLLIDE"]; + +// Set crate loot values +_crate_loot_values = +[ + 5, // Weapons + 10, // Items + 3 // Backpacks +]; + + +// Setup Mission Start message +_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos]; + +// Setup Mission Win message +_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos]; + +// Setup Mission Lose message +_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos]; + + +// Set mission name (for map marker and logging) +_missionName = "Mercenary Group2"; + +// Create Markers +_markers = +[ + _pos, + _missionName, + _difficulty +] call DMS_CreateMarker; + +_time = diag_tickTime; +_added = +[ + _pos, + [ + [ + "kill", + _group + ], + [ + "playerNear", + [_pos,DMS_playerNearRadius] + ], + ], + [ + _time, + (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0)) + ], + [ + _group + ], + [ + [], // No spawned buildings + [_crate], + [_crate_loot_values] + ], + [_msgWIN,_msgLose], + _markers, + _side +] call DMS_AddMissionToMonitor; + +if !(_added) exitWith +{ + diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName]; +}; + + +// Notify players +_msgStart call DMS_BroadcastMissionStatus; + + + +if (DMS_DEBUG) then +{ + diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/mission3.sqf b/@ExileServer/addons/a3_dms/missions/mission3.sqf new file mode 100644 index 0000000..05b23a6 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/mission3.sqf @@ -0,0 +1,115 @@ +/* + Sample mission (duplicate for testing purposes) +*/ + +private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_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 = "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 = createVehicle ["Box_NATO_Wps_F",_pos,[], 0, "CAN_COLLIDE"]; + +// Set crate loot values +_crate_loot_values = +[ + 5, // Weapons + 10, // Items + 3 // Backpacks +]; + + +// Setup Mission Start message +_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos]; + +// Setup Mission Win message +_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos]; + +// Setup Mission Lose message +_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos]; + + +// Set mission name (for map marker and logging) +_missionName = "Mercenary Group3"; + +// Create Markers +_markers = +[ + _pos, + _missionName, + _difficulty +] call DMS_CreateMarker; + +_time = diag_tickTime; +_added = +[ + _pos, + [ + [ + "kill", + _group + ], + [ + "playerNear", + [_pos,DMS_playerNearRadius] + ], + ], + [ + _time, + (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0)) + ], + [ + _group + ], + [ + [], // No spawned buildings + [_crate], + [_crate_loot_values] + ], + [_msgWIN,_msgLose], + _markers, + _side +] call DMS_AddMissionToMonitor; + +if !(_added) exitWith +{ + diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName]; +}; + + +// Notify players +_msgStart call DMS_BroadcastMissionStatus; + + + +if (DMS_DEBUG) then +{ + diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/mission4.sqf b/@ExileServer/addons/a3_dms/missions/mission4.sqf new file mode 100644 index 0000000..64a78d9 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/mission4.sqf @@ -0,0 +1,115 @@ +/* + Sample mission (duplicate for testing purposes) +*/ + +private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate_loot_values", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_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 = "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 = createVehicle ["Box_NATO_Wps_F",_pos,[], 0, "CAN_COLLIDE"]; + +// Set crate loot values +_crate_loot_values = +[ + 5, // Weapons + 10, // Items + 3 // Backpacks +]; + + +// Setup Mission Start message +_msgStart = format["A group of mercenaries has been spotted at %1! Kill them and take their equipment!",mapGridPosition _pos]; + +// Setup Mission Win message +_msgWIN = format["Convicts have successfully eliminated the mercenaries at %1!",mapGridPosition _pos]; + +// Setup Mission Lose message +_msgWIN = format["The mercenaries are no longer at %1!",mapGridPosition _pos]; + + +// Set mission name (for map marker and logging) +_missionName = "Mercenary Group4"; + +// Create Markers +_markers = +[ + _pos, + _missionName, + _difficulty +] call DMS_CreateMarker; + +_time = diag_tickTime; +_added = +[ + _pos, + [ + [ + "kill", + _group + ], + [ + "playerNear", + [_pos,DMS_playerNearRadius] + ], + ], + [ + _time, + (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0)) + ], + [ + _group + ], + [ + [], // No spawned buildings + [_crate], + [_crate_loot_values] + ], + [_msgWIN,_msgLose], + _markers, + _side +] call DMS_AddMissionToMonitor; + +if !(_added) exitWith +{ + diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor",_missionName]; +}; + + +// Notify players +_msgStart call DMS_BroadcastMissionStatus; + + + +if (DMS_DEBUG) then +{ + diag_log format ["DMS_DEBUG %1 :: Mission #%2 started at %3 with %4 AI units and %5 difficulty",_missionName,_num,_pos,_AICount,_difficulty]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/scripts/DMS_spawnAI.sqf b/@ExileServer/addons/a3_dms/scripts/DMS_spawnAI.sqf deleted file mode 100644 index 8a71d67..0000000 --- a/@ExileServer/addons/a3_dms/scripts/DMS_spawnAI.sqf +++ /dev/null @@ -1,116 +0,0 @@ - private ["_group", "_pos","_soldier","_skill","_units","_playerObject"]; - _pos = _this select 0; - _units = _this select 1; - _skill = _this select 2; - _group = createGroup EAST; - _group setBehaviour "COMBAT"; - _group setCombatMode "RED"; - _group allowFleeing 0; - - // Set AI owner to Player. - //_group setGroupOwner (owner player); - // Not tested this one, may need to apply above one. - //ExileServerOwnershipSwapQueue pushBack [_group,_playerObject]; - - - for "_i" from 1 to _units do { - _soldier = _group createUnit ["i_g_soldier_unarmed_f", [_pos select 0, _pos select 1, 0], [], 1, "Form"]; - - // Unlimmited ammo - _soldier addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]; - - removeAllAssignedItems _soldier; - removeUniform _soldier; - removeHeadgear _soldier; - removeAllItems _soldier; - removeAllWeapons _soldier; - uiSleep 1; - _soldier forceaddUniform "U_I_officerUniform"; - _soldier addVest " V_TacVest_blk_POLICE "; - _soldier addGoggles "G_Tactical_Clear"; - for "_i" from 1 to 3 do { - _soldier addItemToVest "30Rnd_65x39_caseless_mag"; - }; - _soldier addWeapon "arifle_MXC_Holo_pointer_F"; - _soldier setRank "Private"; - { - _soldier enableAI _x; - }forEach ["TARGET","AUTOTARGET","MOVE","ANIM"]; - _soldier disableAI "FSM"; - _soldier allowDammage true; - - // FIX FOR Ai vs Ai killing. - [_soldier] joinSilent _group; - - // Trigger for AI being killed. - //_soldier addEventHandler ["Killed",{ [(_this select 0), (_this select 1)] call on_kill; }]; - - switch (_skill) do - { - case 1: - { - _soldier setSkill ["aimingspeed", 0.05]; - _soldier setSkill ["spotdistance", 0.05]; - _soldier setSkill ["aimingaccuracy", 0.02]; - _soldier setSkill ["aimingshake", 0.02]; - _soldier setSkill ["spottime", 0.1]; - _soldier setSkill ["spotdistance", 0.3]; - _soldier setSkill ["commanding", 0.3]; - _soldier setSkill ["general", 0.2]; - }; - case 2: - { - _soldier setSkill ["spotdistance", 0.1]; - _soldier setSkill ["aimingaccuracy", 0.05]; - _soldier setSkill ["aimingshake", 0.05]; - _soldier setSkill ["spottime", 0.2]; - _soldier setSkill ["spotdistance", 0.4]; - _soldier setSkill ["commanding", 0.4]; - _soldier setSkill ["general", 0.3]; - }; - case 3: - { - _soldier setSkill ["aimingspeed", 0.15]; - _soldier setSkill ["spotdistance", 0.15]; - _soldier setSkill ["aimingaccuracy", 0.1]; - _soldier setSkill ["aimingshake", 0.1]; - _soldier setSkill ["spottime", 0.3]; - _soldier setSkill ["spotdistance", 0.5]; - _soldier setSkill ["commanding", 0.5]; - _soldier setSkill ["general", 0.6]; - }; - case 4: - { - _soldier setSkill ["aimingspeed", 0.3]; - _soldier setSkill ["spotdistance", 0.3]; - _soldier setSkill ["aimingaccuracy", 0.3]; - _soldier setSkill ["aimingshake", 0.3]; - _soldier setSkill ["spottime", 0.4]; - _soldier setSkill ["spotdistance", 0.6]; - _soldier setSkill ["commanding", 0.6]; - _soldier setSkill ["general", 0.7]; - }; - case 5: - { - - _soldier setSkill ["aimingspeed", 0.9]; - _soldier setSkill ["spotdistance", 0.9]; - _soldier setSkill ["aimingaccuracy", 0.9]; - _soldier setSkill ["aimingshake", 0.9]; - _soldier setSkill ["spottime", 0.9]; - _soldier setSkill ["spotdistance", 0.9]; - _soldier setSkill ["commanding", 0.8]; - }; - case 6: // Stupidly fucking OP. - { - _soldier setSkill ["aimingspeed", 1]; - _soldier setSkill ["spotdistance", 1]; - _soldier setSkill ["aimingaccuracy", 1]; - _soldier setSkill ["aimingshake", 1]; - _soldier setSkill ["spottime", 1]; - _soldier setSkill ["spotdistance", 1]; - _soldier setSkill ["commanding", 1]; - }; - }; - }; -_soldier diff --git a/@ExileServer/addons/a3_dms/scripts/findSafePos.sqf b/@ExileServer/addons/a3_dms/scripts/findSafePos.sqf index da2095d..55cc60c 100644 --- a/@ExileServer/addons/a3_dms/scripts/findSafePos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/findSafePos.sqf @@ -4,15 +4,19 @@ Usage: [ - _nearestObjectMinDistance, - _maxTerrainGradient + _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]]]; +params +[ + ["_nearestObjectMinDistance",25,[0]], + ["_maxTerrainGradient",10,[0]] +]; _safePosParams = [