Remove Parts From Vehicles (Simplified)

unkinhead

Member
Remove Parts From Vehicles
By: Unkinhead
Credits: Jaimbo



Unpack your mission.pbo with PBOview (or another PBO unpacker)



(If you have already overridden your fn_selfactions and compiles sqfs, you can skip the first few steps)



---Already Overridden Skipp-able Steps Start---



Copy the compiles.sqf from "dayz_code\init" into your mission.pbo.​
In the init.sqf in the mission.pbo replace:​
Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
with​
Code:
call compile preprocessFileLineNumbers "compiles.sqf";
You can use the compiles.sqf to override majority of the files in "dayz_code\compile" folder. We are going to use it to override the function "fn_selfAction.sqf" so:​
Copy the fn_selfAction.sqf in "dayz_code\compile" to your mission.pbo​
Open the compiles.sqf and find:​
Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self
Replace it with:​
Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "fn_selfActions.sqf";        //Checks which actions for self
---Already Overridden Skipp-able Steps End---
Now open the fn_SelfActions.sqf in the mission.pbo and find​
Code:
//Sleep
if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
if ((s_player_sleep < 0) and (player distance cursorTarget < 3)) then {
s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_sleep;
s_player_sleep = -1;
};

Right underneath the last line above, insert:​
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 {
 
//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, "ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_removeActions set [count s_player_removeActions,_handle];
};
};
 
} forEach _hitpoints;
};
};

Now find:​
Code:
//Engineering
And right above that line add:​
Code:
//Extras
//Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;

This makes sure we don't have the option unless we are looking at vehicles!​
Last but CERTAINLY not least, download the attached ss_remove.sqf and place it into the root directory of your mission pbo!​
 

Attachments

  • ss_remove.sqf
    2.1 KB · Views: 2,808
Remove Parts From Vehicles
By: Unkinhead
Credits: Jaimbo



Unpack your mission.pbo with PBOview (or another PBO unpacker)



(If you have already overridden your fn_selfactions and compiles sqfs, you can skip the first few steps)



---Already Overridden Skipp-able Steps Start---




Copy the compiles.sqf from "dayz_code\init" into your mission.pbo.

In the init.sqf in the mission.pbo replace:

Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";

with

Code:
call compile preprocessFileLineNumbers "compiles.sqf";

You can use the compiles.sqf to override majority of the files in "dayz_code\compile" folder. We are going to use it to override the function "fn_selfAction.sqf" so:

Copy the fn_selfAction.sqf in "dayz_code\compile" to your mission.pbo

Open the compiles.sqf and find:

Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self

Replace it with:

Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "fn_selfActions.sqf";        //Checks which actions for self

---Already Overridden Skipp-able Steps End---

Now open the fn_SelfActions.sqf in the mission.pbo and find
Code:
//Sleep
if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
if ((s_player_sleep < 0) and (player distance cursorTarget < 3)) then {
s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_sleep;
s_player_sleep = -1;
};

Right underneath the last line above, insert:
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 {

//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, "ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_removeActions set [count s_player_removeActions,_handle];
};
};

} forEach _hitpoints;
};
};

Now find:
Code:
//Engineering

And right above that line add:
Code:
//Extras
//Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;

This makes sure we don't have the option unless we are looking at vehicles!

Last but CERTAINLY not least, download the attached ss_remove.sqf and place it into the root directory of your mission pbo!​

when i join the game i get an error : script player_createstash.sqf not found ...but it is in the correct directory. also every car is undestroyable. when i crash into a house nothin happened. And when i remove a part from a vehicle it is in my inventory but also on the car -.- the part is "copied" not removed from the car :/
 
Back
Top