From 8483ca60ebf2f698be868bdb6ffafd146949fb37 Mon Sep 17 00:00:00 2001 From: Defent Date: Tue, 1 Sep 2015 18:59:35 +0200 Subject: [PATCH] Update Added 3 new missions. Added ownership transfer of AI. --- @ExileServer/addons/a3_dms/config.sqf | 7 +- @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 1 + .../addons/a3_dms/missions/bauhaus.sqf | 151 +++++++++++++++++ .../addons/a3_dms/missions/lost_battalion.sqf | 151 +++++++++++++++++ .../addons/a3_dms/missions/walmart.sqf | 154 ++++++++++++++++++ .../addons/a3_dms/scripts/SetAILocality.sqf | 28 ++++ .../addons/a3_dms/scripts/SpawnAIGroup.sqf | 15 +- Pre-Packed PBO/a3_dms.pbo | Bin 99512 -> 112466 bytes 8 files changed, 502 insertions(+), 5 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/missions/bauhaus.sqf create mode 100644 @ExileServer/addons/a3_dms/missions/lost_battalion.sqf create mode 100644 @ExileServer/addons/a3_dms/missions/walmart.sqf create mode 100644 @ExileServer/addons/a3_dms/scripts/SetAILocality.sqf diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 0c9cf5a..bdd17de 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -58,9 +58,12 @@ DMS_DEBUG = false; 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], + ["mission2",25], ["mission3",15], - ["mission4",10] + ["mission4",10], + ["bauhaus",45], + ["lost_battalion",30], + ["walmart",20] ]; DMS_findSafePosBlacklist = [ // For BIS_fnc_findSafePos position blacklist info refer to: https://community.bistudio.com/wiki/BIS_fnc_findSafePos diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index 6543701..c5e1443 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -33,6 +33,7 @@ DMS_AddMissionToMonitor = compileFinal preprocessFileLineNumbers "\x\addons\d DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\CreateMarker.sqf"; DMS_FindSuppressor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FindSuppressor.sqf"; DMS_SpawnCrate = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnCrate.sqf"; +DMS_SetAILocality = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetAILocality.sqf"; //Load config call compileFinal preprocessFileLineNumbers "\x\addons\dms\config.sqf"; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/bauhaus.sqf b/@ExileServer/addons/a3_dms/missions/bauhaus.sqf new file mode 100644 index 0000000..e181886 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/bauhaus.sqf @@ -0,0 +1,151 @@ +/* + 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","_wreck"]; + +// 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 = "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; + +_wreck = createVehicle ["Land_Wreck_Ural_F",[(_pos select 0) - 10, (_pos select 1),-0.2],[], 0, "CAN_COLLIDE"]; + +// Set crate loot values +_crate_loot_values = +[ + 2, // Weapons + 15, // Items + 2 // 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,_wreck], + _crate_loot_values +]; + +// Define Mission Start message +_msgStart = format["A Bauhaus truck has crashed and lost all its building supplies, get there quickly!"]; + +// Define Mission Win message +_msgWIN = format["Convicts have successfully claimed the crashed Buahaus truck %1!"]; + +// Define Mission Lose message +_msgLOSE = format["The Bauhause truck has been repaired and escaped!"]; + + +// Define mission name (for map marker and logging) +_missionName = "Bauhaus Truck"; + +// 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]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/lost_battalion.sqf b/@ExileServer/addons/a3_dms/missions/lost_battalion.sqf new file mode 100644 index 0000000..5fdc685 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/lost_battalion.sqf @@ -0,0 +1,151 @@ +/* + Sample mission + Created by Defent and eraser1 + + Called from DMS_selectMission +*/ + +private ["_num", "_side", "_pos", "_difficulty", "_AICount", "_group", "_crate", "_crate2", "_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 = "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; +uiSleep 3; +_crate2 = ["Box_NATO_Wps_F",_pos] call DMS_SpawnCrate; + +// Set crate loot values +_crate_loot_values = +[ + 7, // Weapons + 5, // Items + 5 // 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,_crate2], + _crate_loot_values +]; + +// Define Mission Start message +_msgStart = format["A battalion of soldiers have gotten lost in convict land! Eliminate them!"]; + +// Define Mission Win message +_msgWIN = format["Convicts have successfully eliminated the lost battalion!"]; + +// Define Mission Lose message +_msgLOSE = format["Whittlesey escaped with his Lost Battalion!"]; + + +// Define mission name (for map marker and logging) +_missionName = "Lost Battalion"; + +// 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]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/walmart.sqf b/@ExileServer/addons/a3_dms/missions/walmart.sqf new file mode 100644 index 0000000..94c1e31 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/walmart.sqf @@ -0,0 +1,154 @@ +/* + 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","_wreck1","_wreck2","_wreck3","_wreck4"]; + +// 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; +_wreck1 = createVehicle ["Land_i_Shop_01_V1_F",[(_pos select 0) - 10, (_pos select 1),-0.1],[], 0, "CAN_COLLIDE"]; +_wreck2 = createVehicle ["Land_Sacks_goods_F",[(_pos select 0) - 2, (_pos select 1),-0.8],[], 0, "CAN_COLLIDE"]; +_wreck3 = createVehicle ["Land_StallWater_F",[(_pos select 0) - 5, (_pos select 1),-0.8],[], 0, "CAN_COLLIDE"]; +_wreck4 = createVehicle ["Land_WoodenCart_F",[(_pos select 0) - 16, (_pos select 1),-0.5],[], 0, "CAN_COLLIDE"]; +_wreck4 = createVehicle ["Land_CratesWooden_F",[(_pos select 0) - 16, (_pos select 1),-0.3],[], 0, "CAN_COLLIDE"]; + +// Set crate loot values +_crate_loot_values = +[ + 2, // Weapons + 15, // Items + 2 // 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 = +[ + [_wreck1,_wreck2,_wreck3,_wreck4], // No spawned buildings + [_crate], + _crate_loot_values +]; + +// Define Mission Start message +_msgStart = format["A local Walmart shop is being raided, stop the raiders and take the loot!"]; + +// Define Mission Win message +_msgWIN = format["Convicts have done a good deed and stopped the raiders!"]; + +// Define Mission Lose message +_msgLOSE = format["The raiders has looted everything from Walmart and escaped!"]; + + +// Define mission name (for map marker and logging) +_missionName = "Walmart Riot"; + +// 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]; +}; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/scripts/SetAILocality.sqf b/@ExileServer/addons/a3_dms/scripts/SetAILocality.sqf new file mode 100644 index 0000000..11af5a9 --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/SetAILocality.sqf @@ -0,0 +1,28 @@ +/* + Makes a random player within 3 KM of the AI the owner. + Offloading AI can increase server performance. + Could however have negative effects if target player has a potato PC. + + How To Use: + [_pos, _group] call DMS_SetAILocality; + Posistion of the player and the group that the AIs are in. + +*/ +private ["_group","_position","_exit","_randomPlayer"]; + +_group = _this select 0; +_position = _this select 1; +_exit = false; + +while {!_exit} do +{ + _randomPlayer = call ExileServer_system_session_getRandomPlayer; + if((_randomPlayer distance2D _position) < 3000)then + { + _exit = true; + }; +}; + +ExileServerOwnershipSwapQueue pushBack [_group,_randomPlayer]; + +true \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/scripts/SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/SpawnAIGroup.sqf index d9af1f2..ce40852 100644 --- a/@ExileServer/addons/a3_dms/scripts/SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/SpawnAIGroup.sqf @@ -80,12 +80,16 @@ for "_i" from 1 to _count do { // An AI will definitely spawn with a launcher if you define type if ((!isNil "_launcher") || {DMS_ai_use_launchers && {(random 100) <= DMS_ai_use_launchers_chance}}) then { + /* if (!isNil "_launcher") then { _launcher = "AT"; }; _launcher = ((missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcher],["launch_NLAW_F"]]) call BIS_fnc_selectRandom); + */ + + _launcher = DMS_AI_wep_launchers_AT call BIS_fnc_selectRandom; _unit addBackpack "B_Carryall_mcamo"; @@ -110,13 +114,18 @@ if(_pos_z == 0) then if (DMS_ai_offload_to_client) then -{ +{ + /* _client = (allPlayers call BIS_fnc_selectRandom); ExileServerOwnershipSwapQueue pushBack [_group,_client]; + */ + + [_group,_pos] call DMS_SetAILocality; + if(DMS_DEBUG) then { - diag_log format["DMS_DEBUG SpawnAIGroup :: Swapping group ownership of %1 to %2",_group,_client]; - }; + diag_log format["DMS_DEBUG SpawnAIGroup :: Swapping group ownership of %1 to clients.",_group]; + }; }; diff --git a/Pre-Packed PBO/a3_dms.pbo b/Pre-Packed PBO/a3_dms.pbo index 632f00037820f96205d94537a9a390c788d5e847..7bc5e58a4c1a9db076db6a7abb594d34270adab7 100644 GIT binary patch delta 3256 zcmbVOYit`;7WOy~Y7>{FMM-&;TO-;eoj87^yi-Wiq6X47C3OQhW;7XJ#}|)hrgO)2 z0<8=Zu&P$DTV1JPr9~=jMJrUGV5IVpfR-OH_0~k2? z_VwizEv^FosG8*Kdq=m87YL;UNJX-=Af!LU+(Z4JTuSnF?ZEhiTFj|M>Y4TV&M$Wl z-uihp$=CIRIuKAMRL4VWyH;A^4}8EPQfE`?(@V+w#HJyw z5N|uh+wU;RA|7vHF|^Zsrj{ocQ>Z3_529rF38W)sVy<5?DKxK2oSG|2w! zzu5kU?p6-}AS9-Ch)LhAWPfjH6X*Wj(8G;~8sq#i(6~-u0cVzdncFr^KePeie-b*O@xSGtju&$=AW!&ZqH~M@G8STt! zazph*(|XR~m8Py6xO|ywaN+;Tk4+ca*r|?d*?&83O39&M;OAc|>=i&*?%R;QTsA-F zVL1_9aKuYZSdK^23_aX2b9R+MxGGC8c2Y^>$k z>Qg6}d1Nb2x*5CE`&; zs;(pAP&82_dWIO2h!!nNCz#4;640C+wlUgMBwAjdUK3_JkFR21ymZG}O;r`CK&%uIqd41lY?57=ZL54S+aa~c z-tN2zZLK#BWM&aHAq3c_5UITwO`47aG)0t%fuJ4kC6GTILbnEO(Mf?AkO>}vLOn1; zt>Spysu0{RkL8Ht=$PVZoNB0PnCdScX}# z1Y+!#MIoW}E!7a*xGo7f$lC-R6TmghjhAcox1VulAd8@HilEE1nQ3rN;ClMQP|9E$D)V#P{Z~;xH ze!+UW;hP2{6>g`QK^g3|4{ib4$6O;qrT?~?N#6XpB{+olVtd-jaRyo2EY!(y)CGO0 zrAGY$VmfdMziwu2-*i-tUA(JM-UbwbEYLPGV8_zcX>5y|4gDg4?%&3n3ioSZNIcAv zf$a#)xgFW8ZmOc)f=E*hL<~MiD26Fv13hG6J8Rkn)zC0k7&MD|2Ib5W=kB&A1D7XN zhd`sk*(?keiU@$IHt*UV6YjH$EYndP6O9alAuzSoETLT{N>Y3WyruYPl94iLn?)-P zRA3w|n2*p>10yCS)PXOonopKq7Ve5%fseuhxT%Vv0WJeJj1FQ5*zVp?(6Y&1-Z4{Q z7mjx*KquTPU*jp_@TVKj5fM#q_PGjhy%fk>ZIq@^lsEgDiOZxY#)aG_2(qe9F}#O@ zr5u4d{rDOo*^e?N3I!hr|K_2h{+SntrEAI*i_cXBV)}r{u}caJ1xU8DbG}Xn;=}V5 z-;C;pb8Ao;z)rSDVWNfQ(!;*__e7~0@8&*Q+5Qo>e!mns9hW)8MWH=O=M zO8T4B8~_zCF_M<-h-V??##-h+{6ay@yq}gH4QueFU^p}qmc0sc{QiSu(Kz delta 655 zcmccgj%`OL+XOL(qSUm^3Wkc9#FUi$yy6%a-(Uvc%A<3 zM@+0$(oGkB7`lszfgvp~9%xZ~K~bt_USuY#=-S8BX?MRADmZ znq0uB!TK90;x+jrqwwSnj6$rxfV@C3?-rvF)9*c#-!bYiS6zNQS(ZtM?brXup(ZSo zE12|{+s;0oypqX;iF4xQ`%G#~txS{InRS_`|9vvqoLP%mZPVk)Da`7EAk$iT85oL_ zi!uvJieua+&taBkUby-3?^$x}1sCtI@cGRyfrn(WD< z%k=K=v@VE^OKoEO!eU8-Rd#t?7yl);)e#ff8T>kFyWJxw{ zjxS74LVp7_PyUxAW(GEc17Z?`i^79Y7#k{tppavIa}V1&K_*j!$@UTwlS?F&H-C~a z2;1D7-)FqJ;J{J)?LPzto!)IDJBOfO<(C%d#3$!urskEzTJv&o)>?1BGl4NlP2^nF4A-v@r8Wz)1(_b_ L=G!}^^-muFhnCcC