more updates to how mission vehicles are spawned, monitored and cleaned up.
This commit is contained in:
parent
8d8d082a17
commit
210c837618
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
@ -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;
|
||||
|
@ -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","HitRFWheel","HitEngine","HitLBWheel","HitRBWheel","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;
|
||||
};
|
@ -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.
|
||||
|
@ -6,7 +6,7 @@
|
||||
Last modified 10/17/16
|
||||
*/
|
||||
//blck_variablesLoaded = false;
|
||||
blck_debugON = false;
|
||||
blck_debugON = true;
|
||||
blck_debugLevel = 3;
|
||||
blck_minFPS = 13;
|
||||
|
||||
@ -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 = [];
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user