Luft08 27 Posted February 20, 2022 I made a super simple mission that has four helicopters named raptor_1, raptor_2, raptor_3 and raptor_4. I populated the main Tanoa island with opfor vehicles and have them running around. The players each take a helicopter and try to destroy as many vehicles as they can then come back and land on a pad to get rearmed, refueled and repaired. Everything works in single player mode but when I put the mission on a dedicated server the rearming, refueling and repair process does not work. The helopads each have a trigger: Type:None, Activation: Blufor, Activation Type: present. The condition field has: (raptor_1 in thisList || raptor_2 in thisList || raptor_3 in thisList || raptor_4 in thisList); The on Activation field has: [thisTrigger] remoteExecCall ["LFT_RaptorMaintenance"]; // Note I tried [thisTrigger] call LFT_RaptorMaintenance; but it didn't work either. The LFT_RaptorMaintenance function: params ["_trigger"]; if(raptor_1 inArea _trigger) then {[raptor_1] call LFT_VehicleMaintenance;}; if(raptor_2 inArea _trigger) then { [raptor_2] call LFT_VehicleMaintenance;}; if(raptor_3 inArea _trigger) then { [raptor_3] call LFT_VehicleMaintenance;}; if(raptor_4 inArea _trigger) then { [raptor_4] call LFT_VehicleMaintenance;}; The LFT_VehicleMaintenance function: params ["_vehicle"]; _vehicle setVehicleAmmo 1; _vehicle setFuel 1; _vehicle setDamage 0; How do I make this work on a dedicated server. As I said, it does work in single player. Thanks Share this post Link to post Share on other sites
rowdied 44 Posted February 20, 2022 51 minutes ago, Luft08 said: How do I make this work on a dedicated server. As I said, it does work in single player. Thanks Try this script I use which works on dedicated server. I cannot remember who made the script so this is not my work and props to whoever made this. Put this in trigger name the trigger airrepair type = none activation = blufor activation type = present repeatable = yes condition = (getpos ((list airrepair1) select 0) select 2) <= 1 on activation = _xhandle= ((list airrepair1) select 0) execVM "x_reload.sqf"; name of script is; x_reload.sqf _object = _this; _type = typeOf _object; x_reload_time_factor = 4; _object setVehicleAmmo 1; _object vehicleChat format ["Servicing %1... Please stand by...", _type]; _magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines"); if (count _magazines > 0) then { _removed = []; { if (!(_x in _removed)) then { _object removeMagazines _x; _removed = _removed + [_x]; }; } forEach _magazines; { _object vehicleChat format ["Reloading %1", _x]; sleep x_reload_time_factor; _object addMagazine _x; } forEach _magazines; }; _count = count (configFile >> "CfgVehicles" >> _type >> "Turrets"); if (_count > 0) then { for "_i" from 0 to (_count - 1) do { scopeName "xx_reload2_xx"; _config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i; _magazines = getArray(_config >> "magazines"); _removed = []; { if (!(_x in _removed)) then { _object removeMagazines _x; _removed = _removed + [_x]; }; } forEach _magazines; { _object vehicleChat format ["Reloading %1", _x]; sleep x_reload_time_factor; _object addMagazine _x; sleep x_reload_time_factor; } forEach _magazines; _count_other = count (_config >> "Turrets"); if (_count_other > 0) then { for "_i" from 0 to (_count_other - 1) do { _config2 = (_config >> "Turrets") select _i; _magazines = getArray(_config2 >> "magazines"); _removed = []; { if (!(_x in _removed)) then { _object removeMagazines _x; _removed = _removed + [_x]; }; } forEach _magazines; { _object vehicleChat format ["Reloading %1", _x]; sleep x_reload_time_factor; _object addMagazine _x; sleep x_reload_time_factor; } forEach _magazines; }; }; }; }; _object setVehicleAmmo 1; // Reload turrets / drivers magazine sleep x_reload_time_factor; _object vehicleChat "Repairing..."; _object setDamage 0; sleep x_reload_time_factor; _object vehicleChat "Refueling..."; while {fuel _object < 0.99} do { //_object setFuel ((fuel _vehicle + 0.1) min 1); _object setFuel 1; sleep 0.01; }; sleep x_reload_time_factor; _object vehicleChat format ["%1 is ready...", _type]; if (true) exitWith {}; Share this post Link to post Share on other sites
_foley 192 Posted February 20, 2022 At which point does it fail? Let us know if the trigger is getting activated, is your function actually being called. Share this post Link to post Share on other sites
Luft08 27 Posted February 20, 2022 Good idea. Because it is running on the server I'll have to put in some logging messages to determine that. Share this post Link to post Share on other sites
Luft08 27 Posted February 20, 2022 Thanks rowdied, I'll look over the code but what I really want is to understand why my code fails on the server. Share this post Link to post Share on other sites
Luft08 27 Posted February 20, 2022 1 hour ago, _foley said: At which point does it fail? Let us know if the trigger is getting activated, is your function actually being called. I placed diag_Log messages at the beginning of each function. Everything is being called so I assume that the code in the LFT_VehicleMaintenance function is failing when run on a dedicated server. params ["_vehicle"] _vehicle setVehicleAmmo 1; _vehicle setFuel 1; _vehicle setDamage 0; Share this post Link to post Share on other sites
_foley 192 Posted February 20, 2022 Um, that function should run where vehicle is local, i.e. on pilot's machine, not on dedi. setVehicleAmmo, setFuel - these commands take local arguments. Is your trigger configured to be server side only? Share this post Link to post Share on other sites
Luft08 27 Posted February 21, 2022 Nope, but maybe I need to put in a few more logging statements to see what's happening on the client side. Share this post Link to post Share on other sites
Harzach 2517 Posted February 21, 2022 Where and how are you defining these functions? Locality seems to be the problem. Share this post Link to post Share on other sites
Luft08 27 Posted February 21, 2022 18 minutes ago, Harzach said: Where and how are you defining these functions? Locality seems to be the problem. Each function is in it's own sqf file and I compile the files from the initServer.sqf file: if(!isServer) exitWith {}; private _year = 2035; private _month = 7; private _day = 19; private _hour = 6 + floor random 10; private _min = floor random 60; setDate [_year, _month, _day, _hour, _min]; private _handle = [] execVM "scripts\initVariables.sqf"; waitUntil {scriptDone _handle}; LFT_RaptorMaintenance = compileFinal preprocessfilelinenumbers "scripts\LFT_RaptorMaintenance.sqf"; LFT_VehicleMaintenance = compileFinal preprocessfilelinenumbers "scripts\LFT_VehicleMaintenance.sqf"; LFT_MilitaryTraffic = compileFinal preprocessfilelinenumbers "scripts\LFT_MilitaryTraffic.sqf"; LFT_GetRandomRoadSeg = compileFinal preprocessfilelinenumbers "scripts\LFT_GetRandomRoadSeg.sqf"; LFT_SetWaypoint = compileFinal preprocessfilelinenumbers "scripts\LFT_SetWaypoint.sqf"; LFT_GetRoadDirection = compileFinal preprocessfilelinenumbers "scripts\LFT_GetRoadDirection.sqf"; [] call LFT_MilitaryTraffic; serverReady = true; publicVariable "serverReady"; Share this post Link to post Share on other sites
Harzach 2517 Posted February 21, 2022 All of those functions exist on the server only, which is why they work in SP and hosted, but not on dedi. You need to PV all of them. 1 1 Share this post Link to post Share on other sites
Luft08 27 Posted February 21, 2022 2 hours ago, Harzach said: All of those functions exist on the server only, which is why they work in SP and hosted, but not on dedi. You need to PV all of them. Doh! Thanks! 😁 Share this post Link to post Share on other sites
pierremgi 4892 Posted February 21, 2022 More than that, each time you read a command is LA GE (so argument local , like setFuel) , that means : an argument that is processed on the machine where the command is executed So, no need to remoteExec everywhere, but where the vehicle (object) is owned. If a player is driving a vehicle, this player is the owner, and setFuel should be run on his PC. If your script exists everywhere, the filter is simple: if (local _vehicle) then {_vehicle setFuel 1}; // you can skip this condition, running setFuel everywhere. It will work on due PC, useless but throwing no error anywhere else. Not sure that makes a great difference for such basic command in term of performance. If your script runs on server, then: [_vehicle,1] remoteExec ["setFuel",_vehicle] 4 Share this post Link to post Share on other sites