From 9213ec24ca9ebdb036b840cee6ed7fbdfc510cea Mon Sep 17 00:00:00 2001 From: second_coming Date: Wed, 30 Mar 2016 09:33:25 +0100 Subject: [PATCH] Tidied file structure Added old Dayz style helicrashes --- README.md | 11 -- config.sqf | 37 +++++-- initServer.sqf | 40 +++++-- occupationVehicle.sqf | 86 --------------- reactions/reactUnit.sqf | 15 --- readme.txt | 11 ++ scripts/deleteMapMarkers.sqf | 16 +++ occupation.sqf => scripts/occupation.sqf | 14 +-- scripts/occupationHeliCrashes.sqf | 101 ++++++++++++++++++ .../occupationLootCrates.sqf | 39 +++---- .../occupationMilitary.sqf | 20 +--- .../occupationSky.sqf | 16 +-- .../occupationStatic.sqf | 18 +--- scripts/occupationVehicle.sqf | 75 +++++++++++++ {reactions => scripts/reactions}/airHit.sqf | 16 +-- .../reactions}/driverKilled.sqf | 16 +-- scripts/reactions/reactUnit.sqf | 1 + .../reactions}/repairVehicle.sqf | 17 +-- .../startOccupation.sqf | 25 ++++- 19 files changed, 314 insertions(+), 260 deletions(-) delete mode 100644 README.md delete mode 100644 occupationVehicle.sqf delete mode 100644 reactions/reactUnit.sqf create mode 100644 readme.txt create mode 100644 scripts/deleteMapMarkers.sqf rename occupation.sqf => scripts/occupation.sqf (94%) create mode 100644 scripts/occupationHeliCrashes.sqf rename occupationLootCrates.sqf => scripts/occupationLootCrates.sqf (84%) rename occupationMilitary.sqf => scripts/occupationMilitary.sqf (91%) rename occupationSky.sqf => scripts/occupationSky.sqf (79%) rename occupationStatic.sqf => scripts/occupationStatic.sqf (89%) create mode 100644 scripts/occupationVehicle.sqf rename {reactions => scripts/reactions}/airHit.sqf (86%) rename {reactions => scripts/reactions}/driverKilled.sqf (76%) create mode 100644 scripts/reactions/reactUnit.sqf rename {reactions => scripts/reactions}/repairVehicle.sqf (66%) rename startOccupation.sqf => scripts/startOccupation.sqf (60%) diff --git a/README.md b/README.md deleted file mode 100644 index 3ce5e35..0000000 --- a/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# a3_exile_occupation -An AI spawner and monitor to be used in conjunction with DMS and will not work without it: -http://www.exilemod.com/topic/61-dms-defents-mission-system/ - -Download the pbo version here: -https://www.dropbox.com/s/dxy44l4mfu6ys53/a3_exile_occupation.pbo?dl=0 - -To install place the pbo into the @ExileServer/addons folder - -For more info: -http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai diff --git a/config.sqf b/config.sqf index a30a772..5067c25 100644 --- a/config.sqf +++ b/config.sqf @@ -1,12 +1,23 @@ +//////////////////////////////////////////////////////////////////////// +// +// Server Occupation script by second_coming +// +// Version 2.1 +// +// http://www.exilemod.com/profile/60-second_coming/ +// +// This script uses the fantastic DMS by Defent and eraser1 +// +// http://www.exilemod.com/topic/61-dms-defents-mission-system/ +// +//////////////////////////////////////////////////////////////////////// + // Shared Config for each occupation monitor SC_debug = false; // set to true for additional logging and to speed up the spawn rate for testing SC_infiSTAR_log = true; // Use infiSTAR logging SC_maxAIcount = 100; // the maximum amount of AI, if the AI count is above this then additional AI won't spawn - // As Namalsk is a smaller map, lower the maximum AI count -if (worldName == 'Namalsk') then { SC_maxAIcount = 80; }; - SC_mapMarkers = false; // Place map markers at the occupied areas (occupyPlaces and occupyMilitary only) true/false SC_minFPS = 8; // any lower than minFPS on the server and additional AI won't spawn @@ -15,7 +26,6 @@ SC_scaleAI = 10; // any more than _scaleAI players on the server and _m SC_useWaypoints = true; // When spawning AI create waypoints to make them enter buildings // (can affect performance when the AI is spawned and the waypoints are calculated) - SC_occupyPlaces = true; // true if you want villages,towns,cities patrolled SC_occupyMilitary = false; // true if you want military buildings patrolled (specify which types of building in occupationMilitary.sqf) SC_occupyStatic = false; // true if you want to garrison AI in specific locations (not working yet) @@ -23,10 +33,10 @@ SC_occupyVehicle = true; // true if you want to have roaming AI vehicles SC_occupySky = true; // true if you want to have roaming AI helis SC_occupyLootCrates = true; // true if you want to have random loot crates with guards SC_occupyLootCratesMarkers = true; // true if you want to have markers on the loot crate spawns +SC_occupyHeliCrashes = true; // true if you want to have Dayz style helicrashes SC_statics = [ - [[4151,6697,0],4,100,true], - [[3560,6673,0],4,100,true] + [[1178,2524,0],4,100,true] ]; //[[pos],ai count,radius,search buildings] // Which buildings to patrol with the occupyMilitary option (adding more classnames could affect server performance when the spawning occurs) @@ -34,7 +44,6 @@ SC_buildings = [ "Land_Cargo_Patrol_V1_F", "Land_i_Barracks_V1_F", "Land_i_Barracks_V1_dam_F", "Land_i_Barracks_V2_F", - "Land_u_Barracks_V2_F", "Land_Cargo_House_V1_F", "Land_Cargo_HQ_V1_F", "Land_Cargo_HQ_V2_F", @@ -65,7 +74,9 @@ SC_buildings = [ "Land_Cargo_Patrol_V1_F", SC_maxNumberofVehicles = 3; // Number of roaming vehicles required, randomly selected from VehicleClassToUse SC_VehicleClassToUse = [ "Exile_Car_LandRover_Green", "Exile_Car_UAZ_Open_Green", - "Exile_Car_Offroad_Armed_Guerilla01"]; + "Exile_Car_UAZ_Green", + "Exile_Car_Offroad_Guerilla03" + ]; @@ -74,10 +85,16 @@ SC_maxNumberofHelis = 1; // Number of roaming vehicles required, randomly SC_HeliClassToUse = [ "Exile_Chopper_Huey_Armed_Green"]; - + // namalsk specific settings +if (worldName == 'Namalsk') then +{ + SC_maxAIcount = 80; + SC_occupySky = false; +}; // Don't alter anything below this point SC_liveVehicles = 0; publicVariable "SC_liveVehicles"; SC_liveHelis = 0; -publicVariable "SC_liveHelis"; \ No newline at end of file +publicVariable "SC_liveHelis"; +publicVariable "SC_numberofLootCrates"; \ No newline at end of file diff --git a/initServer.sqf b/initServer.sqf index 9383641..392bd80 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -1,15 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////////////////// +// +// Server Occupation script by second_coming +// +// Version 2.1 +// +// http://www.exilemod.com/profile/60-second_coming/ +// +// This script uses the fantastic DMS by Defent and eraser1 +// +// http://www.exilemod.com/topic/61-dms-defents-mission-system/ +// special thanks to eichi for pointers on this script :) +// +//////////////////////////////////////////////////////////////////////////////////////////// +// +// I do not give permission for anyone to sell (or charge for the installation of) +// any part of this set of scripts. +// +// second_coming 2016 +// +//////////////////////////////////////////////////////////////////////////////////////////// + diag_log format ["[OCCUPATION MOD]:: Initialised at %1",time]; -SC_fnc_repairVehicle = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\reactions\repairVehicle.sqf"; -SC_fnc_reactUnit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\reactions\reactUnit.sqf"; -SC_fnc_driverKilled = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\reactions\driverKilled.sqf"; -SC_fnc_airHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\reactions\airHit.sqf"; +// EventHandlers for AI reactions +SC_fnc_repairVehicle = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\repairVehicle.sqf"; +SC_fnc_reactUnit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\reactUnit.sqf"; +SC_fnc_driverKilled = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\driverKilled.sqf"; +SC_fnc_airHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\airHit.sqf"; +// Get the config for Occupation call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\config.sqf"; -[] execVM "\x\addons\a3_exile_occupation\startOccupation.sqf"; - -if(SC_occupyLootCrates) then -{ - call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\occupationLootCrates.sqf"; -}; +// Start Occupation +[] execVM "\x\addons\a3_exile_occupation\scripts\startOccupation.sqf"; \ No newline at end of file diff --git a/occupationVehicle.sqf b/occupationVehicle.sqf deleted file mode 100644 index a130765..0000000 --- a/occupationVehicle.sqf +++ /dev/null @@ -1,86 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - -diag_log format['[OCCUPATION:Vehicle] Started']; - -if (!isServer) exitWith {}; - -if(SC_liveVehicles >= SC_maxNumberofVehicles) exitWith {}; - -_vehiclesToSpawn = (SC_maxNumberofVehicles - SC_liveVehicles); -_middle = worldSize/2; -_spawnCenter = [_middle,_middle,0]; -_maxDistance = _middle; - -_locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCityCapital"], _maxDistance]); -_i = 0; -{ - _okToUse = true; - _pos = position _x; - _nearestMarker = [allMapMarkers, _pos] call BIS_fnc_nearestPosition; // Nearest Marker to the Location - _posNearestMarker = getMarkerPos _nearestMarker; - if(_pos distance _posNearestMarker < 2500) exitwith { _okToUse = false; }; - - if(!_okToUse) then - { - _locations deleteAt _i; - }; - _i = _i + 1; - sleep 0.2; - -} forEach _locations; - -for "_j" from 1 to _vehiclesToSpawn do -{ - private["_group"]; - _Location = _locations call BIS_fnc_selectRandom; - _position = position _Location; - _pos = [_position,10,100,5,0,20,0] call BIS_fnc_findSafePos; - _spawnLocation = [_pos select 0, _pos select 1, 150]; - - // Get position of nearest roads - _nearRoads = _spawnLocation nearRoads 500; - _nearestRoad = _nearRoads select 0; - _nearestRoad = position (_nearRoads select 0); - - _group = createGroup east; - _VehicleClassToUse = SC_VehicleClassToUse call BIS_fnc_selectRandom; - _vehicleObject = [ [_nearestRoad], _group, "assault", "difficult", "bandit",_VehicleClassToUse ] call DMS_fnc_SpawnAIVehicle; - - // Get the AI to shut the fuck up :) - enableSentences false; - enableRadio false; - - diag_log format['[OCCUPATION:Vehicle] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; - _vehicleObject addMPEventHandler ["mpkilled", "SC_liveVehicles = SC_liveVehicles - 1;"]; - _vehicleObject addMPEventHandler ["mphit", "_this call SC_fnc_repairVehicle;"]; - - _driverVeh = driver _vehicleObject; - _driverVeh addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; - _driverVeh setVariable ["SC_drivenVehicle", _vehicleObject,true]; - - - _vehicleObject setSpeedMode "LIMITED"; - _vehicleObject limitSpeed 60; - _vehicleObject action ["LightOn", _vehicleObject]; - [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; - _group setCombatMode "RED"; - - SC_liveVehicles = SC_liveVehicles + 1; - sleep 0.2; -}; - - -diag_log format['[OCCUPATION:Vehicle] Running']; \ No newline at end of file diff --git a/reactions/reactUnit.sqf b/reactions/reactUnit.sqf deleted file mode 100644 index c745747..0000000 --- a/reactions/reactUnit.sqf +++ /dev/null @@ -1,15 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - -diag_log format ["[OCCUPATION]:: Unit %2 killed at %1",time,_this]; \ No newline at end of file diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..0d6c9f0 --- /dev/null +++ b/readme.txt @@ -0,0 +1,11 @@ +An AI spawner and monitor to be used in conjunction with DMS and will not work without it: http://www.exilemod.com/topic/61-dms-defents-mission-system/ + +Download the pbo version here: https://www.dropbox.com/s/dxy44l4mfu6ys53/a3_exile_occupation.pbo?dl=0 + +To install place the pbo into the @ExileServer/addons folder + +For more info: http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai + +I do not give permission for anyone to sell or charge for the installation of any part of this set of scripts. + +second_coming 2016 \ No newline at end of file diff --git a/scripts/deleteMapMarkers.sqf b/scripts/deleteMapMarkers.sqf new file mode 100644 index 0000000..153f98e --- /dev/null +++ b/scripts/deleteMapMarkers.sqf @@ -0,0 +1,16 @@ +for "_i" from 1 to SC_numberofLootCrates do +{ + _markerName = format ["loot_marker_%1", _i]; + _pos = getMarkerPos _markerName; + + if(!isNil "_pos") then + { + _nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],15])); + if(_nearPlayers > 0) then + { + deleteMarker _markerName; + diag_log format ["[OCCUPATION:LootCrates]:: marker %1 removed at %2",_markerName,time]; + }; + + }; +}; \ No newline at end of file diff --git a/occupation.sqf b/scripts/occupation.sqf similarity index 94% rename from occupation.sqf rename to scripts/occupation.sqf index 1062db8..28ab5fc 100644 --- a/occupation.sqf +++ b/scripts/occupation.sqf @@ -91,7 +91,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _spawnPosition = [_spawnPos select 0, _spawnPos select 1,0]; DMS_ai_use_launchers = false; - _group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; + _group = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup; DMS_ai_use_launchers = _useLaunchers; // Get the AI to shut the fuck up :) @@ -101,14 +101,14 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi if(!SC_useWaypoints) then { [_group, _pos, _groupRadius] call bis_fnc_taskPatrol; - _group setBehaviour "DESTROY"; + _group setBehaviour "COMBAT"; _group setCombatMode "RED"; } else { - [ _group,_pos,_difficulty,"DESTROY" ] call DMS_fnc_SetGroupBehavior; + [ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; - _buildings = _pos nearObjects ["house", _groupRadius]; + _buildings = _pos nearObjects ["building", _groupRadius]; { _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions; if(count _buildingPositions > 0) then @@ -128,16 +128,16 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _i = _buildingPositions find _spawnPosition; _wp = _group addWaypoint [_spawnPosition, 0] ; _wp setWaypointFormation "Column"; - _wp setWaypointBehaviour "DESTROY"; + _wp setWaypointBehaviour "COMBAT"; _wp setWaypointCombatMode "RED"; _wp setWaypointCompletionRadius 1; _wp waypointAttachObject _x; _wp setwaypointHousePosition _i; - _wp setWaypointType "MOVE"; + _wp setWaypointType "SAD"; }; } foreach _buildings; - if(count _buildings > 0 ) then + if(count _buildings > 0 && !isNil "_wp") then { _wp setWaypointType "CYCLE"; }; diff --git a/scripts/occupationHeliCrashes.sqf b/scripts/occupationHeliCrashes.sqf new file mode 100644 index 0000000..b87ee80 --- /dev/null +++ b/scripts/occupationHeliCrashes.sqf @@ -0,0 +1,101 @@ +if (!isServer) exitWith {}; + +_numberofCrashes = 5; // this is the number of helicrashes that you want to spawn + +if (worldName == 'Namalsk') then +{ + _numberofCrashes = 2; // lower number for a smaller map +}; + +_middle = worldSize/2; +_spawnCenter = [_middle,_middle,0]; +_max = _middle; +_min = 0; // minimum distance from the center position (Number) in meters +_mindist = 15; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters.. +_water = 0; // water mode (Number) 0: cannot be in water , 1: can either be in water or not , 2: must be in water +_shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore +_markersize = 100; // Radius of the marker in meters +_displayMarkers = SC_debug; // only use for debug, no need for actual gameplay + +private['_position']; + +diag_log format ["[OCCUPATION:HeliCrashes]:: Initialised at %1",time]; + +for "_i" from 1 to _numberofCrashes do +{ + _validspot = false; + while{!_validspot} do + { + sleep 0.2; + _position = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; + _validspot = true; + + // Check for nearby spawn points and traders + _nearestMarker = [allMapMarkers, _position] call BIS_fnc_nearestPosition; + _posNearestMarker = getMarkerPos _nearestMarker; + if(_position distance _posNearestMarker < 750) then { _validspot = false; }; + + //Check if near another heli crash site + _nearOtherCrash = (nearestObjects [_position,["Land_UWreck_MV22_F"],750]) select 0; + if (!isNil "_nearOtherCrash") then { _validspot = false; }; + + //Check if near another loot crate site + _nearOtherCrate = (nearestObjects [_position,["CargoNet_01_box_F"],500]) select 0; + if (!isNil "_nearOtherCrate") then { _validspot = false; }; + + //Check if near player base + _nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],500]) select 0; + if (!isNil "_nearBase") then { _validspot = false; }; + + }; + + diag_log format['[OCCUPATION:HeliCrashes] Crash %1 : Location %2',_i,_position]; + _helicopter = "Land_UWreck_MV22_F"; + _vehHeli = _helicopter createVehicle [0,0,0]; + _heliFire = "test_EmptyObjectForFireBig" createVehicle (position _vehHeli); + _heliFire attachto [_vehHeli, [0,0,-1]]; + _vehHeli setPos _position; + + _positionOfBox = [_position,3,10,1,0,10,0] call BIS_fnc_findSafePos; + _box = "Box_NATO_Ammo_F" createvehicle _positionOfBox; + + clearMagazineCargoGlobal _box; + clearWeaponCargoGlobal _box; + clearItemCargoGlobal _box; + _box enableRopeAttach false; + _box setVariable ["permaLoot",true]; + _box allowDamage false; + _box addMagazineCargoGlobal ["HandGrenade", (random 2)]; + _box addMagazineCargoGlobal ["APERSBoundingMine_Range_Mag", (random 2)]; + _box addBackpackCargoGlobal ["B_Parachute", 1 + (random 1)]; + _box addItemCargoGlobal ["H_CrewHelmetHeli_B", 1 + (random 1)]; + _box addItemCargoGlobal ["U_B_HeliPilotCoveralls", 1 + (random 1)]; + _box addItemCargoGlobal ["ItemGPS", (random 1)]; + _box addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; + _box addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; + _box addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; + + // Add weapons with ammo to the Box + _possibleWeapons = ["srifle_DMR_02_camo_F","srifle_DMR_03_woodland_F","srifle_DMR_04_F","srifle_DMR_05_hex_F"]; + _amountOfWeapons = 1 + (random 3); + + for "_i" from 1 to _amountOfWeapons do + { + _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; + _box addWeaponCargoGlobal [_weaponToAdd,1]; + + _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); + _box addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 5]; + }; + + if(_displayMarkers) then + { + _event_marker = createMarker [ format ["helicrash_marker_%1", _i], _position]; + _event_marker setMarkerColor "ColorRed"; + _event_marker setMarkerAlpha 1; + _event_marker setMarkerText "Heli Crash"; + _event_marker setMarkerType "loc_Tree"; + _event_marker setMarkerBrush "Vertical"; + _event_marker setMarkerSize [(3), (3)]; + }; +}; \ No newline at end of file diff --git a/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf similarity index 84% rename from occupationLootCrates.sqf rename to scripts/occupationLootCrates.sqf index fcb2a1e..7d90a55 100644 --- a/occupationLootCrates.sqf +++ b/scripts/occupationLootCrates.sqf @@ -1,17 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - if (!isServer) exitWith {}; diag_log format ["[OCCUPATION:LootCrates]:: Starting Occupation Loot Crates"]; @@ -40,6 +26,8 @@ if (worldName == 'Taviana') then _numberofcrates = 6; // this is the number of crates that you want to spawn }; +SC_numberofLootCrates = _numberofcrates; + diag_log format['[OCCUPATION:LootCrates]:: worldname: %1 Centre: %2 radius: %3',worldName,_spawnCenter,_max]; _min = 0; // minimum distance from the center position (Number) in meters @@ -73,9 +61,11 @@ for "_i" from 1 to _numberofcrates do if (!isNil "_nearBase") then { _validspot = false; }; }; + _mapMarkerName = format ["loot_marker_%1", _i]; + if (_marker) then { - _mapMarkerName = format ["loot_marker_%1", _i]; + _event_marker = createMarker [ format ["loot_marker_%1", _i], _position]; _event_marker setMarkerColor "ColorGreen"; _event_marker setMarkerAlpha 1; @@ -87,10 +77,16 @@ for "_i" from 1 to _numberofcrates do //Infantry spawn using DMS _AICount = 1 + (round (random 2)); - _ai_posx = _position select 0; - _ai_posy = _position select 1; - _ai_posz = 0; - [[_ai_posx, _ai_posy, _ai_posz], _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup; + _spawnPosition = [_position select 0, _position select 1, 0]; + _group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup; + + // Get the AI to shut the fuck up :) + enableSentences false; + enableRadio false; + + [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; diag_log text format ["[OCCUPATION:LootCrates]:: Creating crate %3 @ drop zone %1 with %2 guards",_position,_AICount,_i]; @@ -100,8 +96,8 @@ for "_i" from 1 to _numberofcrates do clearItemCargoGlobal _box; _box enableRopeAttach false; // Stop people airlifting the crate - _box setVariable ["permaLoot",true]; // stay until reset - _box allowDamage false; // Prevent boxes to explode when spawning + _box setVariable ["permaLoot",true]; // Crate stays until next server restart + _box allowDamage false; // Stop crates taking damage _box addItemCargoGlobal ["Exile_Melee_Axe", 1]; _box addItemCargoGlobal ["Exile_Item_GloriousKnakworst", 1 + (random 2)]; @@ -121,6 +117,5 @@ for "_i" from 1 to _numberofcrates do _box addItemCargoGlobal ["Exile_Item_WoodWindowKit", 1 + (random 1)]; _box addItemCargoGlobal ["Exile_Item_WoodDoorwayKit", 1 + (random 1)]; _box addItemCargoGlobal ["Exile_Item_WoodFloorPortKit", 1 + (random 2)]; - }; diff --git a/occupationMilitary.sqf b/scripts/occupationMilitary.sqf similarity index 91% rename from occupationMilitary.sqf rename to scripts/occupationMilitary.sqf index be2c508..1030b13 100644 --- a/occupationMilitary.sqf +++ b/scripts/occupationMilitary.sqf @@ -1,17 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - private["_wp","_wp2","_wp3"]; if (!isServer) exitWith {}; @@ -112,7 +98,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do DMS_ai_use_launchers = true; [_group, _pos, _groupRadius] call bis_fnc_taskPatrol; - _group setBehaviour "DESTROY"; + _group setBehaviour "SAD"; _group setCombatMode "RED"; } else @@ -139,7 +125,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do _group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; DMS_ai_use_launchers = true; - [ _group,_pos,_difficulty,"DESTROY" ] call DMS_fnc_SetGroupBehavior; + [ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; _buildings = _pos nearObjects ["house", _groupRadius]; { @@ -161,7 +147,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do _i = _buildingPositions find _spawnPosition; _wp = _group addWaypoint [_spawnPosition, 0] ; _wp setWaypointFormation "Column"; - _wp setWaypointBehaviour "DESTROY"; + _wp setWaypointBehaviour "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointCompletionRadius 1; _wp waypointAttachObject _x; diff --git a/occupationSky.sqf b/scripts/occupationSky.sqf similarity index 79% rename from occupationSky.sqf rename to scripts/occupationSky.sqf index 90f92c1..2a936e4 100644 --- a/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -1,17 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - diag_log format['[OCCUPATION:Sky] Started']; if (!isServer) exitWith {}; @@ -51,7 +37,7 @@ for "_i" from 1 to _vehiclesToSpawn do _group = createGroup east; _HeliClassToUse = SC_HeliClassToUse call BIS_fnc_selectRandom; - _vehicle1 = [ [_spawnLocation], _group, "assault", "difficult", "bandit", _HeliClassToUse ] call DMS_fnc_SpawnAIVehicle; + _vehicle1 = [ [_spawnLocation], _group, "assault", "difficult", "resistance", _HeliClassToUse ] call DMS_fnc_SpawnAIVehicle; if(SC_infiSTAR_log) then { diff --git a/occupationStatic.sqf b/scripts/occupationStatic.sqf similarity index 89% rename from occupationStatic.sqf rename to scripts/occupationStatic.sqf index 6d83006..12bcb82 100644 --- a/occupationStatic.sqf +++ b/scripts/occupationStatic.sqf @@ -1,17 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - private["_wp","_wp2","_wp3"]; if (!isServer) exitWith {}; @@ -97,7 +83,7 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do { - _buildings = _spawnPosition nearObjects ["house", _groupRadius]; + _buildings = _spawnPosition nearObjects ["building", _groupRadius]; { _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions; if(count _buildingPositions > 0) then @@ -117,7 +103,7 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do _i = _buildingPositions find _spawnPosition; _wp = _group addWaypoint [_spawnPosition, 0] ; _wp setWaypointFormation "Column"; - _wp setWaypointBehaviour "DESTROY"; + _wp setWaypointBehaviour "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointCompletionRadius 1; _wp waypointAttachObject _x; diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf new file mode 100644 index 0000000..a29c345 --- /dev/null +++ b/scripts/occupationVehicle.sqf @@ -0,0 +1,75 @@ +diag_log format['[OCCUPATION:Vehicle] Started']; + +if (!isServer) exitWith {}; + +if(SC_liveVehicles >= SC_maxNumberofVehicles) exitWith {}; + +_vehiclesToSpawn = (SC_maxNumberofVehicles - SC_liveVehicles); +_middle = worldSize/2; +_spawnCenter = [_middle,_middle,0]; +_maxDistance = _middle; + +if(_vehiclesToSpawn >= 1) then +{ + + _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCityCapital"], _maxDistance]); + _i = 0; + { + _okToUse = true; + _pos = position _x; + _nearestMarker = [allMapMarkers, _pos] call BIS_fnc_nearestPosition; // Nearest Marker to the Location + _posNearestMarker = getMarkerPos _nearestMarker; + if(_pos distance _posNearestMarker < 2500) exitwith { _okToUse = false; }; + + if(!_okToUse) then + { + _locations deleteAt _i; + }; + _i = _i + 1; + sleep 0.2; + + } forEach _locations; + + for "_j" from 1 to _vehiclesToSpawn do + { + private["_group"]; + _Location = _locations call BIS_fnc_selectRandom; + _position = position _Location; + _pos = [_position,10,100,5,0,20,0] call BIS_fnc_findSafePos; + _spawnLocation = [_pos select 0, _pos select 1, 150]; + + // Get position of nearest roads + _nearRoads = _spawnLocation nearRoads 500; + _nearestRoad = _nearRoads select 0; + _nearestRoad = position (_nearRoads select 0); + + _group = createGroup east; + _VehicleClassToUse = SC_VehicleClassToUse call BIS_fnc_selectRandom; + _vehicleObject = [ [_nearestRoad], _group, "assault", "random", "bandit",_VehicleClassToUse ] call DMS_fnc_SpawnAIVehicle; + + // Get the AI to shut the fuck up :) + enableSentences false; + enableRadio false; + + diag_log format['[OCCUPATION:Vehicle] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; + _vehicleObject addMPEventHandler ["mpkilled", "SC_liveVehicles = SC_liveVehicles - 1;"]; + _vehicleObject addMPEventHandler ["mphit", "_this call SC_fnc_repairVehicle;"]; + + _driverVeh = driver _vehicleObject; + _driverVeh addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; + _driverVeh setVariable ["SC_drivenVehicle", _vehicleObject,true]; + + + _vehicleObject setSpeedMode "LIMITED"; + _vehicleObject limitSpeed 60; + _vehicleObject action ["LightOn", _vehicleObject]; + [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; + + SC_liveVehicles = SC_liveVehicles + 1; + sleep 0.2; + }; +}; + +diag_log format['[OCCUPATION:Vehicle] Running']; \ No newline at end of file diff --git a/reactions/airHit.sqf b/scripts/reactions/airHit.sqf similarity index 86% rename from reactions/airHit.sqf rename to scripts/reactions/airHit.sqf index 4bc45f7..be4280b 100644 --- a/reactions/airHit.sqf +++ b/scripts/reactions/airHit.sqf @@ -1,17 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - _heli = _this select 0; _heliDamage = getDammage _heli; _heliPosition = getPosATL _heli; @@ -40,7 +26,7 @@ if(_heliDamage > 0 && _ejectChance > 70 && !_crewEjected) then _unit = _x select 0; if (isNull driver _veh) then { - moveOut _unit; + //moveOut _unit; _parachute = "Steerable_Parachute_F" createVehicle getPos _unit; _parachute setDir (getDir _unit); _unit moveInDriver _parachute; diff --git a/reactions/driverKilled.sqf b/scripts/reactions/driverKilled.sqf similarity index 76% rename from reactions/driverKilled.sqf rename to scripts/reactions/driverKilled.sqf index a68f3a1..626829f 100644 --- a/reactions/driverKilled.sqf +++ b/scripts/reactions/driverKilled.sqf @@ -1,17 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// - if(SC_infiSTAR_log) then { _logDetail = format ["[OCCUPATION:Vehicle]:: Unit %2 (driver) killed at %1",time,_this select 0]; @@ -39,7 +25,7 @@ if(SC_infiSTAR_log) then // add event handlers for the new driver _replacementDriver addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; _replacementDriver setVariable ["SC_drivenVehicle", _vehicleDriven,true]; -_vehicle removeAllMPEventHandlers "mphit"; +_vehicleDriven removeAllMPEventHandlers "mphit"; _vehicleDriven addMPEventHandler ["mphit", "_this call SC_fnc_repairVehicle;"]; _replacementDriver assignAsDriver _vehicleDriven; diff --git a/scripts/reactions/reactUnit.sqf b/scripts/reactions/reactUnit.sqf new file mode 100644 index 0000000..e83963c --- /dev/null +++ b/scripts/reactions/reactUnit.sqf @@ -0,0 +1 @@ +diag_log format ["[OCCUPATION]:: Unit %2 killed at %1",time,_this]; \ No newline at end of file diff --git a/reactions/repairVehicle.sqf b/scripts/reactions/repairVehicle.sqf similarity index 66% rename from reactions/repairVehicle.sqf rename to scripts/reactions/repairVehicle.sqf index 9ff46be..b4bf0ec 100644 --- a/reactions/repairVehicle.sqf +++ b/scripts/reactions/repairVehicle.sqf @@ -1,18 +1,3 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// special thanks to eichi for pointers on this script :) -//////////////////////////////////////////////////////////////////////// - - _vehicle = _this select 0; _vehicleDamage = getDammage _vehicle; @@ -29,7 +14,7 @@ if(_damagedWheels >= 1 && alive (driver _vehicle)) then { if(SC_infiSTAR_log) then { - _logDetail = format ["[OCCUPATION:repairVehicle]:: Unit %2 reaction to event at %1",time,_this select 0]; + _logDetail = format ["[OCCUPATION:repairVehicle]:: Unit %2 repairing vehicle at %1",time,_this select 0]; ['A3_EXILE_OCCUPATION',_logDetail] call FNC_A3_CUSTOMLOG; }; diff --git a/startOccupation.sqf b/scripts/startOccupation.sqf similarity index 60% rename from startOccupation.sqf rename to scripts/startOccupation.sqf index 84de2f4..e725802 100644 --- a/startOccupation.sqf +++ b/scripts/startOccupation.sqf @@ -7,31 +7,46 @@ if(SC_debug) then { SC_refreshTime = 60; }else{ SC_refreshTime = 300; }; // Add selected occupation scripts to Exile Threading System +if(SC_occupyLootCrates) then +{ + if(SC_occupyLootCratesMarkers) then + { + fnc_occupationDeleteMapMarker = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\deleteMapMarkers.sqf"; + [10, fnc_occupationDeleteMapMarker, [], true] call ExileServer_system_thread_addTask; + }; + call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationLootCrates.sqf"; +}; + +if(SC_occupyHeliCrashes) then +{ + call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationHeliCrashes.sqf"; +}; + if(SC_occupyStatic) then { uiSleep 15; // delay the start - fnc_occupationStaticMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\occupationStatic.sqf"; + fnc_occupationStaticMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationStatic.sqf"; [SC_refreshTime, fnc_occupationStaticMonitor, [], true] call ExileServer_system_thread_addTask; }; if(SC_occupySky) then { uiSleep 15; // delay the start - fnc_occupationSkyMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\occupationSky.sqf"; + fnc_occupationSkyMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationSky.sqf"; [SC_refreshTime, fnc_occupationSkyMonitor, [], true] call ExileServer_system_thread_addTask; }; if(SC_occupyVehicle) then { uiSleep 15; // delay the start - fnc_occupationVehicleMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\occupationVehicle.sqf"; + fnc_occupationVehicleMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationVehicle.sqf"; [SC_refreshTime, fnc_occupationVehicleMonitor, [], true] call ExileServer_system_thread_addTask; }; if(SC_occupyPlaces) then { uiSleep 15; // delay the start - fnc_occupationMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\occupation.sqf"; + fnc_occupationMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupation.sqf"; [SC_refreshTime, fnc_occupationMonitor, [], true] call ExileServer_system_thread_addTask; }; @@ -40,7 +55,7 @@ if(SC_occupyPlaces) then if(SC_occupyMilitary) then { uiSleep 15; // delay the start - fnc_occupationMilitaryMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\occupationMilitary.sqf"; + fnc_occupationMilitaryMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationMilitary.sqf"; [SC_refreshTime, fnc_occupationMilitaryMonitor, [], true] call ExileServer_system_thread_addTask; };