SadBoy1981 Posted May 20, 2015 Report Share Posted May 20, 2015 Was working before, but now just cant add it. They going to be deleted after player come close add vehicle: if (isServer) then { private ["_objs"]; _objs = [ {"O_MRAP_02_hmg_F",{1070.57,2515.65,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"O_MRAP_02_hmg_F",{1065.77,2513.81,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"I_MRAP_03_hmg_F",{1060.96,2511.98,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"O_MRAP_02_F",{1056.16,2510.14,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"B_MRAP_01_hmg_F",{1051.36,2508.31,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"Cha_BTR60_TK",{1046.55,2506.47,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"I_MRAP_03_hmg_F",{1041.75,2504.64,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"I_Heli_Transport_02_EPOCH",{1083.95,2520.02,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"B_Heli_Light_01_EPOCH",{1098.56,2524.64,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false} ]; { private ["_obj"]; _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; if (_x select 4) then { _obj setDir (_x select 2); _obj setPos (_x select 1); _obj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _obj setVariable["LAST_CHECK",1000000000000]; _obj call EPOCH_server_setVToken; addToRemainsCollector[_obj]; clearWeaponCargoGlobal _obj; clearMagazineCargoGlobal _obj; clearBackpackCargoGlobal _obj; clearItemCargoGlobal _obj; } else { _obj setPosATL (_x select 1); _obj setVectorDirAndUp (_x select 3); _obj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _obj setVariable["LAST_CHECK",1000000000000]; _obj call EPOCH_server_setVToken; addToRemainsCollector[_obj]; clearWeaponCargoGlobal _obj; clearMagazineCargoGlobal _obj; clearBackpackCargoGlobal _obj; clearItemCargoGlobal _obj; }; } foreach _objs; }; FIXED: just add sleep 60; before run script Sneakydude 1 Link to comment Share on other sites More sharing options...
0 second_coming Posted May 20, 2015 Report Share Posted May 20, 2015 Looking at your error it doesn't look like it is from that part of the code. Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 20, 2015 Author Report Share Posted May 20, 2015 Have you also added them into your epochconfig.hpp? yes, i think they are on my epochconfig.hpp Link to comment Share on other sites More sharing options...
0 second_coming Posted May 20, 2015 Report Share Posted May 20, 2015 yes, i think they are on my epochconfig.hppSorry I edited my post.. :D Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 20, 2015 Author Report Share Posted May 20, 2015 Looking at your error it doesn't look like it is from that part of the code. ok, but why vehicles going to be deleted if _obj call EPOCH_server_setVToken; must to prevent this? Link to comment Share on other sites More sharing options...
0 stonXer Posted May 20, 2015 Report Share Posted May 20, 2015 ye that error is from somewhere else. tried adding "obj_ call EPOCH_server_vehicleInit;" ? Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 20, 2015 Author Report Share Posted May 20, 2015 still going to be deleted with call EPOCH_server_vehicleInit; too Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 20, 2015 Author Report Share Posted May 20, 2015 ye that error is from somewhere else. tried adding "obj_ call EPOCH_server_vehicleInit;" ? i try other way if (isServer) then { _vehicle_1 = objNull; if (true) then { _object = createVehicle ["O_MRAP_02_hmg_F", [1070.57,2515.65,0], [], 0, "CAN_COLLIDE"]; _vehicle_1 = _object; _object setDir 339; _object setPos [1070.57,2515.65,0]; _object call EPOCH_server_setVToken; _object call EPOCH_server_vehicleInit; addToRemainsCollector[_object]; clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; clearBackpackCargoGlobal _object; clearItemCargoGlobal _object; }; }; but still have this error 18:17:56 Error in expression <etPos [1070.57,2515.65,0]; _object call EPOCH_server_setVToken; _object call EPO> 18:17:56 Error position: <EPOCH_server_setVToken; _object call EPO> 18:17:56 Error Undefined variable in the expression: epoch_server_setvtoken 18:17:56 File q\addons\vehicles\init.sqf, line 10 Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 22, 2015 Author Report Share Posted May 22, 2015 bump Anyone have this problem with custom vehicles? Also i try in default server, same error! Link to comment Share on other sites More sharing options...
0 shurix Posted May 22, 2015 Report Share Posted May 22, 2015 You are running this code from your mission.sqm file? Mission doesn't know what EPOCH_server_setVToken is. It's gotta execute from a server-side pbo Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 22, 2015 Author Report Share Posted May 22, 2015 You are running this code from your mission.sqm file? Mission doesn't know what EPOCH_server_setVToken is. It's gotta execute from a server-side pbo serverside custom pbo was working week ago Link to comment Share on other sites More sharing options...
0 Suppe Posted May 22, 2015 Report Share Posted May 22, 2015 maybe that will help, I only have: _vehicle = createVehicle [_veh1, _pos1, [], 0, "FLY"]; _vehicle setVariable ["BIS_enableRandomization", false]; _vehicle call EPOCH_server_setVToken; _vehicle call EPOCH_server_vehicleInit; direct after the create vehicle is the: _vehicle setVariable ["BIS_enableRandomization", false]; _vehicle call EPOCH_server_setVToken; _vehicle call EPOCH_server_vehicleInit; maybe it will help. i have no errors and the vehicle do not despawn. @ shurix äähhhmm, no... serverside can be in the missionfile, why not ? you only send the command or variable serverside. Greetz Suppe Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 22, 2015 Author Report Share Posted May 22, 2015 maybe that will help, I only have: _vehicle = createVehicle [_veh1, _pos1, [], 0, "FLY"]; _vehicle setVariable ["BIS_enableRandomization", false]; _vehicle call EPOCH_server_setVToken; _vehicle call EPOCH_server_vehicleInit; direct after the create vehicle is the: _vehicle setVariable ["BIS_enableRandomization", false]; _vehicle call EPOCH_server_setVToken; _vehicle call EPOCH_server_vehicleInit; maybe it will help. i have no errors and the vehicle do not despawn. @ shurix äähhhmm, no... serverside can be in the missionfile, why not ? you only send the command or variable serverside. Greetz Suppe same error with your code :( Error Undefined variable in the expression: epoch_server_setvtoken Link to comment Share on other sites More sharing options...
0 Silens Posted May 22, 2015 Report Share Posted May 22, 2015 Code is probably running before epoch_server_setvtoken is compiled. Try adding a delay, or wait until !isnil "EPOCH_server_setVToken" ? SadBoy1981 1 Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 22, 2015 Author Report Share Posted May 22, 2015 Code is probably running before epoch_server_setvtoken is compiled. Try adding a delay, or wait until !isnil "EPOCH_server_setVToken" ? Thank you for idea,i just add before script run sleep 60; Link to comment Share on other sites More sharing options...
0 shurix Posted May 23, 2015 Report Share Posted May 23, 2015 Does anyone have it working on a fully populated server with EPOCH_VehicleSlots=[] (zero empty slots) to save a new mission vehicle to the database? I'm getting the new vehicles recorded into the database, but after the restart my vehicle disappear (???). private ['_velimit','_isAir','_isShip','_position','_dir','_marker','_vehObj','_slot','_vehClass','_colors','_color','_config','_selections','_textures','_forEachIndex','_textureSelectionIndex','_vehicleFound','_randomVehicleIndex','_randomVehicle','_vehicleCount','_count']; _instanceID = call EPOCH_fn_InstanceID; diag_log format["WAI: _instanceID:%1",_instanceID]; diag_log format["WAI: initial EPOCH_VehicleSlotsLimit:%1",EPOCH_VehicleSlotsLimit]; diag_log format["WAI: initial EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: initial EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; _vehObj = _this; _vehObj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _vehObj setVariable["LAST_CHECK",1000000000000]; _vehClass = typeOf _vehObj; EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1; EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit); _slot = EPOCH_VehicleSlots= select 0; diag_log format["WAI: _slot=%1",_slot]; _vehObj setVariable['VEHICLE_SLOT',_slot,true]; EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot]; EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots; publicVariable 'EPOCH_VehicleSlotCount'; diag_log format["WAI: new EPOCH_VehicleSlotsLimit:%1",EPOCH_VehicleSlotsLimit]; diag_log format["WAI: new EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: new EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; _config = (configFile >> 'CfgVehicles' >> _vehClass >> 'availableColors'); if(isArray(_config)) then{ _textureSelectionIndex = configFile >> 'CfgVehicles' >> _vehClass >> 'textureSelectionIndex'; _selections = if(isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] }; _colors = getArray(_config); _textures = _colors select 0; _color = floor (random (count _textures)); _count = (count _colors)-1; { if(_count >= _forEachIndex) then { _textures = _colors select _forEachIndex; }; _vehObj setObjectTextureGlobal [_x, (_textures select _color)]; } forEach _selections; _vehObj setVariable['VEHICLE_TEXTURE',_color]; }; _vehObj call EPOCH_server_setVToken; clearWeaponCargoGlobal _vehObj; clearMagazineCargoGlobal _vehObj; clearBackpackCargoGlobal _vehObj; clearItemCargoGlobal _vehObj; // if(!isNull _vehObj) then { // _aa=_vehObj; // // _ac=_vehObj getVariable["VEHICLE_SLOT","ABORT"]; // // if(_ac !="ABORT")then{ // _ad=format["%1:%2",_instanceID,_slot]; // _aj=[]; // _ak=_aa call EPOCH_getHitpoints; // { // _aj pushBack(_aa getHitPointDamage _x); // }forEach _ak; // _wepsItemsCargo=weaponsItemsCargo _aa; // if(isNil "_wepsItemsCargo")then{ // _wepsItemsCargo=[]; // }; // _magsAmmoCargo=magazinesAmmoCargo _aa; // if(isNil "_magsAmmoCargo")then{ // _magsAmmoCargo=[]; // }; // _aq=[[],[]]; // { // _ar=_aq find(_x select 0); // if(_ar >=0)then{ // (_aq select 1)set[_ar,((_aq select 1)select _ar)+(_x select 1)];} // else{(_aq select 0)pushBack(_x select 0);(_aq select 1)pushBack(_x select 1);}; // }forEach _magsAmmoCargo; // _al=[_wepsItemsCargo,_aq,getBackpackCargo _aa,getItemCargo _aa]; // _ap=_aa getVariable["VEHICLE_TEXTURE",0]; // _am=[typeOf _aa,[getposATL _aa,vectordir _aa,vectorup _aa],damage _aa,_aj,fuel _aa,_al,magazinesAmmo _aa,_ap]; // ["Vehicle",_ad,EPOCH_expiresVehicle,_am] call EPOCH_server_hiveSETEX; // //}; // }; _vehObj call EPOCH_server_save_vehicle; _vehObj call EPOCH_server_vehicleInit; another option I'm running on my Production server is to find a Kart or a Boat to replace it with my custom vehicle in the database. This works, but I'm running out of Karts :( _instanceID = call EPOCH_fn_InstanceID; diag_log format["WAI: _instanceID:%1",_instanceID]; diag_log format["WAI: EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; // _allowedVehicleList = EPOCH_allowedVehiclesList; // diag_log format["WAI: EPOCH_allowedVehiclesList:%1",_allowedVehicleList]; _vehObj = _this; _randomVehicleIndex = -1; if (EPOCH_VehicleSlotCount==0) then { if (!isNil "EPOCH_allowedVehiclesList") then { _countAllowedVeh=count EPOCH_allowedVehiclesList; _randomVehicleIndex=floor(random(_countAllowedVeh)); _randomVehicle=EPOCH_allowedVehiclesList select _randomVehicleIndex; _vehClass=_randomVehicle select 0; _velimit=_randomVehicle select 1; _vehicleCount={typeOf _x==_vehClass}count vehicles; if(_vehicleCount >=_velimit)then{ EPOCH_allowedVehiclesList deleteAt _randomVehicleIndex; } else { if(_vehicleCount==(_velimit-1))then{ EPOCH_allowedVehiclesList deleteAt _randomVehicleIndex; }; }; } else { _vehlist = nearestObjects [getMarkerPos "center", ["C_Rubberboat_EPOCH","C_Rubberboat_02_EPOCH","C_Rubberboat_03_EPOCH","C_Rubberboat_04_EPOCH""C_Boat_Civil_01_EPOCH","K01","K02","K03","K04","jetski_epoch"], 10000]; diag_log format["WAI: count _vehlist:%1 | _randomVehicle:%2",count _vehlist,_vehlist select 0]; _vehToDelete = _vehlist select 0; _randomVehicleIndex = _vehToDelete getVariable["VEHICLE_SLOT","ABORT"]; deleteVehicle _vehToDelete; }; }; _slot = ""; if !(EPOCH_VehicleSlots isEqualTo[]) then { _slot = EPOCH_VehicleSlots select 0; EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot]; EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots; publicVariable 'EPOCH_VehicleSlotCount'; } else { diag_log format["WAI: _slot = _randomVehicleIndex:%1",_randomVehicleIndex]; _slot = _randomVehicleIndex; }; if (str(_slot) != "") then { _vehObj setVariable["VEHICLE_SLOT",_slot,true]; private["_aa","_ab","_ac","_ad","_ae","_af","_ag","_ah","_ai","_aj","_ak","_al","_am","_an","_ao","_ap","_aq","_ar"]; if(!isNull _vehObj) then { _aa=_vehObj; // _ac=_vehObj getVariable["VEHICLE_SLOT","ABORT"]; // if(_ac !="ABORT")then{ _ad=format["%1:%2",(call EPOCH_fn_InstanceID),_slot]; _aj=[]; _ak=_aa call EPOCH_getHitpoints; { _aj pushBack(_aa getHitPointDamage _x); }forEach _ak; _wepsItemsCargo=weaponsItemsCargo _aa; if(isNil "_wepsItemsCargo")then{ _wepsItemsCargo=[]; }; _magsAmmoCargo=magazinesAmmoCargo _aa; if(isNil "_magsAmmoCargo")then{ _magsAmmoCargo=[]; }; _aq=[[],[]]; { _ar=_aq find(_x select 0); if(_ar >=0)then{ (_aq select 1)set[_ar,((_aq select 1)select _ar)+(_x select 1)];} else{(_aq select 0)pushBack(_x select 0);(_aq select 1)pushBack(_x select 1);}; }forEach _magsAmmoCargo; _al=[_wepsItemsCargo,_aq,getBackpackCargo _aa,getItemCargo _aa]; _ap=_aa getVariable["VEHICLE_TEXTURE",0]; _am=[typeOf _aa,[getposATL _aa,vectordir _aa,vectorup _aa],damage _aa,_aj,fuel _aa,_al,magazinesAmmo _aa,_ap]; ["Vehicle",_ad,EPOCH_expiresVehicle,_am] call EPOCH_server_hiveSETEX; //}; }; _vehObj call EPOCH_server_vehicleInit; }; Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 23, 2015 Author Report Share Posted May 23, 2015 Does anyone have it working on a fully populated server with EPOCH_VehicleSlots=[] (zero empty slots) to save a new mission vehicle to the database? I'm getting the new vehicles recorded into the database, but after the restart my vehicle disappear (???). private ['_velimit','_isAir','_isShip','_position','_dir','_marker','_vehObj','_slot','_vehClass','_colors','_color','_config','_selections','_textures','_forEachIndex','_textureSelectionIndex','_vehicleFound','_randomVehicleIndex','_randomVehicle','_vehicleCount','_count']; _instanceID = call EPOCH_fn_InstanceID; diag_log format["WAI: _instanceID:%1",_instanceID]; diag_log format["WAI: initial EPOCH_VehicleSlotsLimit:%1",EPOCH_VehicleSlotsLimit]; diag_log format["WAI: initial EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: initial EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; _vehObj = _this; _vehObj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _vehObj setVariable["LAST_CHECK",1000000000000]; _vehClass = typeOf _vehObj; EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1; EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit); _slot = EPOCH_VehicleSlots= select 0; diag_log format["WAI: _slot=%1",_slot]; _vehObj setVariable['VEHICLE_SLOT',_slot,true]; EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot]; EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots; publicVariable 'EPOCH_VehicleSlotCount'; diag_log format["WAI: new EPOCH_VehicleSlotsLimit:%1",EPOCH_VehicleSlotsLimit]; diag_log format["WAI: new EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: new EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; _config = (configFile >> 'CfgVehicles' >> _vehClass >> 'availableColors'); if(isArray(_config)) then{ _textureSelectionIndex = configFile >> 'CfgVehicles' >> _vehClass >> 'textureSelectionIndex'; _selections = if(isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] }; _colors = getArray(_config); _textures = _colors select 0; _color = floor (random (count _textures)); _count = (count _colors)-1; { if(_count >= _forEachIndex) then { _textures = _colors select _forEachIndex; }; _vehObj setObjectTextureGlobal [_x, (_textures select _color)]; } forEach _selections; _vehObj setVariable['VEHICLE_TEXTURE',_color]; }; _vehObj call EPOCH_server_setVToken; clearWeaponCargoGlobal _vehObj; clearMagazineCargoGlobal _vehObj; clearBackpackCargoGlobal _vehObj; clearItemCargoGlobal _vehObj; // if(!isNull _vehObj) then { // _aa=_vehObj; // // _ac=_vehObj getVariable["VEHICLE_SLOT","ABORT"]; // // if(_ac !="ABORT")then{ // _ad=format["%1:%2",_instanceID,_slot]; // _aj=[]; // _ak=_aa call EPOCH_getHitpoints; // { // _aj pushBack(_aa getHitPointDamage _x); // }forEach _ak; // _wepsItemsCargo=weaponsItemsCargo _aa; // if(isNil "_wepsItemsCargo")then{ // _wepsItemsCargo=[]; // }; // _magsAmmoCargo=magazinesAmmoCargo _aa; // if(isNil "_magsAmmoCargo")then{ // _magsAmmoCargo=[]; // }; // _aq=[[],[]]; // { // _ar=_aq find(_x select 0); // if(_ar >=0)then{ // (_aq select 1)set[_ar,((_aq select 1)select _ar)+(_x select 1)];} // else{(_aq select 0)pushBack(_x select 0);(_aq select 1)pushBack(_x select 1);}; // }forEach _magsAmmoCargo; // _al=[_wepsItemsCargo,_aq,getBackpackCargo _aa,getItemCargo _aa]; // _ap=_aa getVariable["VEHICLE_TEXTURE",0]; // _am=[typeOf _aa,[getposATL _aa,vectordir _aa,vectorup _aa],damage _aa,_aj,fuel _aa,_al,magazinesAmmo _aa,_ap]; // ["Vehicle",_ad,EPOCH_expiresVehicle,_am] call EPOCH_server_hiveSETEX; // //}; // }; _vehObj call EPOCH_server_save_vehicle; _vehObj call EPOCH_server_vehicleInit; another option I'm running on my Production server is to find a Kart or a Boat to replace it with my custom vehicle in the database. This works, but I'm running out of Karts :( _instanceID = call EPOCH_fn_InstanceID; diag_log format["WAI: _instanceID:%1",_instanceID]; diag_log format["WAI: EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; // _allowedVehicleList = EPOCH_allowedVehiclesList; // diag_log format["WAI: EPOCH_allowedVehiclesList:%1",_allowedVehicleList]; _vehObj = _this; _randomVehicleIndex = -1; if (EPOCH_VehicleSlotCount==0) then { if (!isNil "EPOCH_allowedVehiclesList") then { _countAllowedVeh=count EPOCH_allowedVehiclesList; _randomVehicleIndex=floor(random(_countAllowedVeh)); _randomVehicle=EPOCH_allowedVehiclesList select _randomVehicleIndex; _vehClass=_randomVehicle select 0; _velimit=_randomVehicle select 1; _vehicleCount={typeOf _x==_vehClass}count vehicles; if(_vehicleCount >=_velimit)then{ EPOCH_allowedVehiclesList deleteAt _randomVehicleIndex; } else { if(_vehicleCount==(_velimit-1))then{ EPOCH_allowedVehiclesList deleteAt _randomVehicleIndex; }; }; } else { _vehlist = nearestObjects [getMarkerPos "center", ["C_Rubberboat_EPOCH","C_Rubberboat_02_EPOCH","C_Rubberboat_03_EPOCH","C_Rubberboat_04_EPOCH""C_Boat_Civil_01_EPOCH","K01","K02","K03","K04","jetski_epoch"], 10000]; diag_log format["WAI: count _vehlist:%1 | _randomVehicle:%2",count _vehlist,_vehlist select 0]; _vehToDelete = _vehlist select 0; _randomVehicleIndex = _vehToDelete getVariable["VEHICLE_SLOT","ABORT"]; deleteVehicle _vehToDelete; }; }; _slot = ""; if !(EPOCH_VehicleSlots isEqualTo[]) then { _slot = EPOCH_VehicleSlots select 0; EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot]; EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots; publicVariable 'EPOCH_VehicleSlotCount'; } else { diag_log format["WAI: _slot = _randomVehicleIndex:%1",_randomVehicleIndex]; _slot = _randomVehicleIndex; }; if (str(_slot) != "") then { _vehObj setVariable["VEHICLE_SLOT",_slot,true]; private["_aa","_ab","_ac","_ad","_ae","_af","_ag","_ah","_ai","_aj","_ak","_al","_am","_an","_ao","_ap","_aq","_ar"]; if(!isNull _vehObj) then { _aa=_vehObj; // _ac=_vehObj getVariable["VEHICLE_SLOT","ABORT"]; // if(_ac !="ABORT")then{ _ad=format["%1:%2",(call EPOCH_fn_InstanceID),_slot]; _aj=[]; _ak=_aa call EPOCH_getHitpoints; { _aj pushBack(_aa getHitPointDamage _x); }forEach _ak; _wepsItemsCargo=weaponsItemsCargo _aa; if(isNil "_wepsItemsCargo")then{ _wepsItemsCargo=[]; }; _magsAmmoCargo=magazinesAmmoCargo _aa; if(isNil "_magsAmmoCargo")then{ _magsAmmoCargo=[]; }; _aq=[[],[]]; { _ar=_aq find(_x select 0); if(_ar >=0)then{ (_aq select 1)set[_ar,((_aq select 1)select _ar)+(_x select 1)];} else{(_aq select 0)pushBack(_x select 0);(_aq select 1)pushBack(_x select 1);}; }forEach _magsAmmoCargo; _al=[_wepsItemsCargo,_aq,getBackpackCargo _aa,getItemCargo _aa]; _ap=_aa getVariable["VEHICLE_TEXTURE",0]; _am=[typeOf _aa,[getposATL _aa,vectordir _aa,vectorup _aa],damage _aa,_aj,fuel _aa,_al,magazinesAmmo _aa,_ap]; ["Vehicle",_ad,EPOCH_expiresVehicle,_am] call EPOCH_server_hiveSETEX; //}; }; _vehObj call EPOCH_server_vehicleInit; }; This code from my zev mission ZEVMissionSaveToHive.sqf /* Save To Hive by Vampire This function attempts to save vehicles to the database if enabled when a mission ends. Usage: [Vehicle] */ _object = _this select 0; _class = typeOf _object; _dir = getDir _object; _pos = getPos _object; _worldspace = [_dir,_pos]; if (isNull _object OR !alive _object OR (damage _object) > .97) exitWith {}; _ranFuel = random 1; if (_ranFuel < .1) then {_ranFuel = .1;}; if (true) then { //The server is running DayZ Epoch, so we use the Epoch method. _uid = _worldspace call dayz_objectUID3; _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:", dayZ_instance, _class, 0, 0, _worldspace, [], [], 1, _uid]; _key call server_hiveWrite; //If the server is busy, it might not write on the first try //Because of this, we loop it until it works _done = false; _retry = 0; while {_retry < 10} do { sleep 0.3; _key = format["CHILD:388:%1:", _uid]; _result = _key call server_hiveReadWrite; _outcome = _result select 0; if (_outcome == "PASS") then { _oid = _result select 1; _object setVariable ["ObjectID", _oid, true]; _done = true; _retry = 11; } else { _done = false; _retry = _retry + 1; }; }; //Lets get it ready for the user _object setvelocity [0,0,1]; _object setFuel _ranFuel; _object setVehicleLock "UNLOCKED"; // clearWeaponCargoGlobal _object; // clearMagazineCargoGlobal _object; _object allowDamage false; _object setVariable ["lastUpdate", time]; _object setVariable ["CharacterID", "0", true]; PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor, _object]; sleep 1; _object call fnc_veh_ResetEH; PVDZE_veh_Init = _object; publicVariable "PVDZE_veh_Init"; [_object,"all"] spawn server_updateObject; _object allowDamage true; } else { //They are running a different DayZ Varient clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; sleep 3; //The Hive 999 call to publish the object _key = format["CHILD:999:select `id` from `vehicle` where `class_name` = '?' LIMIT 1:[""%1""]:", _class]; _data = "HiveEXT" callExtension _key; _result = call compile format ["%1", _data]; _status = _result select 0; if (_status == "CustomStreamStart") then { "HiveEXT" callExtension _key; _temp = _result select 1; if (_temp == 0) then { _data = "HiveEXT" callExtension format ["CHILD:999:Insert into vehicle (class_name, damage_min, damage_max, fuel_min, fuel_max, limit_min, limit_max, parts, inventory) values ('?',0,0,1.0,1.0,0,99,'',''):[""%1""]:", _class]; }; }; _data = "HiveEXT" callExtension format ["CHILD:999:Insert into world_vehicle (vehicle_id, world_id, worldspace, chance) values ((SELECT `id` FROM `vehicle` where `class_name` = '?' LIMIT 1), 1, '%3',1):[""%1"", ""%2""]:", _class, worldName, [_dir, _pos]]; _data = "HiveEXT" callExtension format["CHILD:999:Insert into instance_vehicle (world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage) values ((SELECT `id` FROM `world_vehicle` where `vehicle_id` = (SELECT `id` FROM `vehicle` where `class_name` = '%1' LIMIT 1) LIMIT 1), %3, '%2','[[[],[]],[[],[]],[[],[]]]','[]',1,0):[]:", _class, [_dir, _pos], dayZ_instance]; _key = format["CHILD:999:SELECT `id` FROM `instance_vehicle` ORDER BY `id` DESC LIMIT 1:[]:"]; _data = "HiveEXT" callExtension _key; _result = call compile format ["%1", _data]; _status = _result select 0; if (_status == "CustomStreamStart") then { _temp = _result select 1; if (_temp == 1) then { _data = "HiveEXT" callExtension _key; _result = call compile format ["%1", _data]; _status = _result select 0; }; }; //Lets finish it up for the player _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}]; _object setFuel _ranFuel; _object setVariable ["lastUpdate", time]; _object setVariable ["ObjectID", str(_status), true]; _object setVariable ["CharacterID", "7777", true]; [_object,"all"] spawn server_updateObject; }; Link to comment Share on other sites More sharing options...
0 shurix Posted May 23, 2015 Report Share Posted May 23, 2015 SadBoy, this is vehicle save script from Arma 2 DayZ Epoch. It is intended to run on MySQL database. I'm looking for a working version of the script for Redis database. Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 24, 2015 Author Report Share Posted May 24, 2015 SadBoy, this is vehicle save script from Arma 2 DayZ Epoch. It is intended to run on MySQL database. I'm looking for a working version of the script for Redis database. I have Arma 3 Epoch Chernarus with Redis database and this is script from my zev missions to keep vehicles in database! Link to comment Share on other sites More sharing options...
0 shurix Posted May 24, 2015 Report Share Posted May 24, 2015 Both scripts that I posted earlier save vehicles into the database. The problems start when all vehicle slots from epochconfig file are filled and there are no empty slots left. At that point the following script doesn't seem to work properly. EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1; EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit); _slot = EPOCH_VehicleSlots= select 0; diag_log format["WAI: _slot=%1",_slot]; _vehObj setVariable['VEHICLE_SLOT',_slot,true]; EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot]; EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots; publicVariable 'EPOCH_VehicleSlotCount'; This is an extract from my log file. As you can see I'm getting new slots created and the vehicles are actually being saved into the database. I know because I downloaded and opened my database file. 20:07:39 "WAI: Spawning a B_Heli_Light_01_armed_F with 10 units to be paradropped at [22268,19879.4,0.001]" 20:07:39 "WAI: found Turrets [] in B_Heli_Light_01_armed_F" 20:07:40 "WAI Perm Sector B: _countVeh5:0 _countVeh6:0" 20:07:40 "WAI Perm Sector B: Armed Vehicle spawned a B_G_Offroad_01_armed_F" 20:07:40 "WAI Perm Sector B: Repair Vehicle spawned a rhs_prp3_vdv" 20:07:40 "WAI: _instanceID:7545" 20:07:40 "WAI: initial EPOCH_VehicleSlotsLimit:267" 20:07:40 "WAI: initial EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: initial EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _slot=268" 20:07:40 "WAI: new EPOCH_VehicleSlotsLimit:268" 20:07:40 "WAI: new EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: new EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _instanceID:7545" 20:07:40 "WAI: initial EPOCH_VehicleSlotsLimit:268" 20:07:40 "WAI: initial EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: initial EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _slot=269" 20:07:40 "WAI: new EPOCH_VehicleSlotsLimit:269" 20:07:40 "WAI: new EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: new EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _instanceID:7545" 20:07:40 "WAI: initial EPOCH_VehicleSlotsLimit:269" 20:07:40 "WAI: initial EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: initial EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _slot=270" 20:07:40 "WAI: new EPOCH_VehicleSlotsLimit:270" 20:07:40 "WAI: new EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: new EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _instanceID:7545" 20:07:40 "WAI: initial EPOCH_VehicleSlotsLimit:270" 20:07:40 "WAI: initial EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: initial EPOCH_VehicleSlots:[]" 20:07:40 "WAI: _slot=271" 20:07:40 "WAI: new EPOCH_VehicleSlotsLimit:271" 20:07:40 "WAI: new EPOCH_VehicleSlotCount:0" 20:07:40 "WAI: new EPOCH_VehicleSlots:[]" 20:07:45 "WAI Perm: Sector B Ended At [22268,19879.4,0.001]" The weirdest thing happens after the restart. All newly created vehicles are gone! Does anyone have any ideas what may have caused it. Is there a hard limit in Epoch for number of vehicles? Link to comment Share on other sites More sharing options...
0 Silens Posted May 24, 2015 Report Share Posted May 24, 2015 The vehicles don't spawn after restart because epoch doesn't get the number of vehicles from the database. What it does is get the vehicle limit from your allowedvehicleslist in epochconfig, so if you have 100 vehicles there, it will only spawn vehicles 1-100 from the database, it doesn't know about your other vehicles in the database. Link to comment Share on other sites More sharing options...
0 shurix Posted May 25, 2015 Report Share Posted May 25, 2015 Thanks, mate! I'll have to keep my script that's converting Karts into other vehicles for a little while longer. Link to comment Share on other sites More sharing options...
0 shurix Posted May 25, 2015 Report Share Posted May 25, 2015 I made a couple of a3_epoch_server changes and it works ok now. At the bottom of EPOCH_load_vehicles.sqf I added EPOCH_VehicleSlotsLimit = count _allVehicles; and in the middle of server_init.sqf I changed the line that loads vehicles from the database effectively increasing the max number of vehicles to load up to the current storage limit (1500 in my case) diag_log "Epoch: Loading vehicles"; //_workload2=EPOCH_VehicleSlotsLimit spawn EPOCH_load_vehicles; _workload2=EPOCH_StorageSlotsLimit spawn EPOCH_load_vehicles; I'm using the following script to save mission vehicles into the database: private ['_velimit','_isAir','_isShip','_position','_dir','_marker','_vehObj','_slot','_vehClass','_colors','_color','_config','_selections','_textures','_forEachIndex','_textureSelectionIndex','_vehicleFound','_randomVehicleIndex','_randomVehicle','_vehicleCount','_count']; _instanceID = call EPOCH_fn_InstanceID; diag_log format["WAI: _instanceID:%1",_instanceID]; diag_log format["WAI: initial EPOCH_VehicleSlotsLimit:%1",EPOCH_VehicleSlotsLimit]; diag_log format["WAI: initial EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: initial EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; _vehObj = _this; _vehObj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _vehObj setVariable["LAST_CHECK",1000000000000]; _vehClass = typeOf _vehObj; EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1; EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit); _slot = EPOCH_VehicleSlots select 0; diag_log format["WAI: _slot=%1",_slot]; _vehObj setVariable['VEHICLE_SLOT',_slot,true]; EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot]; EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots; publicVariable 'EPOCH_VehicleSlotCount'; diag_log format["WAI: new EPOCH_VehicleSlotsLimit:%1",EPOCH_VehicleSlotsLimit]; diag_log format["WAI: new EPOCH_VehicleSlotCount:%1",EPOCH_VehicleSlotCount]; diag_log format["WAI: new EPOCH_VehicleSlots:%1",EPOCH_VehicleSlots]; _config = (configFile >> 'CfgVehicles' >> _vehClass >> 'availableColors'); if(isArray(_config)) then{ _textureSelectionIndex = configFile >> 'CfgVehicles' >> _vehClass >> 'textureSelectionIndex'; _selections = if(isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] }; _colors = getArray(_config); _textures = _colors select 0; _color = floor (random (count _textures)); _count = (count _colors)-1; { if(_count >= _forEachIndex) then { _textures = _colors select _forEachIndex; }; _vehObj setObjectTextureGlobal [_x, (_textures select _color)]; } forEach _selections; _vehObj setVariable['VEHICLE_TEXTURE',_color]; }; _vehObj call EPOCH_server_setVToken; clearWeaponCargoGlobal _vehObj; clearMagazineCargoGlobal _vehObj; clearBackpackCargoGlobal _vehObj; clearItemCargoGlobal _vehObj; // if(!isNull _vehObj) then { // _aa=_vehObj; // // _ac=_vehObj getVariable["VEHICLE_SLOT","ABORT"]; // // if(_ac !="ABORT")then{ // _ad=format["%1:%2",_instanceID,_slot]; // _aj=[]; // _ak=_aa call EPOCH_getHitpoints; // { // _aj pushBack(_aa getHitPointDamage _x); // }forEach _ak; // _wepsItemsCargo=weaponsItemsCargo _aa; // if(isNil "_wepsItemsCargo")then{ // _wepsItemsCargo=[]; // }; // _magsAmmoCargo=magazinesAmmoCargo _aa; // if(isNil "_magsAmmoCargo")then{ // _magsAmmoCargo=[]; // }; // _aq=[[],[]]; // { // _ar=_aq find(_x select 0); // if(_ar >=0)then{ // (_aq select 1)set[_ar,((_aq select 1)select _ar)+(_x select 1)];} // else{(_aq select 0)pushBack(_x select 0);(_aq select 1)pushBack(_x select 1);}; // }forEach _magsAmmoCargo; // _al=[_wepsItemsCargo,_aq,getBackpackCargo _aa,getItemCargo _aa]; // _ap=_aa getVariable["VEHICLE_TEXTURE",0]; // _am=[typeOf _aa,[getposATL _aa,vectordir _aa,vectorup _aa],damage _aa,_aj,fuel _aa,_al,magazinesAmmo _aa,_ap]; // ["Vehicle",_ad,EPOCH_expiresVehicle,_am] call EPOCH_server_hiveSETEX; // //}; // }; _vehObj call EPOCH_server_save_vehicle; _vehObj call EPOCH_server_vehicleInit; Link to comment Share on other sites More sharing options...
0 Sneakydude Posted May 27, 2015 Report Share Posted May 27, 2015 Was working before, but now just cant add it. They going to be deleted after player come close add vehicle: if (isServer) then { private ["_objs"]; _objs = [ {"O_MRAP_02_hmg_F",{1070.57,2515.65,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"O_MRAP_02_hmg_F",{1065.77,2513.81,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"I_MRAP_03_hmg_F",{1060.96,2511.98,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"O_MRAP_02_F",{1056.16,2510.14,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"B_MRAP_01_hmg_F",{1051.36,2508.31,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"Cha_BTR60_TK",{1046.55,2506.47,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"I_MRAP_03_hmg_F",{1041.75,2504.64,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"I_Heli_Transport_02_EPOCH",{1083.95,2520.02,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false}, {"B_Heli_Light_01_EPOCH",{1098.56,2524.64,0},339.091,{{-0.356886,0.934148,0},{0,0,1}},false} ]; { private ["_obj"]; _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; if (_x select 4) then { _obj setDir (_x select 2); _obj setPos (_x select 1); _obj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _obj setVariable["LAST_CHECK",1000000000000]; _obj call EPOCH_server_setVToken; addToRemainsCollector[_obj]; clearWeaponCargoGlobal _obj; clearMagazineCargoGlobal _obj; clearBackpackCargoGlobal _obj; clearItemCargoGlobal _obj; } else { _obj setPosATL (_x select 1); _obj setVectorDirAndUp (_x select 3); _obj setVariable["LASTLOGOUT_EPOCH",1000000000000]; _obj setVariable["LAST_CHECK",1000000000000]; _obj call EPOCH_server_setVToken; addToRemainsCollector[_obj]; clearWeaponCargoGlobal _obj; clearMagazineCargoGlobal _obj; clearBackpackCargoGlobal _obj; clearItemCargoGlobal _obj; }; } foreach _objs; }; FIXED: just add sleep 60; before run script Are you trying to run this static vehicle spawn? every time I tried this the vehicle would disappear as I got to them. This might help in custom missions having the vehicle load in the area you want it to be at. Like a placeholder. I don't want epoch to randomize some vehicles I have spawning. I want them to load by a base I am designing. Is this basically what you have tried to do? P.S and I love your ZevMissions :) just not sure what exactly it did other then the convoy routing from West to East. Thanks Sneaks Link to comment Share on other sites More sharing options...
0 SadBoy1981 Posted May 27, 2015 Author Report Share Posted May 27, 2015 Are you trying to run this static vehicle spawn? every time I tried this the vehicle would disappear as I got to them. This might help in custom missions having the vehicle load in the area you want it to be at. Like a placeholder. I don't want epoch to randomize some vehicles I have spawning. I want them to load by a base I am designing. Is this basically what you have tried to do? P.S and I love your ZevMissions :) just not sure what exactly it did other then the convoy routing from West to East. Thanks Sneaks code what i post working when i add sleep 60; Vehicles respawn after restart same place Sneakydude 1 Link to comment Share on other sites More sharing options...
0 spartan Posted October 17, 2015 Report Share Posted October 17, 2015 Just trying your sleep 60; solution to this problem as I am getting the same error in my rpt ie ;-Error in expression <(_obj isKindOf "Ship"))then{ _obj call EPOCH_server_setVToken;};} foreach _ob> Error position: <EPOCH_server_setVToken;};} foreach _ob> Error Undefined variable in expression: epoch_server_setvtokenYou say you have put sleep 60; in before executing script so I have tried it before the private ["_objs"]; line in the code and also on the first line of the fm_init.sqf but both locations have not solved the issue so could you be more specific on where you included the sleep 60 delay ? Link to comment Share on other sites More sharing options...
Question
SadBoy1981
Was working before, but now just cant add it. They going to be deleted after player come close
add vehicle:
FIXED: just add sleep 60; before run script
Link to comment
Share on other sites
26 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now