diff --git a/DMS_init.sqf b/DMS_init.sqf new file mode 100644 index 0000000..ee1efda --- /dev/null +++ b/DMS_init.sqf @@ -0,0 +1,31 @@ +// Loads compiles +// Made by Defent for Defents Mission System +// And for Numenadayz.com + +if(isServer) then { + + // compilation list + DMS_findSafePos = compileFinal preprocessFileLineNumbers "scripts\DMS_findSafePos.sqf"; + DMS_createBox = compileFinal preprocessFileLineNumbers "crates\DMS_CreateBox.sqf"; + DMS_CreateMarker = compileFinal preprocessFileLineNumbers "scripts\DMS_CreateMarker.sqf"; + DMS_spawnAI = compileFinal preprocessFileLineNumbers "scripts\DMS_spawnAI.sqf"; + DMS_selectMission = compileFinal preprocessFileLineNumbers "scripts\DMS_selectMission.sqf"; + DMS_CleanUp = compileFinal preprocessFileLineNumbers "scripts\DMS_CleanUp.sqf"; + DMS_Config = compileFinal preprocessFileLineNumbers "scripts\DMS_Config.__sqf2str"; + + + + // not fully loaded yet + DMS_Loaded = false; + + call DMS_Config; + + waitUntil {DMS_Loaded}; + + call DMS_selectMission; + + + diag_log "DMS :: Functions loaded - starting the rest of the script."; + + +}; diff --git a/missions/MM1.sqf b/missions/MM1.sqf index 55800e7..ae98950 100644 --- a/missions/MM1.sqf +++ b/missions/MM1.sqf @@ -20,7 +20,7 @@ GlobalHint = [0,_misText]; publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -57,4 +57,4 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM10.sqf b/missions/MM10.sqf index 1da14c1..bfe11e0 100644 --- a/missions/MM10.sqf +++ b/missions/MM10.sqf @@ -25,7 +25,7 @@ publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -61,5 +61,5 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM2.sqf b/missions/MM2.sqf index ace8d41..3b129b2 100644 --- a/missions/MM2.sqf +++ b/missions/MM2.sqf @@ -24,7 +24,7 @@ GlobalHint = [0,_misText]; publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -59,4 +59,4 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM3.sqf b/missions/MM3.sqf index 654d5eb..f236a25 100644 --- a/missions/MM3.sqf +++ b/missions/MM3.sqf @@ -24,7 +24,7 @@ GlobalHint = [0,_misText]; publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -60,4 +60,4 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; \ No newline at end of file +CALL DMS_selectMission.sqf; \ No newline at end of file diff --git a/missions/MM4.sqf b/missions/MM4.sqf index 9f2b9fa..436f7f3 100644 --- a/missions/MM4.sqf +++ b/missions/MM4.sqf @@ -25,7 +25,7 @@ publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -59,5 +59,5 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM5.sqf b/missions/MM5.sqf index 522c2ea..a7b51ba 100644 --- a/missions/MM5.sqf +++ b/missions/MM5.sqf @@ -24,7 +24,7 @@ publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -61,4 +61,4 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM6.sqf b/missions/MM6.sqf index c08d73a..b036634 100644 --- a/missions/MM6.sqf +++ b/missions/MM6.sqf @@ -24,7 +24,7 @@ GlobalHint = [0,_misText]; publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -61,4 +61,4 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM7.sqf b/missions/MM7.sqf index f95457f..e0bdee0 100644 --- a/missions/MM7.sqf +++ b/missions/MM7.sqf @@ -25,7 +25,7 @@ GlobalHint = [0,_misText]; publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -60,5 +60,5 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM8.sqf b/missions/MM8.sqf index df2c6b3..ea112b2 100644 --- a/missions/MM8.sqf +++ b/missions/MM8.sqf @@ -25,7 +25,7 @@ publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -60,5 +60,5 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; +CALL DMS_selectMission.sqf; diff --git a/missions/MM9.sqf b/missions/MM9.sqf index 20d828b..d18bbdb 100644 --- a/missions/MM9.sqf +++ b/missions/MM9.sqf @@ -24,7 +24,7 @@ GlobalHint = [0,_misText]; publicVariable "GlobalHint"; // Spawn Marker -[_pos,_missname] execVM "mission\scripts\DMS_CreateMarker.sqf"; +[_pos,_missname] execVM "scripts\DMS_CreateMarker.sqf"; // Spawn Box _crate = createVehicle ["Box_NATO_AmmoOrd_F",[(_pos select 0) - 10, _pos select 1,0],[], 0, "CAN_COLLIDE"]; @@ -58,4 +58,4 @@ publicVariable "GlobalHint"; sleep 150; -[] execVM "mission\scripts\DMS_selectMission.sqf"; \ No newline at end of file +CALL DMS_selectMission.sqf; \ No newline at end of file diff --git a/scripts/DMS_Config.sqf b/scripts/DMS_Config.sqf index 555a752..7c951ab 100644 --- a/scripts/DMS_Config.sqf +++ b/scripts/DMS_Config.sqf @@ -1,14 +1,16 @@ -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; +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; + }; }; \ No newline at end of file diff --git a/scripts/DMS_CreateMarker.sqf b/scripts/DMS_CreateMarker.sqf index 926cf28..6583b41 100644 --- a/scripts/DMS_CreateMarker.sqf +++ b/scripts/DMS_CreateMarker.sqf @@ -1,14 +1,16 @@ -private["_mark","_name"]; -DMS_Cords = _this select 0; -DMS_MainName = _this select 1; +DMS_CreateMarker = { + private["_mark","_name"]; + DMS_Cords = _this select 0; + DMS_MainName = _this select 1; -_mark = createMarker ["DMS_MainMarker", DMS_Cords]; -"DMS_MainMarker" setMarkerColor "ColorRed"; -"DMS_MainMarker" setMarkerShape "ELLIPSE"; -"DMS_MainMarker" setMarkerBrush "Grid"; -"DMS_MainMarker" setMarkerSize [150,150]; + _mark = createMarker ["DMS_MainMarker", DMS_Cords]; + "DMS_MainMarker" setMarkerColor "ColorRed"; + "DMS_MainMarker" setMarkerShape "ELLIPSE"; + "DMS_MainMarker" setMarkerBrush "Grid"; + "DMS_MainMarker" setMarkerSize [150,150]; -_name = createMarker ["DMS_MainDot", DMS_Cords]; -"DMS_MainDot" setMarkerColor "ColorBlack"; -"DMS_MainDot" setMarkerType "mil_dot"; -"DMS_MainDot" setMarkerText DMS_MainName; + _name = createMarker ["DMS_MainDot", DMS_Cords]; + "DMS_MainDot" setMarkerColor "ColorBlack"; + "DMS_MainDot" setMarkerType "mil_dot"; + "DMS_MainDot" setMarkerText DMS_MainName; +}; \ No newline at end of file diff --git a/scripts/DMS_findSafePos.sqf b/scripts/DMS_findSafePos.sqf index 61df6ef..53cb250 100644 --- a/scripts/DMS_findSafePos.sqf +++ b/scripts/DMS_findSafePos.sqf @@ -1,32 +1,33 @@ -if(isServer) then { - private ["_pos","_centerPos","_fetchPos"]; +DMS_findSafePos = { + if(isServer) then { + private ["_pos","_centerPos","_fetchPos"]; - //_centerPos = [getMarkerPos "center",4000,20000,10,0,25,0]; - _centerPos = [getMarkerPos "center",2000,4000,10,0,25,0]; - - _fetchPos = false; - - _int = 1; - - - while {!_fetchPos} do { - - sleep 2; + //_centerPos = [getMarkerPos "center",4000,20000,10,0,25,0]; + _centerPos = [getMarkerPos "center",2000,4000,10,0,25,0]; - _pos = _centerPos call BIS_fnc_findSafePos; - _int = _int + 1; - _fetchPos = true; - - if (_fetchPos) then { - diag_log format ["DMS :: Found valid position at: (%1) in (%2) tries!",_pos,_int]; - }; + _fetchPos = false; + + _int = 1; + + + while {!_fetchPos} do { + + sleep 2; + + _pos = _centerPos call BIS_fnc_findSafePos; + _int = _int + 1; + _fetchPos = true; + + if (_fetchPos) then { + diag_log format ["DMS :: Found valid position at: (%1) in (%2) tries!",_pos,_int]; + }; - // more if exceptions to come - - // water if exception to be added above - + // more if exceptions to come + + // water if exception to be added above + + }; }; }; - diff --git a/scripts/DMS_selectMission.sqf b/scripts/DMS_selectMission.sqf index 29d3310..9698255 100644 --- a/scripts/DMS_selectMission.sqf +++ b/scripts/DMS_selectMission.sqf @@ -1,23 +1,25 @@ -private ["_sleepTime","_run","_countArray","_randomMiss","_missVar","_minTime","_maxTime","_missionFnc","_MainArray"]; -// First we add the array of missions -_MainArray = ["MM1","MM2","MM3","MM4","MM5","MM6","MM7","MM8","MM9","MM10"]; -//DMS_SideArray = ["SM1","SM2"]; -/* -_minTime = 1*600; //1 sec -_maxTime = 2*600; //4 sec -*/ -_minTime = 1*5; //1 sec -_maxTime = 2*10; //4 sec +DMS_SelectMission = { + private ["_sleepTime","_run","_countArray","_randomMiss","_missVar","_minTime","_maxTime","_missionFnc","_MainArray"]; + // First we add the array of missions + _MainArray = ["MM1","MM2","MM3","MM4","MM5","MM6","MM7","MM8","MM9","MM10"]; + //DMS_SideArray = ["SM1","SM2"]; + /* + _minTime = 1*600; //1 sec + _maxTime = 2*600; //4 sec + */ + _minTime = 1*5; //1 sec + _maxTime = 2*10; //4 sec -_sleepTime = (random (_maxTime - _minTime)) + _minTime; -sleep _sleepTime; + _sleepTime = (random (_maxTime - _minTime)) + _minTime; + sleep _sleepTime; -_countArray = count _MainArray; -_slct = floor (random _countArray); -_missVar = _MainArray select _slct; + _countArray = count _MainArray; + _slct = floor (random _countArray); + _missVar = _MainArray select _slct; + // Help from secret skype group. + call compile preprocessfilelinenumbers format["mission\missions\%1.sqf",_missVar]; -[] execVM format ["mission\missions\%1.sqf",_missVar]; - -//DMS_MissionRunning = 1; + //DMS_MissionRunning = 1; +}; \ No newline at end of file diff --git a/scripts/init.sqf b/scripts/init.sqf deleted file mode 100644 index ae53287..0000000 --- a/scripts/init.sqf +++ /dev/null @@ -1,28 +0,0 @@ -// Loads compiles -// Made by Defent for Defents Mission System -// And for Numenadayz.com - -if(isServer) then { - - // compilation list - DMS_findSafePos = compile preprocessFileLineNumbers "mission\scripts\DMS_findSafePos.sqf"; - DMS_createBox = compile preprocessFileLineNumbers "mission\crates\DMS_CreateBox.sqf"; - DMS_CreateMarker = compile preprocessFileLineNumbers "mission\scripts\DMS_CreateMarker.sqf"; - DMS_spawnAI = compile preprocessFileLineNumbers "mission\scripts\DMS_spawnAI.sqf"; - DMS_selectMission = compile preprocessFileLineNumbers "mission\scripts\DMS_selectMission.sqf"; - DMS_CleanUp = compile preprocessFileLineNumbers "mission\scripts\DMS_CleanUp.sqf"; - - - // not fully loaded yet - DMS_Loaded = false; - - execVM "mission\scripts\DMS_Config.sqf"; - waitUntil {DMS_Loaded}; - - execVM "mission\scripts\DMS_selectMission.sqf"; - - - diag_log "DMS :: Functions loaded - starting the rest of the script."; - - -};