Chunk. No Captain Chunk. Posted March 4, 2015 Report Share Posted March 4, 2015 Hey people, Got a "Fix" for the vehicle salvage but I am looking to edit it so every part of the vehicle can be removed no matter the condition. Heres what I've got so far: salvage_vehicle.sqf salvage_vehicle.sqf //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; }; I edited: if (_damage <= 0.95 and _damage >= 0) then { to this: if (_damage <= 1) then { But so it seems... It does not work. Any suggestions? Link to comment Share on other sites More sharing options...
0 SchwEde Posted March 4, 2015 Report Share Posted March 4, 2015 just remove the if command Link to comment Share on other sites More sharing options...
0 Chunk. No Captain Chunk. Posted March 4, 2015 Author Report Share Posted March 4, 2015 just remove the if command Oh just a question, Does this: if( _part == "PartGlass" || _part == "PartWheel" ) then { only allow removal of Glass and wheels? If so, Should I just delete that too to make the vehicle completely salvageable? Link to comment Share on other sites More sharing options...
0 SchwEde Posted March 5, 2015 Report Share Posted March 5, 2015 just try it and see the results for yourself ;) i cant remember why exactly they are there, but i know they have to be there to get this working like it should Link to comment Share on other sites More sharing options...
0 Chunk. No Captain Chunk. Posted March 5, 2015 Author Report Share Posted March 5, 2015 just try it and see the results for yourself ;) i cant remember why exactly they are there, but i know they have to be there to get this working like it should Tried it and failed, Removal of both: if( _part == "PartGlass" || _part == "PartWheel" ) then { and: if (_damage <= 0.95 and _damage >= 0) then { Breaks the script entirely... No more ideas :P Link to comment Share on other sites More sharing options...
0 SchwEde Posted March 5, 2015 Report Share Posted March 5, 2015 //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"; }; // 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; }; Link to comment Share on other sites More sharing options...
0 Chunk. No Captain Chunk. Posted March 6, 2015 Author Report Share Posted March 6, 2015 Thats the completed script? Working awesomely, just need to edit it to allow the removal of engines and other parts! But locked vehicles can be salvaged, but although, if you are stupid enough not to lock up your vehicle while AFK or Offline then thats your problem :P Cheers for the help and let me know if you figure out how to change it so that you can salvage everything. ;) Should be this correct? if( _part == "PartGlass" || _part == "PartWheel" || _part == "PartFueltank" || _part == "PartEngine" || _part == "PartVRotor") then { Got all of it working perfectly! Thanks for your help dude! :D Link to comment Share on other sites More sharing options...
Question
Chunk. No Captain Chunk.
Hey people,
Got a "Fix" for the vehicle salvage but I am looking to edit it so every part of the vehicle can be removed no matter the condition.
Heres what I've got so far:
salvage_vehicle.sqf
Any suggestions?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now