mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-24 00:50:50 +03:00
0.65
This commit is contained in:
@@ -182,19 +182,17 @@ RoadList = MarkerPosition nearRoads DynamicVehicleArea;
|
|||||||
BuildingList = MarkerPosition nearObjects ["House",DynamicVehicleArea];
|
BuildingList = MarkerPosition nearObjects ["House",DynamicVehicleArea];
|
||||||
|
|
||||||
spawn_vehicles = {
|
spawn_vehicles = {
|
||||||
private["_vehicle","_isAir","_isShip","_position","_roadlist","_buildinglist","_istoomany","_marker","_veh","_objPosition","_weights","_index","_uid","_velimit","_counter"];
|
private["_weights","_isOverLimit","_isAbort","_counter","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition"];
|
||||||
|
|
||||||
if (isDedicated) then {
|
if (isDedicated) then {
|
||||||
|
|
||||||
_counter = _this select 0;
|
|
||||||
|
|
||||||
waituntil {!isnil "fnc_buildWeightedArray"};
|
waituntil {!isnil "fnc_buildWeightedArray"};
|
||||||
|
|
||||||
_weights = [];
|
_weights = [];
|
||||||
_weights = [AllowedVehiclesList,AllowedVehiclesChance] call fnc_buildWeightedArray;
|
_weights = [AllowedVehiclesList,AllowedVehiclesChance] call fnc_buildWeightedArray;
|
||||||
|
|
||||||
_isOverLimit = true;
|
_isOverLimit = true;
|
||||||
|
_isAbort = false;
|
||||||
|
_counter = 0;
|
||||||
while {_isOverLimit} do {
|
while {_isOverLimit} do {
|
||||||
|
|
||||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||||
@@ -203,7 +201,7 @@ spawn_vehicles = {
|
|||||||
_vehicle = AllowedVehiclesList select _index;
|
_vehicle = AllowedVehiclesList select _index;
|
||||||
_velimit = AllowedVehiclesLimit select _index;
|
_velimit = AllowedVehiclesLimit select _index;
|
||||||
|
|
||||||
_qty = {_x == _vehicle} count _counter;
|
_qty = {_x == _vehicle} count serverVehicleCounter;
|
||||||
|
|
||||||
// If under limit allow to proceed
|
// If under limit allow to proceed
|
||||||
if(_qty < _velimit) then {
|
if(_qty < _velimit) then {
|
||||||
@@ -211,81 +209,92 @@ spawn_vehicles = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TODO add counter to stop after X attempts
|
// TODO add counter to stop after X attempts
|
||||||
|
_counter = _counter + 1;
|
||||||
|
|
||||||
|
if(_counter > 5) then {
|
||||||
|
_isOverLimit = false;
|
||||||
|
_isAbort = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Find Vehicle Type to better control spawns
|
if (_isAbort) then {
|
||||||
_isAir = _vehicle isKindOf "Air";
|
diag_log("DEBUG: unable to find sutable vehicle");
|
||||||
_isShip = _vehicle isKindOf "Ship";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(_isShip || _isAir) then {
|
|
||||||
if(_isShip) then {
|
|
||||||
// Spawn anywhere on coast on water
|
|
||||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
|
||||||
_position = [MarkerPosition,0,DynamicVehicleArea,10,1,2000,1] call BIS_fnc_findSafePos;
|
|
||||||
//diag_log("DEBUG: spawning boat near coast " + str(_position));
|
|
||||||
} else {
|
|
||||||
// Spawn air anywhere that is flat
|
|
||||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
|
||||||
_position = [MarkerPosition,0,DynamicVehicleArea,25,0,1,0] call BIS_fnc_findSafePos;
|
|
||||||
//diag_log("DEBUG: spawning air anywhere flat " + str(_position));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Spawn around buildings and 50% near roads
|
|
||||||
if((random 1) > 0.5) then {
|
|
||||||
|
|
||||||
|
// add vehicle to counter for next pass
|
||||||
|
serverVehicleCounter set [count serverVehicleCounter,_vehicle];
|
||||||
|
|
||||||
|
// Find Vehicle Type to better control spawns
|
||||||
|
_isAir = _vehicle isKindOf "Air";
|
||||||
|
_isShip = _vehicle isKindOf "Ship";
|
||||||
|
|
||||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
if(_isShip || _isAir) then {
|
||||||
_position = RoadList call BIS_fnc_selectRandom;
|
if(_isShip) then {
|
||||||
|
// Spawn anywhere on coast on water
|
||||||
|
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||||
|
_position = [MarkerPosition,0,DynamicVehicleArea,10,1,2000,1] call BIS_fnc_findSafePos;
|
||||||
|
//diag_log("DEBUG: spawning boat near coast " + str(_position));
|
||||||
|
} else {
|
||||||
|
// Spawn air anywhere that is flat
|
||||||
|
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||||
|
_position = [MarkerPosition,0,DynamicVehicleArea,25,0,1,0] call BIS_fnc_findSafePos;
|
||||||
|
//diag_log("DEBUG: spawning air anywhere flat " + str(_position));
|
||||||
|
};
|
||||||
|
|
||||||
_position = _position modelToWorld [0,0,0];
|
|
||||||
|
|
||||||
waitUntil{!isNil "BIS_fnc_findSafePos"};
|
|
||||||
_position = [_position,0,10,10,0,2000,0] call BIS_fnc_findSafePos;
|
|
||||||
|
|
||||||
//diag_log("DEBUG: spawning near road " + str(_position));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Spawn around buildings and 50% near roads
|
||||||
|
if((random 1) > 0.5) then {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||||
_position = BuildingList call BIS_fnc_selectRandom;
|
_position = RoadList call BIS_fnc_selectRandom;
|
||||||
|
|
||||||
_position = _position modelToWorld [0,0,0];
|
_position = _position modelToWorld [0,0,0];
|
||||||
|
|
||||||
waitUntil{!isNil "BIS_fnc_findSafePos"};
|
waitUntil{!isNil "BIS_fnc_findSafePos"};
|
||||||
_position = [_position,0,40,5,0,2000,0] call BIS_fnc_findSafePos;
|
_position = [_position,0,10,10,0,2000,0] call BIS_fnc_findSafePos;
|
||||||
|
|
||||||
//diag_log("DEBUG: spawning around buildings " + str(_position));
|
//diag_log("DEBUG: spawning near road " + str(_position));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||||
|
_position = BuildingList call BIS_fnc_selectRandom;
|
||||||
|
|
||||||
|
_position = _position modelToWorld [0,0,0];
|
||||||
|
|
||||||
|
waitUntil{!isNil "BIS_fnc_findSafePos"};
|
||||||
|
_position = [_position,0,40,5,0,2000,0] call BIS_fnc_findSafePos;
|
||||||
|
|
||||||
|
//diag_log("DEBUG: spawning around buildings " + str(_position));
|
||||||
|
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
// only proceed if two params otherwise BIS_fnc_findSafePos failed and may spawn in air
|
||||||
// only proceed if two params otherwise BIS_fnc_findSafePos failed and may spawn in air
|
if ((count _position) == 2) then {
|
||||||
if ((count _position) == 2) then {
|
|
||||||
|
|
||||||
_dir = round(random 180);
|
_dir = round(random 180);
|
||||||
|
|
||||||
_istoomany = _position nearObjects ["AllVehicles",50];
|
_istoomany = _position nearObjects ["AllVehicles",50];
|
||||||
if((count _istoomany) > 0) exitWith { diag_log("DEBUG: Too many vehicles at " + str(_position)); };
|
if((count _istoomany) > 0) exitWith { diag_log("DEBUG: Too many vehicles at " + str(_position)); };
|
||||||
|
|
||||||
//place vehicle
|
//place vehicle
|
||||||
_veh = createVehicle [_vehicle, _position, [], 0, "CAN_COLLIDE"];
|
_veh = createVehicle [_vehicle, _position, [], 0, "CAN_COLLIDE"];
|
||||||
_veh setdir _dir;
|
_veh setdir _dir;
|
||||||
_veh setpos _position;
|
_veh setpos _position;
|
||||||
|
|
||||||
// Get position with ground
|
// Get position with ground
|
||||||
_objPosition = getPosATL _veh;
|
_objPosition = getPosATL _veh;
|
||||||
|
|
||||||
clearWeaponCargoGlobal _veh;
|
clearWeaponCargoGlobal _veh;
|
||||||
clearMagazineCargoGlobal _veh;
|
clearMagazineCargoGlobal _veh;
|
||||||
|
|
||||||
[_veh,[_dir,_objPosition],_vehicle,true,"0"] call server_publishVeh;
|
[_veh,[_dir,_objPosition],_vehicle,true,"0"] call server_publishVeh;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
|
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
|
||||||
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
|
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
|
||||||
|
|
||||||
_serverVehicleCounter = [];
|
serverVehicleCounter = [];
|
||||||
|
|
||||||
if ((count playableUnits == 0) and !isDedicated) then {
|
if ((count playableUnits == 0) and !isDedicated) then {
|
||||||
isSinglePlayer = true;
|
isSinglePlayer = true;
|
||||||
@@ -169,7 +169,7 @@ diag_log "HIVE: Starting";
|
|||||||
_totalvehicles = _totalvehicles + 1;
|
_totalvehicles = _totalvehicles + 1;
|
||||||
|
|
||||||
// total each vehicle
|
// total each vehicle
|
||||||
_serverVehicleCounter set [count _serverVehicleCounter,_type];
|
serverVehicleCounter set [count _serverVehicleCounter,_type];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -226,13 +226,14 @@ _vehLimit = MaxVehicleLimit - _totalvehicles;
|
|||||||
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
|
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
|
||||||
if(_vehLimit > 0) then {
|
if(_vehLimit > 0) then {
|
||||||
for "_x" from 1 to _vehLimit do {
|
for "_x" from 1 to _vehLimit do {
|
||||||
_id = [_serverVehicleCounter] spawn spawn_vehicles; // Needs setup
|
_id = [] spawn spawn_vehicles; // Needs setup
|
||||||
waitUntil{scriptDone _id};
|
waitUntil{scriptDone _id};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// spawn_roadblocks
|
// spawn_roadblocks
|
||||||
|
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
|
||||||
for "_x" from 1 to MaxDynamicDebris do {
|
for "_x" from 1 to MaxDynamicDebris do {
|
||||||
_id = [] spawn spawn_roadblocks;
|
_id = [] spawn spawn_roadblocks;
|
||||||
//waitUntil{scriptDone _id};
|
//waitUntil{scriptDone _id};
|
||||||
|
|||||||
Reference in New Issue
Block a user