changes to vehicle spawn routines to address a few issuesl

This commit is contained in:
Ghostrider-DbD- 2016-10-24 22:02:09 -04:00
parent 2a6f6e6f3b
commit 8d8d082a17
4 changed files with 9 additions and 99 deletions

View File

@ -1,29 +0,0 @@
/*
Spawn a vehicle and protect it against cleanup by Epoch
Returns the object (vehicle) created.
By Ghostrider-DBD-
Last modified 9-10-16
*/
private["_veh"];
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];
_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;
};
_veh setVehicleLock "LOCKEDPLAYER";
[_veh] spawn blck_fnc_vehicleMonitor;
//[_vehToSpawn, blck_ModType] call blck_fnc_protectVehicle;
_veh

View File

@ -2,7 +2,7 @@
Spawn a vehicle and protect it against cleanup by Epoch Spawn a vehicle and protect it against cleanup by Epoch
Returns the object (vehicle) created. Returns the object (vehicle) created.
By Ghostrider-DBD- By Ghostrider-DBD-
Last modified 9-10-16 Last modified 10-24-16
*/ */
private["_veh"]; private["_veh"];
@ -30,7 +30,10 @@ _veh setVehicleLock "LOCKEDPLAYER";
_veh addEventHandler ["GetIn",{ // forces player to be ejected if he/she tries to enter the vehicle _veh addEventHandler ["GetIn",{ // forces player to be ejected if he/she tries to enter the vehicle
private ["_theUnit"]; private ["_theUnit"];
_theUnit = _this select 2; _theUnit = _this select 2;
if (isPlayer _theUnit) then
{
_theUnit action ["Eject", vehicle _theUnit]; _theUnit action ["Eject", vehicle _theUnit];
};
}]; }];
_veh _veh

View File

@ -1,65 +0,0 @@
//////////////////////////////////////
// spawn a vehicle, fill it with AI, and give it waypoints around the perimeter of the mission area
// Returns an array _units that contains a list of the units that were spawned and placed in the vehicle
/*
By Ghostrider-DBD-
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","_spawnedVehicle"];
params["_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_groupForVehiclePatrol",grpNull] ];
//_pos = _this select 0; // Center of the mission area
//_vehType = [_this,1,"I_G_Offroad_01_armed_F"] call BIS_fnc_param;
//_minDis = [_this,2,30] call BIS_fnc_param; // minimum distance from the center of the mission for vehicle waypoints
//_maxDis = [_this,3,45] call BIS_fnc_param; // maximum distance from the center of the mission for vehicle waypoints
//_groupForVehiclePatrol = [_this,4,grpNull] call BIS_fnc_param; // 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 _groupForVehiclePatrol) exitWith {};
_safepos = [_pos,0,25,0,0,20,0] call BIS_fnc_findSafePos;
_spawnedVehicle = [_vehType,_safepos] call blck_fnc_spawnVehicle;
//diag_log format["spawnVehiclePatrols:: vehicle spawned is %1 of typeof %2",_spawnedVehicle, typeOf _spawnedVehicle];
_spawnedVehicle addEventHandler ["GetIn",{ // forces player to be ejected if he/she tries to enter the vehicle
private ["_theUnit"];
_theUnit = _this select 2;
_theUnit action ["Eject", vehicle _theUnit];
}];
clearWeaponCargoGlobal _spawnedVehicle;
clearMagazineCargoGlobal _spawnedVehicle;
clearBackpackCargoGlobal _spawnedVehicle;
clearItemCargoGlobal _spawnedVehicle;
private["_unitNumber"];
_unitNumber = 0;
{
switch (_unitNumber) do
{
case 0: {_x moveingunner _spawnedVehicle;};
case 1: {_x moveindriver _spawnedVehicle;};
default {_x moveInCargo _spawnedVehicle;};
};
_unitNumber = _unitNumber + 1;
}forEach (units _groupForVehiclePatrol);
//diag_log format["spawnVehiclePatrols:: vehicle spawned was %1",_spawnedVehicle];
_spawnedVehicle

View File

@ -5,7 +5,7 @@
By Ghostrider-DBD- By Ghostrider-DBD-
Copyright 2016 Copyright 2016
Last updated 8-14-16 Last updated 10-24-16
*/ */
private ["_unit","_units","_count","_group","_driver","_gunner","_cargo"]; private ["_unit","_units","_count","_group","_driver","_gunner","_cargo"];
@ -15,7 +15,8 @@ _count = 0;
waitUntil { count crew _veh > 0}; waitUntil { count crew _veh > 0};
//diag_log format["vehicle Manned %1",_veh]; //diag_log format["vehicle Manned %1",_veh];
while { (getDammage _veh < 1.0) && ({alive _x} count crew _veh > 0)} do uiSleep 60;
while { (getDammage _veh > 0) && ({alive _x} count crew _veh > 0)} do
{ //diag_log format["vehicleMonitor: vehicle crew consists of %1", crew _veh]; { //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]; //diag_log format["vehicleMonitor: number of crew alive is %1", {alive _x} count crew _veh];
_veh setVehicleAmmo 1; _veh setVehicleAmmo 1;
@ -53,7 +54,7 @@ if (typeOf _veh in blck_staticWeapons) then // always destroy mounted weapons
{ {
private ["_v","_startTime"]; private ["_v","_startTime"];
//diag_log format["vehicleMonitor.sqf: _veh %1 is about to be killed",_veh]; //diag_log format["vehicleMonitor.sqf: _veh %1 is about to be killed",_veh];
uiSleep 10; uiSleep 60;
_veh setDamage 1; _veh setDamage 1;
_startTime = diag_ticktime; _startTime = diag_ticktime;
waitUntil{sleep 5;(diag_tickTime - _startTime) > 120;}; // delete destroyed vehicles after 2 min waitUntil{sleep 5;(diag_tickTime - _startTime) > 120;}; // delete destroyed vehicles after 2 min