Jump to content

Donnovan

Member
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Donnovan

  1. This is my personal Loot System i share with you now.

    Hope you enjoy.

    You must allow this public variable in your BE filters: mtdr_lootActiveAdd.

    Installation: Run it at the end of your init.sqf with: execVM "script_path/script_name.sqf";

    Buildings in _mtdr_loot_buildings_class are from DayZ Mod.

    I have a tool to help you to fill the _mtdr_loot_buildings_spawnPos array. To share with you later if needed.

    private ["_mtdr_loot_buildings_class","_mtdr_loot_buildings_spawnPos","_mtdr_loot_items","_renewTime","_spawnAgain"];
    //MTDR LOOT SYSTEM
    _map_size = 15360;
    _map_center = [_map_size/2,_map_size/2,0];
    _map_rad = (_map_size * sqrt(2))/2;
    
    //Time after a spawned loot will try to be removed and
    //triggered to spawn again accordingly to _spawnAgain
    _renewTime = 1800;
    _spawnAgain = true;
    
    //Buildings that i want to have Loot Piles
    _mtdr_loot_buildings_class = [
    	"Land_A_Hospital",
    	"Land_Mil_Barracks_i",
    	"Land_a_stationhouse",
    	"Land_A_GeneralStore_01",
    	"Land_A_GeneralStore_01a",
    	"Land_A_Pub_01",
    	"Land_HouseV_1I4",
    	"Land_Church_03",
    	"Land_Church_01",
    	"Land_HouseV2_02_Interier"
    ];
    
    //Loot Pile Positions of Buildings in _mtdr_loot_buildings_class
    //[[Pile Pos in building Coords,Loot lie on ground?],[Another pos,Another f/t],...]
    _mtdr_loot_buildings_spawnPos = [
    	[[[-07.00,-04.00,-07.33],false]],
    	[[[ 05.00, 02.00,-01.10],false]],
    	[[[-01.20,-07.90,-09.47],false]],
    	[[[-01.14, 01.37,-01.20],false]],
    	[[[ 00.50, 05.00,-01.20],false]],
    	[[[ 06.16, 05.46,-01.43],false]],
    	[[[ 00.00, 03.70,-02.72],false]],
    	[[[ 04.70,-00.10,-14.29],false],[[-17.50, 00.00,-14.29],true]],
    	[[[-06.90, 00.29,-04.21],false]],
    	[[[-00.14,-02.45,-05.53],false]]
    ];
    
    //Items To place on the buildings. Array:
    //Items,
    //quantity*,
    //buildings in _mtdr_loot_buildings_class,
    //building preference. The higher the relative value the greater is the preference
    //true for quantity* overall / false for quantity* per building
    _mtdr_loot_items = [
    	[["ItemBandage"],1,[0,1,2,3,4,5,6,7,8,9],[10,10,10,10,10,10,10,10,10,10],false],
    	[["ItemWatch"],12,[7,8],[10,10],true],
    	[["DMR"],1,[2,5],[2,10],true],
    	[["Makarov"],0.50,[5],[10],false]
    ];
    
    if (isServer) then {
    	private ["_mtdr_loot_buildings_objs","_mtdr_lootTable_bobj","_mtdr_lootTable_item","_mtdr_lootActive","_MTDR_fnc_selectRandom"];
    	waitUntil {!isNil "BIS_fnc_selectRandom"};
    	
    	//Wait do give the chance to all mod and server custom buildings to spawn
    	sleep 10;
    	
    	//Predefine loot locations
    	_mtdr_loot_buildings_objs = [];
    	_mtdr_loot_buildings_objs_count = [];
    	{
    		_class = _x;
    		_objs = [];
    		{if (typeOf _x == _class) then {_objs = _objs + [_x];};} forEach (_map_center nearObjects [_class,_map_rad]);
    		_mtdr_loot_buildings_objs = _mtdr_loot_buildings_objs + [_objs];
    	} forEach _mtdr_loot_buildings_class;
    	{
    		_qtt = count _x;
    		_mtdr_loot_buildings_objs_count = _mtdr_loot_buildings_objs_count + [_qtt];
    	} forEach _mtdr_loot_buildings_objs;
    	_mtdr_lootTable_bobj = [];
    	_mtdr_lootTable_item = [];
    	_MTDR_fnc_selectRandom = {_index = round (random count _this - 0.5);_index};
    	{
    		_prefArray = _x select 3;
    		_perBuild = true;
    		_total = 0;
    		_totalB = 0;
    		_mult = 1;
    		if (_perBuild) then {_mult = 0;};
    		{
    			_total = _total + (_mtdr_loot_buildings_objs_count select _x) * ((_prefArray select _forEachIndex) * _mult + (1 - _mult));
    			_totalB = _totalB + (_mtdr_loot_buildings_objs_count select _x);
    		} forEach (_x select 2);
    		{
    			_qttB = (_mtdr_loot_buildings_objs_count select _x) * ((_prefArray select _forEachIndex) * _mult + (1 - _mult));
    			_prefArray set [_forEachIndex,(_qttB/_total) * 100];
    		} forEach (_x select 2);
    		diag_log ("[MTDR LOOT] " + str (_x select 0) + ": _prefArray = " + str _prefArray);
    		_qtt = _x select 1;
    		if !(_x select 4) then {_qtt = round (_qtt * _totalB);};
    		for "_i" from 1 to _qtt do {
    			_bTypeIndex = 0;
    			while {true} do {
    				_idx = (_x select 2) call _MTDR_fnc_selectRandom;
    				if (random 100 < _prefArray select _idx) exitWith {
    					_bTypeIndex = (_x select 2) select _idx;
    				};
    			};
    			_buildObj = (_mtdr_loot_buildings_objs select _bTypeIndex) call BIS_fnc_selectRandom;
    			_buildPos = getPosATL _buildObj;
    			_item = (_x select 0) call BIS_fnc_selectRandom;
    			_bIndex = _mtdr_lootTable_bobj find _buildObj;
    			if (_bIndex == -1) then {
    				_mtdr_lootTable_bobj = _mtdr_lootTable_bobj + [_buildObj];
    				_mtdr_lootTable_item = _mtdr_lootTable_item + [_item];
    			} else {
    				_items = _mtdr_lootTable_item select _bIndex;
    				if (typeName _items == "Array") then {
    					_newPile = _items + [_item];
    					_mtdr_lootTable_item set [_bIndex,_newPile];
    				} else {
    					_newPile = [_items] + [_item];
    					_mtdr_lootTable_item set [_bIndex,_newPile];
    				};
    			};
    		};
    	} forEach _mtdr_loot_items;
    	mtdr_lootSystemMain = [_mtdr_lootTable_bobj,_mtdr_lootTable_item];
    	publicVariable "mtdr_lootSystemMain";
    	
    	//Monitor for Abandoned Loot Deletion
    	_mtdr_lootActive = [];
    	"mtdr_lootActiveAdd" addPublicVariableEventHandler {_mtdr_lootActive = _mtdr_lootActive + [_this select 1];};
    	while {true} do {
    		{
    			_build = _x;
    			_time = _build getVariable ["ml_used",0];
    			if (time - _time > _renewTime) then {
    				_bPos = getPosATL _build;
    				_nearP = false;
    				{if (_bPos distance _x < 200) exitWith {_nearP = true;};} forEach playableUnits;
    				if (!_nearP) then {
    					_idx1 = _mtdr_loot_buildings_class find typeOf _build;
    					_spawnPosAll = _mtdr_loot_buildings_spawnPos select _idx1;
    					{
    						_spawnPos = _build modelToWorld (_x select 0);
    						_holders = _spawnPos nearObjects ["WeaponHolder",5];
    						_holder = objNull;
    						if (count _holders > 0) then {
    							{
    								if (_x getVariable ["ml_hld",false]) exitWith {_holder = _x;};
    							} forEach _holders;
    						};
    						if (!isNull _holder) then {deleteVehicle _holder;};
    					} forEach _spawnPosAll;
    					_mtdr_lootActive = _mtdr_lootActive - [_build];
    					if (_spawnAgain) then {
    						_build setVariable ["ml_used",-1,true];
    					};
    				};
    			};
    			uiSleep 0.001;
    		} forEach _mtdr_lootActive;
    		uiSleep 180;
    	};
    };
    
    if (hasInterface) then {
    	private ["_mtdr_lootTable_bobj","_mtdr_lootTable_item","_mtdr_pPosMain","_mtdr_calc_newBuilds","_mtdr_spawnLoot","_mtdr_lootTable_bobj_local","_mtdr_lootTable_item_local"];
    	waitUntil {!isNil "mtdr_lootSystemMain"};
    	_mtdr_lootTable_bobj = mtdr_lootSystemMain select 0;
    	_mtdr_lootTable_item = mtdr_lootSystemMain select 1;
    	_mtdr_pPosMain = getPosATL player;
    	
    	//Function to Find Loot buildings near the player
    	//They are the ones that will be monitored in the loop
    	_mtdr_calc_newBuilds = {
    		_mtdr_lootTable_bobj_local = [];
    		_mtdr_lootTable_item_local = [];
    		{
    			_bSize = (sizeOf typeOf _x) * 2;
    			_dist = ((_mtdr_pPosMain distance _x) - _bSize) max 0;
    			_items = _mtdr_lootTable_item select _forEachIndex;
    			if (_dist < 300) then {
    				_mtdr_lootTable_bobj_local = _mtdr_lootTable_bobj_local + [_x];
    				_mtdr_lootTable_item_local = _mtdr_lootTable_item_local + [_items];
    			};
    		} forEach _mtdr_lootTable_bobj;
    	};
    	
    	//Function to Spawn Loot
    	_mtdr_spawnLoot = {
    		_obj = _this select 0;
    		_items = _this select 1;
    		if (typeName _items != "Array") then {_items = [_items];};
    		_idx1 = _mtdr_loot_buildings_class find typeOf _obj;
    		_spawnPosAll = _mtdr_loot_buildings_spawnPos select _idx1;
    		{
    			_spawnPosArray = _spawnPosAll call BIS_fnc_selectRandom;
    			_spawnPos = _obj modelToWorld (_spawnPosArray select 0);
    			_onGround = _spawnPosArray select 1;
    			if (_onGround) then {_spawnPos = [_spawnPos select 0,_spawnPos select 1,0];};
    			_holders = _spawnPos nearObjects ["WeaponHolder",5];
    			_holder = objNull;
    			if (count _holders > 0 && {_x getVariable ["ml_hld",false]} count _holders > 0) then {
    				{
    					if (_x getVariable ["ml_hld",false]) exitWith {
    						_holder = _x;
    					};
    				} forEach _holders;
    			} else {
    				_holder = createVehicle ["WeaponHolder",_spawnPos,[],0,"CAN_COLLIDE"];
    				_holder setPosATL _spawnPos;
    				_holder setVariable ["ml_hld",true,true];
    			};
    			_isM = isClass (configFile >> "CfgMagazines" >> _x);
    			if (_isM) then {
    				_holder addMagazineCargoGlobal [_x,1];
    			} else {
    				_isW = isClass (configFile >> "CfgWeapons" >> _x);
    				if (_isW) then {
    					_holder addWeaponCargoGlobal [_x,1];
    				} else {
    					_isV = isClass (configFile >> "CfgVehicles" >> _x);
    					if (_isV) then {
    						_holder addBackpackCargoGlobal [_x,1];
    					} else {
    						diag_log "[MTDR LOOT] TIPO DE LOOT NAO IDENTIFICADO!";
    					};
    				};
    			};
    		} forEach _items;
    		mtdr_lootActiveAdd = _obj;
    		publicVariableServer "mtdr_lootActiveAdd";
    	};
    	call _mtdr_calc_newBuilds;
    
    	//Monitore for Loot Buildings to activate for player
    	while {true} do {
    		_pOnFoot = vehicle player == player;
    		if (_pOnFoot) then {
    			_pPos = getPosATL player;
    			_walked = _mtdr_pPosMain distance _pPos;
    			if (_walked > 280) then {
    				_mtdr_pPosMain = _pPos;
    				call _mtdr_calc_newBuilds;
    				_walked = 0;
    			};
    			{
    				_bSize = sizeOf typeOf _x;
    				_dist = ((_pPos distance _x) - _bSize) max 0;
    				if (_dist == 0) then {
    					_bUsed = _x getVariable ["ml_used",-1];
    					if (_bUsed == -1) then {
    						_x setVariable ["ml_used",time,true];
    						_items = _mtdr_lootTable_item_local select _forEachIndex;
    						[_x,_items] call _mtdr_spawnLoot;
    						//systemChat "Loot Especial Matadouro...!";
    					};
    				};
    			} forEach _mtdr_lootTable_bobj_local;
    		};
    		uiSleep 2;
    	};
    };
    
  2. raymix,

    Instead of reseting eveything, i will try to reset only what need to be reseted.

    For example, i don't need to stop and run compiles.sqf again. Also don't need to stop and run again a safezone script, for example.

    I'm about to check now if "player" variable is ok during the respawn. If its not turn to nil or nul would be a very good thing, because it will not harm loops or fsm based on it.

    If i configure imediate respaw, may be "alive player" will never give false during his death, this would be even better, becaus no script will know player died, and will continue to run ok.

    Or even even better, make a fake death for the player, so real player will never die. Reset what need to be reseted, and its ok.

     

  3. I started by just changing the last line from player_death.sqf from

    endMission "END1";

    to

    execVM "init.sqf";

    It worked.

    But player get stuck on loading screen probably because some variable that must be nil on start are not nil.

    Now i will try to identify those variable. If anyone have some info, please share.

    Thankyou!

  4. I'm trying to avoid player go to the lobby.

    What happens when you die is that you wait 5 seconds and then you respaw on the base (Arma 2 OA behaviour set in description.ext, base is probably out of the map).

    The init.sqf attach a Respawn event handler that calls player.death.sqf and this one ends the mission.

    You guys know if its hard to avoid player to go to the lobby after die?

    Thankyou.

     

  5. EXPLODING VEHICLES

    Thankyou a lot Creativv!

    I believe changing this line on the script:

    _veh = createVehicle [_vehicle,_pos,[],0,"CAN_COLLIDE"];

    to that:

    _veh = createVehicle [_vehicle,_pos,[],0,"CAN_COLLIDE"];
    PVDZE_serverObjectMonitor = PVDZE_serverObjectMonitor + [_veh];

    Could also solve the problem.

    But i did like you, and removed the code, since i believe it's outdated and mostly useless.

     

  6. Creativv,

    The cost for the server of a temporary vehicle is most the same of a permanent one, except that the server dont need to update the temporary vehicle on the database when it get damaged or someone enter/exit it.

    But with all vehicles temporary you have total control of how many vehicles are in the server and can change the quantity form 400 to 300, for example, in one restart.

    This is good for the PVP server i'm creating. But for Epoch may be its better to have it along with permanent vehicles, or create the possibilitie to make a vehicle permanente in some way.

  7. Run it on the server, at the end of the server file init\server_functions.sqf.

    Play with the configurations.

    It will spawn temporary vehicles all over the map, acordingly to your configuration.

    Any doubt, please ask.

    Thankyou, and sory for no more info, there is nothing else can i say, but if you want to know something, please ask.

    //=========================
    // By Donnovan/Rubycon
    //=========================
    // Spawn Temporary Vehicles
    //=========================
    
    //CONFIGURATION 1
    
    _mapSize = 15360; //SIZE OF THE MAP (DEFAULT IS CHERNARUS SIZE)
    _useVehAntiGlitch = true; //AVOID USE OF VEHICLES TO INVADE BASES
    _useTempVehMsg = true; //SEND MESSAGE ALERTING ABOUT TEMPORARY VEHICLE
    mtdr_runningMod = 0; //0 FOR EPOCH, 1 FOR DAYZ MOD AND 2 FOR OTHERS
    
    //CONFIGURATION 2
    //VEHICLES TO SPAWN
    _vehClassAll = [
    	[//CARS (WEAK,NORMAL,STRONG)
    		["Tractor","car_sedan","SkodaRed","SkodaBlue","SkodaGreen","Lada1","Lada2"],
    		["UAZ_CDF","UralCivil","hilux1_civil_1_open","Baf_Offroad_W"],
    		["HMMWV_DZ","Offroad_DSHKM_INS","M113_PMC","landRover_CZ_EP1","SUV_TK_CIV_EP1"]
    	],
    	[//HELI (WEAK,NORMAL,STRONG)
    		["MH6J_DZ","AH6X_DZ"],
    		["UH1H_DZ"],
    		["Mi17_DZ"]
    	]
    ];
    
    //NUMBER OF EACH VEHICLES
    _vehClassQttAll = [
    	[//CARS QTT (WEAK,NORMAL,STRONG): TOTAL 70*
    		40,
    		20,
    		10
    	],
    	[//HELI QTT (WEAK,NORMAL,STRONG): TOTAL 15**
    		5,
    		5,
    		5
    	]
    ];
    
    //LOCATIONS TO SPAWN
    _locationTypesAll = [
    	[//CAR SPAWN LOCATION (VILLAGE/CITY/CAPITAL)
    		//A LOT OF PLACES
    		["NameVillage"],
    		//BEREZINO, KRASNOSTAV, SOLNICHNTY, ELEKTROZAVODSK, ETC
    		["NameCity"],
    		//CHERNOGORSK, BALOTA AIRPORT AND NORTHWEST AIRPORT
    		["NameCityCapital","Airport"]
    	],
    	[//HELI SPAWN LOCATION (VILLAGE/CITY/CAPITAL)
    		//A LOT OF PLACES
    		["NameVillage"],
    		//BEREZINO, KRASNOSTAV, SOLNICHNTY, ELEKTROZAVODSK, ETC
    		["NameCity"],
    		//CHERNOGORSK, BALOTA AIRPORT AND NORTHWEST AIRPORT
    		["NameCityCapital","Airport"]
    	]
    ];
    
    //NUMBER OF VEHICLES IN EACH LOCATION
    _locationTypesQttAll = [
    	[//CAR QTT IN LOCATION (VILLAGE/CITY/CAPITAL): TOTAL 70* (MUST MATCH TOTAL OF CARS)
    		40,
    		24,
    		 6
    	],
    	[//HELI QTT IN LOCATION (VILLAGE/CITY/CAPITAL): TOTAL 15** (MUST MATCH TOTAL OF HELIS)
    		2,
    		5,
    		8
    	]
    ];
    
    //LOCATIONS SPAWN RAD
    _locationTypesRadAll = [
    	[//LOCATION RAD FOR CAR (VILLAGE/CITY/CAPITAL)
    		100,
    		200,
    		300
    	],
    	[//LOCATION RAD FOR HELI (VILLAGE/CITY/CAPITAL)
    		200,
    		400,
    		600
    	]
    ];
    
    //TENDENCIE MATRIX:
    //TRY THE MOST TO MARRY VILLAGE / CITY / CAPITAL PLACES WITH WEAK / NORMAL / STRONG VEHICLES,
    //RESPECTVELY, WITHOUT CHANGING THE TOTALS IN _vehClassQttAll AND _locationTypesQttAll
    _vehTendenciesUse = true;
    _vehTendencies = [
    	[
    		[ 0.02,-0.01,-0.01],
    		[-0.01, 0.02,-0.01],
    		[-0.01,-0.01, 0.02]
    	],
    	[
    		[ 0.01, 0.00,-0.01],
    		[ 0.00, 0.00, 0.00],
    		[-0.01, 0.00, 0.01]
    	],
    	[
    		[ 0.00, 0.00, 0.00],
    		[ 0.00, 0.01,-0.01],
    		[ 0.00,-0.01, 0.01]
    	],
    	[
    		[ 0.01,-0.01, 0.00],
    		[-0.01, 0.01, 0.00],
    		[ 0.00, 0.00, 0.00]
    	]
    ];
    
    //CLASSES OF THE VEHICLES TO BE SPAWNED TO FIX ROUND ERRORS
    _basketVehClass = ["UAZ_CDF","UralCivil","hilux1_civil_1_open","MH6J_DZ","AH6X_DZ","UH1H_DZ"];
    
    //END OF CONFIGURATION
    
    //SCRIPT
    _countVeh = [];
    {_countVeh = _countVeh + [0];} forEach _vehClassAll;
    {
    	//SET VARS
    	_vehSet = _forEachIndex;
    	_vehClass = _vehClassAll select _vehSet;
    	_vehClassQtt = _vehClassQttAll select _vehSet;
    	_locationTypes = _locationTypesAll select _vehSet;
    	_locationTypesQtt = _locationTypesQttAll select _vehSet;
    	_locationTypesRad = _locationTypesRadAll select _vehSet;
    	
    	//TOTAL VEHICLES
    	_vehQtt = 0;
    	{_vehQtt = _vehQtt + _x;} forEach _vehClassQtt;
    	
    	//QTT MATRIX CALCULATION
    	_vehLocQtt = [
    		[(_vehClassQtt select 0)*(_locationTypesQtt select 0),(_vehClassQtt select 0)*(_locationTypesQtt select 1),(_vehClassQtt select 0)*(_locationTypesQtt select 2)],
    		[(_vehClassQtt select 1)*(_locationTypesQtt select 0),(_vehClassQtt select 1)*(_locationTypesQtt select 1),(_vehClassQtt select 1)*(_locationTypesQtt select 2)],
    		[(_vehClassQtt select 2)*(_locationTypesQtt select 0),(_vehClassQtt select 2)*(_locationTypesQtt select 1),(_vehClassQtt select 2)*(_locationTypesQtt select 2)]
    	];
    
    	_vehLocQtt = [
    		[(_vehLocQtt select 0 select 0)/_vehQtt,(_vehLocQtt select 0 select 1)/_vehQtt,(_vehLocQtt select 0 select 2)/_vehQtt],
    		[(_vehLocQtt select 1 select 0)/_vehQtt,(_vehLocQtt select 1 select 1)/_vehQtt,(_vehLocQtt select 1 select 2)/_vehQtt],
    		[(_vehLocQtt select 2 select 0)/_vehQtt,(_vehLocQtt select 2 select 1)/_vehQtt,(_vehLocQtt select 2 select 2)/_vehQtt]
    	];
    
    	//APLYES TENDENCIES
    	if (_vehTendenciesUse) then {
    		{
    			_vehTendencie = _x;
    			_lastMatrix = +_vehLocQtt;
    			_stop = false;
    			while {true} do {
    				_newMatrix = [];
    				{
    					_line = _x;
    					_lineI = _forEachIndex;
    					_newLine = [];
    					{
    						_colI = _forEachIndex;
    						_tend = _vehTendencie select _lineI select _colI;
    						_newValor = _x + _tend;
    						if (_newValor < 0) exitWith {_stop = true;};
    						_newLine = _newLine + [_newValor];
    					} forEach _line;
    					if (_stop) exitWith {};
    					_newMatrix = _newMatrix + [_newLine];
    				} forEach _lastMatrix;
    				if (_stop) exitWith {_vehLocQtt = +_lastMatrix;};
    				_lastMatrix = +_newMatrix;
    			};
    		} forEach _vehTendencies;
    	};
    	
    	//ROUND VALUES
    	_villBasket = 0;
    	_cityBasket = 0;
    	_captBasket = 0;
    	_vehLocQttRnd = [];
    	{
    		_vill = (_x select 0);
    		_city = (_x select 1);
    		_capt = (_x select 2);
    		_villR = round _vill;
    		_cityR = round _city;
    		_captR = round _capt;
    		_villBasket = _vill - _villR;
    		_cityBasket = _city - _cityR;
    		_captBasket = _capt - _captR;
    		_vehLocQttRnd = _vehLocQttRnd + [[_villR,_cityR,_captR]];
    	} forEach _vehLocQtt;
    
    	//CORRECT ERROR GENERATED BY ROUND
    	_vehLocQttRnd = _vehLocQttRnd + [[round _villBasket,round _cityBasket,round _captBasket]];
    	_vehClass = _vehClass + [_basketVehClass];
    
    	//FIND PLACES
    	_places = [];
    	_mapCenter = [_mapSize/2,_mapSize/2,0];
    	{
    		_subPlaces = [];
    		{_subPlaces = _subPlaces + nearestLocations [_mapCenter,[_x],15000];} forEach _x;
    		_places = _places + [_subPlaces];
    	} forEach _locationTypes;
    
    	//ANTI GLITCH FOR EXIT VEHICLE
    	mtdr_getOut = {
    		private ["_player","_veh","_builds"];
    		_veh = _this select 0;
    		_player = _this select 2;
    		if (mtdr_runningMod == 0) then {
    			_builds = count (_veh nearObjects ["ModularItems",5]);
    			_builds = _builds + count (_veh nearObjects ["Land_DZE_WoodDoorLocked_Base",5]);
    			_builds = _builds + count (_veh nearObjects ["CinderWallDoorLocked_DZ_Base",5]);
    		};
    		if (mtdr_runningMod == 1) then {
    			_builds = count (_veh nearObjects ["DZ_buildables",5]);
    		};
    		if (_builds > 0 && _veh isKindOf "LandVehicle") then {
    			_bBox = boundingBox _veh;
    			_h = abs((_bBox select 0 select 2) - (_bBox select 1 select 2));
    			_pos = getPosATL _veh;
    			_pos = [_pos select 0,_pos select 1,_h];
    			_player setPosATL _pos;
    			[nil,_player,"loc",rTITLETEXT,"You can''t exit vehicle too close to buildables objects.","PLAIN DOWN",5] call RE;
    		};
    	};
    	
    	//SEND MESSAGE ABOUT TEMPORARY VEHICLE
    	mtdr_message = {
    		private ["_player","_veh"];
    		_veh = _this select 0;
    		_player = _this select 2;
    		[nil,_player,"loc",rTITLETEXT,"\nThis is a temporary vehicle!","PLAIN DOWN",2] call RE;
    	};
    
    	//SPAWN VEHICLES
    	_failed = 0;
    	_placeIndex = 0;
    	waitUntil {!isNil "BIS_fnc_findSafePos" && !isNil "PVDZE_serverObjectMonitor"}; //NEW LINE!
    	{
    		_line = _x;
    		_vehicles = _vehClass select _forEachIndex;
    		{
    			for "_c" from 1 to _x do {
    				_placesSub = _places select _forEachIndex;
    				_place = _placesSub select (_placeIndex mod (count _placesSub));
    				_placeIndex = _placeIndex + 1;
    				_placePos = locationPosition _place;
    				_placeRad = _locationTypesRad select _forEachIndex;
    				_vehicle = _vehicles call BIS_fnc_selectRandom;
    				_vehicleSize = (sizeOf _vehicle)/2;
    				_pos = [_placePos,0,_placeRad,_vehicleSize,0,20,0,[],[_placePos,[0,0,0]]] call BIS_fnc_findSafePos;
    				if !(_pos select 0 == _placePos select 0 && _pos select 1 == _placePos select 1) then {
    					_pos = [_pos select 0,_pos select 1,1];
    					_veh = createVehicle [_vehicle,_pos,[],0,"CAN_COLLIDE"];
    					PVDZE_serverObjectMonitor = PVDZE_serverObjectMonitor + [_veh]; //NEW LINE!
    					if (_useVehAntiGlitch && mtdr_runningMod < 2) then {
    						_veh addEventHandler ["GetOut",{_this call mtdr_getOut;}];
    					};
    					if (_useTempVehMsg) then {
    						_veh addEventHandler ["GetIn",{_this call mtdr_message;}];
    					};
    					_veh setDir random 360;
    					_veh setVelocity [0,0,0.5];
    					_countVeh set [_vehSet,(_countVeh select _vehSet) + 1];
    					sleep (1/50);
    				} else {
    					_failed = _failed + 1;
    					diag_log ("[SPAWN VEHICLE FAILED] fails = " + str _failed);
    				};
    			};
    		} forEach _line;
    	} forEach _vehLocQttRnd;
    
    	diag_log ("[VEHICLES SPAWNED ON THE MAP] = " + str _countVeh);
    } forEach _vehClassAll;
    

     

  8. The fact that the player goes to lobby after die is the main source of bandwitch peak in Epoch servers.

    Why not use respawn instead of "go to the lobby"?

    With respawn the player don't need do download all map info again.

    With then going to the lobby, 5 players dies and you have a plus 10 mbps upload demand on their reconnect. Other than that, i can say the bandwidth consume is pretty ok.

    Thankyou a lot.

×
×
  • Create New...