[Epoch|Fix] Salvage Vehicle Tires and Damaged Parts

SchwEde

OpenDayZ Rockstar!
============= [Fix] Salvage Vehicle Tires and Damaged Parts ==============
What it does....

Fixing the Salvage Vehicle Script.
Some Admins know the issue that it is possible to remove 8 Tires from any Cars/ATVs or it is not possible to remove fully repaired Tires.
This thing should fix this Problem.

!!WARNING!!
An Epoch Dev said this about the Damage part:
To prevent issues with certain vehicles that do not take tire damage, thus allowing you to take an unlimited amount.
Source: http://epochmod.com/forum/index.php?/topic/10284-why-is-salvage-vehicles-not-complete/#entry71890

I did not tested this, but you know now about this issue. Maybe someone can tell us which vehicles has invincible so it is possible to disable salvaging tires from this vehicles.
END OF THE WARNING

What you need:

custom fn_selfaction.sqf
fixed salvage_vehicles.sqf

How to Install:

fn_selfaction:

find this part:
Code:
_menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];

and change the path to the salvage_vehicles.sqf:
_menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "path_to\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];

fixed salvage_vehicles.sqf
Code:
//Hitpoint and Damage fix by SchwEde
private ["_part","_cancel","_color","_percent","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints"];

_vehicle = _this select 3;

{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
// dayz_myCursorTarget = _vehicle;

if (((typeof _vehicle) isKindOf  "Car") and !((typeof _vehicle) isKindOf  "Truck")) then {
    _hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitFuel","HitEngine"];
    };
   
 if (((typeof _vehicle) isKindOf  "Motorcycle")) then {
_hitpoints = ["HitGlass1","HitGlass2","HitFWheel","HitBWheel","HitFuel","HitEngine"];
};
   
if ((typeof _vehicle) isKindOf  "Truck") then {
_hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitLMWheel","HitRMWheel","HitFuel","HitEngine"];
};


// _allFixed = true;
//_hitpoints = _vehicle call vehicle_getHitpoints; // old Hitpoints

// diag_log format["DEBUG SALVAGE: %1", _hitpoints];
{        
    _damage = [_vehicle,_x] call object_getHit;
    _part = "PartGeneric";

    //change "HitPart" to " - Part" rather than complicated string replace
    _cmpt = toArray (_x);
    _cmpt set [0,20];
    _cmpt set [1,toArray ("-") select 0];
    _cmpt set [2,20];
    _cmpt = toString _cmpt;

    if(["Engine",_x,false] call fnc_inString) then {
        _part = "PartEngine";
    };
    
    if(["HRotor",_x,false] call fnc_inString) then {
        _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL
    };

    if(["Fuel",_x,false] call fnc_inString) then {
        _part = "PartFueltank";
    };

    if(["Wheel",_x,false] call fnc_inString) then {
        _part = "PartWheel";
    };
    
    if(["Glass",_x,false] call fnc_inString) then {
        _part = "PartGlass";
    };

    // allow removal of any lightly damaged parts
    if (_damage <= 0.95 and _damage >= 0) then {
    
        // Do not allow removal of engine || fueltanks
        if( _part == "PartGlass" || _part == "PartWheel" ) then {

            _color = "color='#ffff00'"; //yellow
            if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
            if (_damage >= 0.75) then {_color = "color='#ff0000'";}; //red

            _percent = round(_damage*100);
            _string = format["<t %2>Remove%1 (%3 %4)</t>",_cmpt,_color,_percent,"%"]; //Remove - Part
            _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
            s_player_repairActions set [count s_player_repairActions,_handle];
        
        };
    };

} count _hitpoints;

if(count _hitpoints > 0 ) then {

    _cancel = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_CANCEL", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false, "",""];
    s_player_repairActions set [count s_player_repairActions,_cancel];
    s_player_repair_crtl = 1;
};

If you like to change the max salvage damage just change this line:

if (_damage <= 0.95 [<<max damage] and _damage >= 0 [<< min damage]) then {

Credits:
I dont take Credits for the Salvage Script, just for the Fixes
Guy(s) who made this Script
 
Last edited:
  • Like
Reactions: chi

SchwEde

OpenDayZ Rockstar!
Update: Motorcycles added to the Script.

Important: You will have to do the same changes in the repair script!
I'm not gonna show how to since this is the same way.
Also probably not gonna update this script to all vehicles, because i dont need all of them for my purpose, should not be a problem to update it for you likings though ;)
 
Top