diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf new file mode 100644 index 0000000..9bd6f9d --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf @@ -0,0 +1,23 @@ +// Configures a mission vehicle +// by Ghostrider-DBD- +// Last Updated 10/25/16 + +params["_veh"]; + +clearWeaponCargoGlobal _veh; +clearMagazineCargoGlobal _veh; +clearBackpackCargoGlobal _veh; +clearItemCargoGlobal _veh; +_veh setVehicleLock "LOCKEDPLAYER"; +_veh addEventHandler ["GetIn",{ + private["_unit","_veh"]; + _unit = _this select 2; + _veh = _this select 0; + if (isPlayer _unit) then + { + _unit action ["eject",_veh]; + cutText ["You are not allowed to enter that vehicle at this time","PLAIN DOWN"]; + }; +}]; + +_veh diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf index 619f4ef..241010c 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf @@ -1,6 +1,6 @@ -// Spawns a vehicle or emplaced weapons, man's it, and destroys it when the AI gets out. +// Spawns an emplaced weapons, man's it, and saves it to an array of monitored vehicles. // by Ghostrider-DBD- -// Last Updated 9-10-16 +// Last Updated 10-25-16 private["_emplaced","_safepos","_emp","_gunner"]; params["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35] ]; @@ -9,28 +9,13 @@ if (isNull _emplacedGroup) exitWith {}; _safepos = [_pos,_minDist,_maxDist,0,0,20,0] call BIS_fnc_findSafePos; _emplaced = selectRandom _emplacedTypes; -_emp = createVehicle[_emplaced, _safepos, [], 0, "NONE"]; - -private["_modType"]; -_modType = call blck_getModType; -if (_modType isEqualTo "Epoch") then -{ - //_emp call EPOCH_server_vehicleInit; - _emp call EPOCH_server_setVToken; -}; - -clearWeaponCargoGlobal _emp; -clearMagazineCargoGlobal _emp; -clearBackpackCargoGlobal _emp; -clearItemCargoGlobal _emp; - -_emp addEventHandler ["GetOut",{(_this select 0) setDamage 1;}]; -_emp addEventHandler ["GetIn",{(_this select 0) setDamage 1;}]; +_emp = [_emplaced,_safepos] call blck_fnc_spawnVehicle; +_emp setVariable["DBD_vehType","emplaced"]; _gunner = (units _emplacedGroup) select 0; _gunner moveingunner _emp; -_emp setVehicleLock "LOCKEDPLAYER"; -[_emp] spawn blck_fnc_vehicleMonitor; - -//diag_log format["spawnEmplaced.sqf: Emplaced weapon %1 spawned"]; +[_emp] call blck_fnc_configureMissionVehicle; +waitUntil { count crew _emp > 0}; +blck_missionVehicles pushback _emp; +diag_log format["spawnEmplaced.sqf: Emplaced weapon %1 spawned"]; _emp diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf index 9c73567..c04f038 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf @@ -5,36 +5,20 @@ Last modified 10-24-16 */ -private["_veh"]; +private["_veh","_modType"]; params["_vehType","_pos"]; //_vehType = _this select 0; // type of vehicle to be spawned //_pos = _this select 1; // position at which vehicle is to be spawned -//diag_log format["spawnVehicle.sqf: _this = %1",_this]; +diag_log format["spawnVehicle.sqf: _this = %1",_this]; _veh = createVehicle[_vehType, _pos, [], 0, "NONE"]; -uisleep 0.1; - -private["_modType"]; _modType = call blck_getModType; if (_modType isEqualTo "Epoch") then { //_veh call EPOCH_server_vehicleInit; _veh call EPOCH_server_setVToken; }; -clearWeaponCargoGlobal _veh; -clearMagazineCargoGlobal _veh; -clearBackpackCargoGlobal _veh; -clearItemCargoGlobal _veh; -_veh setVehicleLock "LOCKEDPLAYER"; -[_veh] spawn blck_fnc_vehicleMonitor; -_veh addEventHandler ["GetIn",{ // forces player to be ejected if he/she tries to enter the vehicle - private ["_theUnit"]; - _theUnit = _this select 2; - if (isPlayer _theUnit) then - { - _theUnit action ["Eject", vehicle _theUnit]; - }; -}]; +[_veh] call blck_fnc_configureMissionVehicle; _veh diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf index d3f5267..8f7156c 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf @@ -7,20 +7,7 @@ Copyright 2016 Last updated 8-14-16 */ -/* -fn_setWaypoints = -{ - private["_group","_center"]; - _group = _this select 0; // The group to which waypoints should be assigned - _center = _this select 1; // center of the mission area - - while {(count (waypoints _group)) > 0} do - { - deleteWaypoint ((waypoints _group) select 0); - }; - [_center,50,100,_group] call blck_fnc_setupWaypoints; -}; -*/ + private["_vehType","_safepos","_veh"]; params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull] ]; //_pos Center of the mission area @@ -29,9 +16,6 @@ params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_ //_maxDis = maximum distance from the center of the mission for vehicle waypoints //_groupForVehiclePatrol = The group with which to man the vehicle -//diag_log format["spawnVehiclePatrol:: _pos %1 _vehTypes %2",_pos,_vehType]; -//diag_log format["spawnVehiclePatrol:: _minDis %1 _maxDis %2 _groupForVehiclePatrol %3",_minDis,_maxDis,_groupForVehiclePatrol]; - if (isNull _group) exitWith {}; _safepos = [_pos,0,25,0,0,20,0] call BIS_fnc_findSafePos; @@ -74,5 +58,7 @@ for "_i" from 1 to _count do }; _wp = _group addWaypoint [_pos, 25]; _wp setWaypointType "CYCLE"; +waitUntil { count crew _veh > 0}; +blck_missionVehicles pushback _veh; _veh \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index 95ecf1b..9f0bcc1 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -16,7 +16,7 @@ _count = 0; waitUntil { count crew _veh > 0}; //diag_log format["vehicle Manned %1",_veh]; uiSleep 60; -while { (getDammage _veh > 0) && ({alive _x} count crew _veh > 0)} do +while { (getDammage _veh < 1) && ({alive _x} count crew _veh > 0)} do { //diag_log format["vehicleMonitor: vehicle crew consists of %1", crew _veh]; //diag_log format["vehicleMonitor: number of crew alive is %1", {alive _x} count crew _veh]; _veh setVehicleAmmo 1; @@ -44,7 +44,7 @@ while { (getDammage _veh > 0) && ({alive _x} count crew _veh > 0)} do //diag_log format["vehiclemonitor.sqf all crew for vehicle %1 are dead",_veh]; -if (typeOf _veh in blck_staticWeapons) then // always destroy mounted weapons +if (_veh getVariable["DBD_vehType","null"] isEqualTo "emplaced") then // always destroy mounted weapons { //diag_log format["vehicleMonitor.sqf: _veh %1 is (in blck_staticWeapons) = true",_veh]; _veh setDamage 1; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitorLoop.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitorLoop.sqf new file mode 100644 index 0000000..29cbc2f --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitorLoop.sqf @@ -0,0 +1,68 @@ +/* + Handle the case that all AI assigned to a vehicle are dead. + Allows players to enter and use the vehicle when appropriate + or otherwise destroys the vehicle. + + By Ghostrider-DBD- + Copyright 2016 + Last updated 8-14-16 +*/ + +diag_log "----<< [blckeagls] VEHICLE MONITOR STARTED >>"; +while {true} do +{ + private _vehList = blck_missionVehicles; + uiSleep 3; + { + private ["_veh"]; + _veh = _x; + + if ({alive _x} count crew _veh < 1) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") then + { + [_veh] spawn {uiSleep 1;(_this select 0) setDamage 1;}; + blck_missionVehicles = blck_missionVehicles - [_veh]; + if (blck_debugOn) then{ + diag_log format["_fnc_vehicleMonitor:: deleting emplaced weapon %1",_veh]; + }; + }else { + if (blck_killEmptyAIVehicles) then + { + blck_missionVehicles = blck_missionVehicles - [_veh]; + [_veh] spawn { + params["_v"]; + //diag_log format["vehicleMonitor.sqf:: case of patrol vehicle: _veh %1 is about to be killed with getAllHitPointsDamage = %2",_v, (getAllHitPointsDamage _v)]; + uiSleep 20; + { + _v setHitPointDamage [_x, 1]; + //diag_log format["vehicleMonitor: hitpart %1 for vehicle %1 set to 1",_x,_v]; + } forEach ["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel","HitEngine","HitLBWheel","HitLMWheel","HitRBWheel","HitRMWheel","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun"]; + if (blck_debugOn) then + { + diag_log format["_fnc_vehicleMonitor:: damage applied to a patrol vehicle -- >> current damage for vehicle %1 is = %2",_v, (getAllHitPointsDamage _v)]; + }; + uiSleep 60; + if (blck_debugOn) then { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle:deleting vehicle _veh",_v]; + }; + deleteVehicle _v; + }; + } else { + //diag_log format["vehicleMonitor.sqf: make vehicle available to players; stripping eventHandlers from_veh %1",_veh]; + blck_missionVehicles = blck_missionVehicles - [_veh]; + _veh removealleventhandlers "GetIn"; + _veh removealleventhandlers "GetOut"; + _veh setVehicleLock "UNLOCKED" ; + if (blck_debugOn) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + }; + }; + } else { + _veh setVehicleAmmo 1; + _veh setFuel 1; + }; + }forEach _vehList; +}; diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index 364fd62..d1e29f6 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -46,13 +46,14 @@ blck_fnc_setupWaypoints = compileFinal preprocessFileLineNumbers "\q\addons\cus blck_fnc_spawnEmplacedWeapon = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnEmplaced.sqf"; // Self-evident blck_fnc_spawnVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehicle.sqf"; // Spawn a temporary vehicle of a specified type at a specific position blck_fnc_spawnVehiclePatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehiclePatrol.sqf"; // Spawn an AI vehicle control and have it patrol the mission perimeter -blck_fnc_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitor.sqf"; // Process events wherein all AI in a vehicle are killed +//blck_fnc_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitor.sqf"; // Process events wherein all AI in a vehicle are killed //blck_fnc_spawnMissionVehicles = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnMissionVehicles.sqf"; // Spawn non-AI vehicles at missions; these will be filled with loot following the parameters in the composition array for the mission blck_fnc_Reinforcements = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_reinforcements.sqf"; blck_spawnHeliParaTroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_heliSpawnParatroops.sqf"; blck_spawnHeliParaCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_heliSpawnCrate.sqf"; blck_spawnHeliPatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_heliSpawnPatrol.sqf"; blck_fnc_protectVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_protectVehicle.sqf"; +blck_fnc_configureMissionVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_configureMissionVehicle.sqf"; // functions to support Units blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear. diff --git a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf index 71d1bab..13017c6 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf @@ -3,7 +3,7 @@ For the Mission System originally coded by blckeagls By Ghostrider Functions and global variables used by the mission system. - Last modified 10/17/16 + Last modified 10/25/16 */ //blck_variablesLoaded = false; blck_debugON = false; @@ -26,6 +26,7 @@ blck_oldMissionObjects = []; blck_pendingMissions = []; blck_activeMissions = []; blck_deadAI = []; +blck_missionVehicles = []; // Arrays for use during cleanup of alive AI at some time after the end of a mission DBD_HeliCrashSites = []; diff --git a/@epochhive/addons/custom_server/Missions/GMS_missionLists.sqf b/@epochhive/addons/custom_server/Missions/GMS_missionLists.sqf index 53ff2bd..635a640 100644 --- a/@epochhive/addons/custom_server/Missions/GMS_missionLists.sqf +++ b/@epochhive/addons/custom_server/Missions/GMS_missionLists.sqf @@ -1,11 +1,4 @@ -private["_pathBlue","_missionListBlue"]; - -_pathScouts = "Scouts"; -_missionListScouts = ["Scouts"]; - -_pathHunters = "Hunters"; -_missionListHunters = ["Hunters"]; _pathBlue = "Blue"; _missionListBlue = ["default"/*,"default2","medicalCamp","redCamp","resupplyCamp"*/]; @@ -19,4 +12,3 @@ _missionListGreen = [/*"default","default2",*/"medicalCamp"/*,"redCamp","resuppl _pathOrange = "Orange"; _missionListOrange = [/*"default","default2","medicalCamp","redCamp",*/"resupplyCamp"]; -_pathHeliCrashes = "HeliCrashes"; diff --git a/@epochhive/addons/custom_server/changeLog.sqf b/@epochhive/addons/custom_server/changeLog.sqf index 5946e1f..ea465ca 100644 --- a/@epochhive/addons/custom_server/changeLog.sqf +++ b/@epochhive/addons/custom_server/changeLog.sqf @@ -4,6 +4,16 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, 'fired' event handler Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. +Version 6.4 10/25/16 +Reworked all code for spawning, monitoring and cleaning up vehicle patrols and static weapons. +This consolidated a bunch of code used to spawn these items and eliminated quite a few spawned loops used to monitor the condition of vehicles. +Switched from a system that simply destroyed a vehicle when all AI in it were dead to one that destroys wheels, motor and guns rendering the vehicle inoperable. +Redid the code that blocks players from getting in unless that is allowed by blck_killEmptyAIVehicles = false + +Version 6.3-16 +system for cleanup of mission objects, live AI and dead AI was re-worked to minimize the number of spawned code running at one time and reduced the number of loops checked. + + 10/22/16 Version 6.2 Build 8-14-16 bug fixes diff --git a/@epochhive/addons/custom_server/init/blck_init.sqf b/@epochhive/addons/custom_server/init/blck_init.sqf index 1020651..6d545bd 100644 --- a/@epochhive/addons/custom_server/init/blck_init.sqf +++ b/@epochhive/addons/custom_server/init/blck_init.sqf @@ -8,8 +8,8 @@ Credits to Vampire, Narines, KiloSwiss, blckeagls, theFUCHS, lazylink, Mark311 w Thanks to cyncrwler for testing and bug fixes. */ private ["_version","_versionDate"]; -_blck_version = "6.3 Build 9"; -_blck_versionDate = "10-23-16 1:00 AM"; +_blck_version = "6.4 Build 9"; +_blck_versionDate = "10-25-16 7:00 PM"; private["_blck_loadingStartTime"]; _blck_loadingStartTime = diag_tickTime; @@ -84,7 +84,7 @@ if (blck_enableBlueMissions == 1) then { [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) }; - +[] execVM "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitorLoop.sqf"; diag_log "[blckeagls] >>--- Completed initialization"; blck_Initialized = true; diff --git a/MPMissions/Exile.Altis/debug/blckClient.sqf b/MPMissions/Exile.Altis/debug/blckClient.sqf index ae21b8a..748fc45 100644 --- a/MPMissions/Exile.Altis/debug/blckClient.sqf +++ b/MPMissions/Exile.Altis/debug/blckClient.sqf @@ -10,7 +10,7 @@ if (hasInterface) then blck_MarkerPeristTime = 300; blck_useHint = true; blck_useSystemChat = true; - blck_useTitleText = false; + blck_useTitleText = true; blck_useDynamic = false; blck_aiKilluseSystemChat = true; blck_aiKilluseDynamic = false; @@ -43,7 +43,6 @@ if (hasInterface) then params["_event","_message","_mission"]; if (blck_useSystemChat) then {systemChat format["%1",_message];}; - if (blck_useTitleText) then {titleText [_message, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5]}; if (blck_useHint) then { hint parseText format[ "%1
@@ -56,6 +55,12 @@ if (hasInterface) then if (blck_useDynamic) then { [_mission,_message] call fn_dynamicNotification; }; + if (blck_useTitleText) then { + [_message] spawn { + params["_msg"]; + titleText [_msg, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5] + }; + }; //diag_log format["_fn_missionNotification ====] Paremeters _event %1 _message %2 _mission %3",_event,_message,_mission]; }; diff --git a/MPMissions/epoch.Altis/debug/blckClient.sqf b/MPMissions/epoch.Altis/debug/blckClient.sqf index ae21b8a..748fc45 100644 --- a/MPMissions/epoch.Altis/debug/blckClient.sqf +++ b/MPMissions/epoch.Altis/debug/blckClient.sqf @@ -10,7 +10,7 @@ if (hasInterface) then blck_MarkerPeristTime = 300; blck_useHint = true; blck_useSystemChat = true; - blck_useTitleText = false; + blck_useTitleText = true; blck_useDynamic = false; blck_aiKilluseSystemChat = true; blck_aiKilluseDynamic = false; @@ -43,7 +43,6 @@ if (hasInterface) then params["_event","_message","_mission"]; if (blck_useSystemChat) then {systemChat format["%1",_message];}; - if (blck_useTitleText) then {titleText [_message, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5]}; if (blck_useHint) then { hint parseText format[ "%1
@@ -56,6 +55,12 @@ if (hasInterface) then if (blck_useDynamic) then { [_mission,_message] call fn_dynamicNotification; }; + if (blck_useTitleText) then { + [_message] spawn { + params["_msg"]; + titleText [_msg, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5] + }; + }; //diag_log format["_fn_missionNotification ====] Paremeters _event %1 _message %2 _mission %3",_event,_message,_mission]; }; diff --git a/changeLog.sqf b/changeLog.sqf index 5946e1f..6f0e81b 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -4,8 +4,13 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, 'fired' event handler Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. -10/22/16 Version 6.2 Build 8-14-16 -bug fixes +10/25/16 Version 6.4 Build 8 +Reworked the code to spawn vehicle patrols and static weapons and clean them up. +Reworked the code that messages players to be sure that calling titleText does not hang the messaging function and delay hints or system chat notifications. + +10/22/16 v 6.3 Build 8-14-16 +Moved routines that delete dead AI, Alive AI and mission objects from individual loops to a single loop spawned by blck_init.sqf. +Added functions to cache these data with time stamps for later time-based deletion. 10/21/16 Version 6.2 Build 7 Redid system for markers which are now defined in the mission template reducing dependence on client side configurations for each mission or marker type.