Repair all vehicles on restart?

Sure is pal!

in dayz_server.pbo\system\server_monitor.sqf find the line:
Code:
if (_object isKindOf "AllVehicles") then {

This is the code snippet we are interested in:
Code:
              if (_object isKindOf "AllVehicles") then {
                    {
                        _selection = _x select 0;
                        _dam = _x select 1;
                        if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
                        [_object,_selection,_dam] call object_setFixServer;
                    } forEach _hitpoints;
                    _object setvelocity [0,0,1];
                    _object setFuel _fuel;
                    _object call fnc_vehicleEventHandler;
                };

Simply change the code to the following:
Code:
if (_object isKindOf "AllVehicles") then {
    _object setFuel _fuel;
    _object setVelocity [0,0,1];
    _object call fnc_vehicleEventHandler;
};

you can also do the following for fully fueld vehicles too:
Code:
if (_object isKindOf "AllVehicles") then {
    _object setFuel 1;
    _object setVelocity [0,0,1];
    _object call fnc_vehicleEventHandler;
};


please note:
i made these code changes without any testing (literately changed it here in the text editor for the forum post), so it might contain errors :)
 
Its not what your adding, its whats taken away...

You need the fuel and velocity.

The fuel, well that gives it fuel
The velocity just twitches the vehicle out of the floor a little to make it drivable in certain circumstances.
 
Looks fine...

Try this perhaps:
Code:
              if (_object isKindOf "AllVehicles") then {
                    {
                        _selection = _x select 0;
                        _dam = 0;
                        if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
                        [_object,_selection,_dam] call object_setFixServer;
                    } forEach _hitpoints;
                    _object setvelocity [0,0,1];
                    _object setFuel _fuel;
                    _object call fnc_vehicleEventHandler;
                };
 
No, however the code path looks fine.

The last code should not have deleted your vehicles from the database, if anything it just would have not loaded them into the game if an error existed in the sqf.
 
Right just tested it worked fine ish but its the the "fuel 1" that fucks up the vehciles so they repair when you scroll on them but it doesnt do fuel?
 
You have set fuel to 1?

So, do you have this at the moment?
Code:
              if (_object isKindOf "AllVehicles") then {
                    {
                        _selection = _x select 0;
                        _dam = 0;
                        if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
                        [_object,_selection,_dam] call object_setFixServer;
                    } forEach _hitpoints;
                    _object setvelocity [0,0,1];
                    _object setFuel 1;
                    _object call fnc_vehicleEventHandler;
                };

Ensure it looks like this and double check that you have the semi colons in all the places that need them :D
 
To do it via database, use this SQL script:

UPDATE instance_vehicle SET fuel=1 (Refuels all vehicles)
UPDATE instance_vehicle SET damage=0, parts='[]' WHERE damage>0 (repairs all vehicles)
 
Ah I keep forgetting most people here are private servers, sorry about that.
My way is for a public hive server (even know it would work for a private one also)
 
Sorry to reopen this old topic but does anyone have a CURRENT solution for Auto Repairing ALL vehicles after every restart? I dont want players to have to repair the vehicles manually.

Im currently using DayZ Chernarus 1.8.03 private server. Thanks!
 
Back
Top