using old ss_remove.sqf on epoch taviana 1.0.2.5 (since imo default remove is flawed)

Halvhjearne

Valued Member!
well i was getting rather annoyed by the fact that you either couldnt remove parts from unreconized vehicles or i could choose to use a flawed script allowing players to remove windows from bikes so i got to thinking, how can i fix this with the least efford and i knew the old ss_remove worked on overwatch, so why not just use that and disable the default?

i thought this would be an easy task, however i had to fiddle with it for a few hours and dig up the a really old ss_remove.sqf and change some calls ... but it seems to work like this:

first in fn_selfactions find
Code:
    //Repairing Vehicles
now above this add this:
Code:
// Remove Parts from Vehicles - By SilverShot.
    if( !_isMan and _canDo and _hasToolbox and (silver_myCursorTarget != cursorTarget) and cursorTarget isKindOf "AllVehicles" and (getDammage cursorTarget < 0.95) ) then {
    _vehicle = cursorTarget;
    _invalidVehicle = (_vehicle isKindOf "Motorcycle") or (_vehicle isKindOf "Tractor"); //or (_vehicle isKindOf "ATV_US_EP1") or (_vehicle isKindOf "ATV_CZ_EP1");
    if( !_invalidVehicle ) then {
    {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
    s_player_removeActions = [];
    silver_myCursorTarget = _vehicle;
 
    _hitpoints = _vehicle call vehicle_getHitpoints;
 
    {
    _damage = [_vehicle,_x] call object_getHit;
 
    if( _damage < 0.15 ) then {
//    private ["_hitpoints","_damage","_part","_cmpt","_damagePercent","_color","_string","_handle"];
    //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;
 
    _skip = true;
    if( _skip and _x == "HitFuel" ) then { _skip = false; _part = "PartFueltank"; _cmpt = _cmpt + "tank"};
    if( _skip and _x == "HitEngine" ) then { _skip = false; _part = "PartEngine"; };
    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 {
    _string = format["<t color='#0096ff'>Remove%1</t>",_cmpt,_color]; //Remove - Part
    _handle = silver_myCursorTarget addAction [_string, "fixes\ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
    s_player_removeActions set [count s_player_removeActions,_handle];
    };
    };
 
    } forEach _hitpoints;
    };
    };

now find this:
Code:
            _menu1 = dayz_myCursorTarget addAction ["Salvage Vehicle", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
and change to:
Code:
//            _menu1 = dayz_myCursorTarget addAction ["Salvage Vehicle", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
then find:
Code:
    //Engineering
and above that add this:
Code:
//Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;

now make a folder called fixes and make a text file called ss_remove.sqf and put this in it:

Code:
// Remove Parts from Vehicles - By SilverShot.
 
private["_vehicle","_part","_hitpoint","_type","_selection","_array"];
_id = _this select 2;
_array =_this select 3;
_vehicle =_array select 0;
_part =_array select 1;
_hitpoint = _array select 2;
_type = typeOf _vehicle;
 
_hasToolbox ="ItemToolbox" in items player;
 
_nameType =getText(configFile >> "cfgVehicles" >> _type >> "displayName");
_namePart =getText(configFile >> "cfgMagazines" >> _part >> "displayName");
 
if (_hasToolbox) then {
if (getDammage _vehicle < 2) then {
 
_damage = [_vehicle,_hitpoint] call object_getHit;
 
if( _damage < 0.20 ) then {
_result = [player,_part] call BIS_fnc_invAdd;
if (_result) then {
 
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
s_player_removeActions = [];
silver_myCursorTarget = objNull;
 
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
if( _hitpoint == "HitEngine" or _hitpoint == "HitFuel" ) then {
PVDZE_veh_SFix = [_vehicle,_selection,0.89];
} else {
PVDZE_veh_SFix = [_vehicle,_selection,1];
};
publicVariable "PVDZE_veh_SFix";
if (local _vehicle) then {
PVDZE_veh_SFix call object_setFixServer;
};
 
player playActionNow "Medic";
sleep 1;
 
[player,"repair",0,false] call dayz_zombieSpeak;
null = [player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
_vehicle setvelocity [0,0,1];
 
cutText [format["You have successfully taken %1 from the %2",_namePart,_nameType], "PLAIN DOWN"];
} else {
cutText [localize "str_player_24", "PLAIN DOWN"];
};
} else {
cutText [format["Cannot remove %1 from %2, the part has been damaged.",_namePart,_nameType], "PLAIN DOWN"];
};
} else {
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
s_player_removeActions = [];
silver_myCursorTarget = objNull;
};
};
 
if( silver_myCursorTarget != objNull ) then {
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
s_player_removeActions = [];
silver_myCursorTarget = objNull;
};

all credits goes to SilverShot for the original ss_remove code ... THANK YOU SO MUCH!!
 
Back
Top