davidoss 552 Posted December 17, 2016 Hi. I write a simple vehicle service code: if (isServer) then { null = [thislist select 0] spawn { params ["_veh"]; private _turrets = count (allTurrets _veh); private _gethit = getAllHitPointsDamage _veh; private _fuel = ((fuel _veh) < 1); private _damage = _gethit select 2; private _damaged = ((count (_damage select {_x > 0})) > 0); private _proceded = false; sleep 2; if (_damaged) then { (vehicle _veh) setDamage 0; _proceded = true; }; if (_fuel) then { null = [_veh, 1] remoteExecCall ["setFuel", _veh, false]; _proceded = true; }; if !(_turrets isEqualTo 0) then { null = [_veh, 1] remoteExecCall ["setVehicleAmmoDef", _veh, false]; // not working _proceded = true; }; if (_proceded) then { [getPos _veh, "vehrepaired", "Vehicle",crew _veh] call fnc_sendNotif; }; }; }; I do not knew really why, i think that there is going about turret locality. How to write this properly? Share this post Link to post Share on other sites
theend3r 83 Posted December 17, 2016 Using veh setFuel 1; veh setDamage 0; veh setVehicleAmmo 1; would work just as well. Setting damage to 0 if it's already 0 isn't a problem. This looks like a university approach to problems, aka why make it simple when it can be made complicated. :) Share this post Link to post Share on other sites
davidoss 552 Posted December 17, 2016 Not so easy, the trigger contain this code exist only server side Share this post Link to post Share on other sites
Larrow 2821 Posted December 17, 2016 Maybe something like.. { if !( turretLocal _x ) then { _null = [_veh, 1] remoteExecCall ["setVehicleAmmoDef", turretOwner _x, false]; }else{ _veh setVehicleAmmoDef 1; }; }forEach allTurrets _veh; Most likely dont even need the IF statement as remoteExec should be smart enough to only apply it locally without any network traffic seeing as this is on the server. Share this post Link to post Share on other sites
davidoss 552 Posted December 18, 2016 Thanks works great Share this post Link to post Share on other sites
Janez 530 Posted July 10, 2017 On 12/18/2016 at 1:45 AM, davidoss said: Thanks works great Hi, this looks just like something I could use. Can you please post the final form and an example of how to use it? Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted July 10, 2017 null = [_veh, 1] remoteExecCall ["setVehicleAmmoDef",(crew _veh), false]; Share this post Link to post Share on other sites
Janez 530 Posted July 11, 2017 Can you tell me how to run this though? Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted July 11, 2017 exactly how it was run in the OP Share this post Link to post Share on other sites