Vehicle Stripping 1.8

hey dudes,

there is already a build in script to strip vehicles. just tested it on my test server and everything is fine.
so, here we go:
you need the
"fn_selfActions.sqf" from "dayz_code.pbo\compile\" if you dont have one already.
you only need to change the repair code:

Code:
    //Repairing Vehicles
    if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
        if (s_player_repair_crtl < 0) then {
            dayz_myCursorTarget = _cursorTarget;
            _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            //_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            s_player_repairActions set [count s_player_repairActions,_menu];
            //s_player_repairActions set [count s_player_repairActions,_menu1];
            s_player_repair_crtl = 1;
        } else {
            {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
            s_player_repair_crtl = -1;
        };
    };


to this:

Code:
    //Repairing Vehicles
    if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
        if (s_player_repair_crtl < 0) then {
            dayz_myCursorTarget = _cursorTarget;
            _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            s_player_repairActions set [count s_player_repairActions,_menu];
            s_player_repairActions set [count s_player_repairActions,_menu1];
            s_player_repair_crtl = 1;
        } else {
            {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
            s_player_repair_crtl = -1;
        };
    };

as you can see, i only took out the "//" für _menu1 and "s_player_repairActions".
Now you get the option to "Salvage Vehicle"......

have fun ! ;)
 
Replace salvage_vehicle.sqf with this:
Code:
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_x"];
 
_vehicle = cursorTarget;
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = _vehicle;
 
_hitpoints = _vehicle call vehicle_getHitpoints;
 
{
    _damage = [_vehicle,_x] call object_getHit;
    _part = "PartGeneric";
 
    _cmpt = toArray (_x);
    _cmpt set [0,20];
    _cmpt set [1,toArray ("-") select 0];
    _cmpt set [2,20];
    _cmpt = toString _cmpt;
       
    _skip = true;
 
    //restrict what parts can be taken off the vehicle
    if( _skip and _x == "HitLFWheel" ) then {
        _skip = false; _part = "PartWheel";
    };
       
    if( _skip and _x == "HitRFWheel" ) then{
        _skip = false; _part = "PartWheel";
    };
   
    if( _skip and _x == "HitLBWheel" ) then {
        _skip = false; _part = "PartWheel";
    };
   
    if( _skip and _x == "HitRBWheel" ) then {
        _skip = false; _part = "PartWheel";
    };
   
    if( _skip and _x == "HitGlass1" ) then {
        _skip = false; _part = "PartGlass";
    };
   
    if( _skip and _x == "HitGlass2" ) then {
        _skip = false; _part = "PartGlass";
    };
   
    if( _skip and _x == "HitGlass3" ) then {
        _skip = false; _part = "PartGlass";
    };
   
    if( _skip and _x == "HitGlass4" ) then {
        _skip = false; _part = "PartGlass";
    };
   
    if( _skip and _x == "HitGlass5" ) then {
        _skip = false; _part = "PartGlass";
    };
   
    if( _skip and _x == "HitGlass6" ) then {
        _skip = false; _part = "PartGlass";
    };
   
    if( _skip and _x == "HitHRotor" ) then {
        _skip = false; _part = "PartVRotor";
    };
 
 
    if (!_skip ) then {
    //get every damaged part no matter how tiny damage is!
    _damagePercent = str(round((1 - _damage) * 100))+"%";
    if (_damage < 1) then {
        _color = "color='#ffff00'"; //yellow
        if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
        if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
        _string = format[localize "str_actions_repair_01",_cmpt,_damagePercent];
        _string = format["<t %1>%2</t>",_color,_string]; //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];
    };
};
 
} forEach _hitpoints;
 
 
if (count _hitpoints > 0 ) then {
    _cancel = dayz_myCursorTarget addAction [localize "str_actions_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;
};

I removed the Engine and FuelTank on purpose, since this produces a lot of problems and dupe opportunities. Wheels and Windscreens are fine IMO, simply because they are actually removed from the vehicle.
 
oh :D just took a look of that little bug, but as i see, there was also someone else taking a look ;)

i have done this how you did, but ive addet the a block for bikes.

Code:
_invalidVehicle = (_vehicle isKindOf "Bike");
if( !_invalidVehicle ) then {
.....};

dont know if still necessary, but now there shouldnt be problems with bikes.
 
hey dudes,

there is already a build in script to strip vehicles. just tested it on my test server and everything is fine.
so, here we go:
you need the
"fn_selfActions.sqf" from "dayz_code.pbo\compile\" if you dont have one already.
you only need to change the repair code:

Code:
    //Repairing Vehicles
    if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
        if (s_player_repair_crtl < 0) then {
            dayz_myCursorTarget = _cursorTarget;
            _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            //_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            s_player_repairActions set [count s_player_repairActions,_menu];
            //s_player_repairActions set [count s_player_repairActions,_menu1];
            s_player_repair_crtl = 1;
        } else {
            {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
            s_player_repair_crtl = -1;
        };
    };


to this:

Code:
    //Repairing Vehicles
    if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
        if (s_player_repair_crtl < 0) then {
            dayz_myCursorTarget = _cursorTarget;
            _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            s_player_repairActions set [count s_player_repairActions,_menu];
            s_player_repairActions set [count s_player_repairActions,_menu1];
            s_player_repair_crtl = 1;
        } else {
            {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
            s_player_repair_crtl = -1;
        };
    };

as you can see, i only took out the "//" für _menu1 and "s_player_repairActions".
Now you get the option to "Salvage Vehicle"......

have fun ! ;)


wow you're right. the code is already there. thanks :D

working, besides the duping, but duping is better than just not having salvage at all.
 
its glitched as hell with the new removal function (most likely why they commentet it out) however you can fix the old repair code in fn_selfActions very easily by adding this:
PHP:
    private ["_part"];
right above this:
Code:
    //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;
 
its glitched as hell with the new removal function (most likely why they commentet it out) however you can fix the old repair code in fn_selfActions very easily by adding this:
PHP:
    private ["_part"];
right above this:
Code:
    //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;

I don't seem to have any of that in my fn_selfactions.sqf..... maybe Im misunderstanding you're instructions?
 
depending on what version of dayz you are running, then you most likely either removed this part yourself or it was already removed in your version ... if you want it back like this, then go back and check earlier versions of the salvage script
 
gotcha, thanks I'll have a look. One bizarre thing started happening, the parts seemed infinite at first (able to remove the same part over and over again) and then suddenly, without changing anything they weren't (removing the part now actually removes the part from the car) isn't that odd?
 
When enabling this on my server every part just says "Salvage Part'. I didn't use a custom salvage_vehicle.sqf, though. Merely uncommented the menu.
 
Back
Top