Strip vehicles for parts

Ok so I have this working, the only bug I can see is that if you remove an engine or fuel tank part from a car it turns the part red but still works, then you can put the part you just took off back on the vehicle and it will be green and repaired.

This doesn't happen for helis though, if a part isn't green then you can't remove it. I'm not sure why that doesn't work for cars though...
 
I'm having the problem where if I try to remove parts off a vehicle, I see the blue text pop up for just a moment then it seems that is "disappears." Does anyone know how to fix this?
 
I followed Jaimbo's tutorial and it "works" , u can endlessly farm parts from vehicles and pulling an engine on a vehicle does not disable it.... anyone have fixes for these? this is a great addition, just needs some tweaking i think.

thanks
 
hey new to dayz and open dayz but somewhat familar with server editing. did step for step every thing said and server will run fine and can connect fine but no option to remove parts or repair vehicles no matter there damage. this is for chenarus.
 
never mind some how i managed to put a ) instead of a } in one spot. 6 hours later i find it lol! love it.

Props for post thought, great job.
 
Manatee hunter, follow this tutorial and it will work perfectly:

1. Using the PBO tool of your choice (cPBO, PBOView, PBOManager etc.) extract the "dayz_code.pbo" from the "@dayz" folder.
2. Copy the "compiles.sqf" from "dayz_code\init" into your mission.pbo.
3. In the init.sqf in the mission.pbo edit:

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

to

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:

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

5. 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

(Should be on line 17)

and edit it so it looks like this

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

Now we can edit the fn_selfActions.sqf and the changes will work in our server!

6. Now open the "fn_SelfActions" 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;
};

And right underneath it, we add

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;
};
};

This gives us the options on the scroll wheel menu when looking at vehicles!

7. Now find

Code:
 //Engineering
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = objNull;
//Others
player removeAction s_player_forceSave;
s_player_forceSave = -1;
player removeAction s_player_flipveh;
s_player_flipveh = -1;
player removeAction s_player_sleep;
s_player_sleep = -1;
player removeAction s_player_deleteBuild;
s_player_deleteBuild = -1;
player removeAction s_player_butcher;
s_player_butcher = -1;
player removeAction s_player_cook;
s_player_cook = -1;
player removeAction s_player_boil;
s_player_boil = -1;
player removeAction s_player_fireout;
s_player_fireout = -1;
player removeAction s_player_packtent;
s_player_packtent = -1;
player removeAction s_player_fillfuel;
s_player_fillfuel = -1;
player removeAction s_player_studybody;
s_player_studybody = -1;
//Dog
player removeAction s_player_tamedog;
s_player_tamedog = -1;
player removeAction s_player_feeddog;
s_player_feeddog = -1;
player removeAction s_player_waterdog;
s_player_waterdog = -1;
player removeAction s_player_staydog;
s_player_staydog = -1;
player removeAction s_player_trackdog;
s_player_trackdog = -1;
player removeAction s_player_barkdog;
s_player_barkdog = -1;
player removeAction s_player_warndog;
s_player_warndog = -1;
player removeAction s_player_followdog;
s_player_followdog = -1;
};

And right above it 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!

8. Last but CERTAINLY not least, download the attached ss_remove.sqf and place it into your mission!

Job done!!!
Jaimbo, Do I need to add anything to my init.sqf to make the ss_remove.sqf work or did that can taken care of when adding the compiles.sqf and fnc_selfActions.sqf?
 
What about if you are adding this mod where other mods are already using these? EX: I have this strip parts already working in my server. I am trying to add base building. Both have additions to init.sqf and fnselfaction.sqf . I cannot get the 2 to work together. I changed the file paths both ways= call pre-blah blah "compiles.sqf" for everything and left it on my main folder page and then did the opposite= call pre-blah blah dayz_addon/init/compiles.sqf. Neither worked. I love all these mods and appreciate everyone's help but many of these instructions only work if it is the only mod you are using. Chaos...any chance you would swing over to "base building 1.2 and take a look at what I'm talking about?
 
So I added everything exactly how Jaimbo said to do it, but this is the error I am getting in my RPT.

Code:
 4:45:38 Error in expression <pe","_selection","_array"];
_id = _this select 2;
_array =    _this select 3;
_veh>
4:45:38  Error position: <select 2;
_array =    _this select 3;
_veh>
4:45:38  Error Zero divisor
4:45:38 File mpmissions\__cur_mp.chernarus\ss_remove.sqf, line 4

If anyone is able to look at it and let me know what is out of place I would greatly appreciate it!

Attached is the mission file I am using.
 

Attachments

  • dayz_mission (5).pbo
    472.4 KB · Views: 14
Ill look at it in the morning for ya chaos. Ill also post my PBO so you can see a working one. In doing this I am hoping that Jaimbo or someone would be kind enough to help me with the base build 1.2. I see servers where they have it working with DayZ.st but that's about it...base building, lift and tow. No one seems to be able to get base building and parts harvesting to work together. It's been a 2 week hair puller for me thus far but I am determined to get it! He who does will be a true miricle worker! Lol
 
Chaos, I noticed a couple things. 1. At the bottom of your Init.sqf you have: [] execVM "ss_remove.sqf" , this is was unnecessary on mine for Tavi but not sure about yours. My Init does call for ssremove as it gets call from elsewhere. If removing this doesnt help Id also go back over your fnselfactions.sqf and double check it line for line. You have a ton of extras that I do not so im not 100% sure whats needed. Ive attached my mission pbo if you'd like to compare.
 

Attachments

  • dayz_mission_tavi_new.pbo
    231.1 KB · Views: 17
The extras I added are from the post on page 2. I added everything Jaimbo said. I added the exec line in my init.sqf cause without it it wasn't being called. When I added it it started being called and the errors appeared in my RPT. I'll try removing it again though.
 
It's being called already though. I seen on your compiles.sql. It calls fnselfaction and I believe that calls "remove".
 
Ok. I'll pull it out and try it when I get home. I'll dabble with the base building tonight as well when I get off work and see if I can get it running on my server.
 
I got it to work finally haha. I will mess with the build base script tomorrow night. Trying to make it so BE stops kicking me for loading crates into vehicles right now.
 
T
Seems i have already modified this line, so what can i do? debug monitor or this?
This is just a call path or file path. If you are calling your debug compile.sqf from one location then change it to call from compiles.sqf only. Then merge the two sqf's together properly and move the compiles.sqf to your main folder page.
 
Hey here is my compiles.sqf from my debug, does anyone know how to merge the stripping vehicles compiles? i r not pro. Thanks for your time.
 

Attachments

  • compiles.sqf
    23.5 KB · Views: 7
Hey here is my compiles.sqf from my debug, does anyone know how to merge the stripping vehicles compiles? i r not pro. Thanks for your time.
If you want to inbox me your mission PBO I will take a look at it later tonight.
 
Back
Top