+ formatting for damage percentage for repair and salvage.
+ Chance to break part when salvaging damaged parts.
+ Potential fix for purchased vehicle damage handler.
+ added check when cracking vault to exit when toolbox is broken
+ Potential fix for glitched extra crack vault options and no delay.
+ 1.7.5.1
This commit is contained in:
vbawol
2013-02-05 07:56:39 -06:00
parent d60007afc9
commit ca32bcbf71
14 changed files with 184 additions and 50 deletions

View File

@@ -50,7 +50,8 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
_string = format["<t %2>Repair%1</t>",_cmpt,_color]; //Repair - Part
_percent = round(_damage*100);
_string = format["<t %2>Repair%1 (%3%)</t>",_cmpt,_color,_percent]; //Repair - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
};

View File

@@ -19,16 +19,26 @@ if (_hasToolbox) then {
_vehicle removeAction _id;
//dont allow removal of damaged parts
if (_damage < 0.15) then {
if (_damage < 1) then {
_isOK = [player,_part] call BIS_fnc_invAdd;
if (_isOK) then {
//Fix the part
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
//vehicle is owned by whoever is in it, so we have to have each client try and fix it
// the more damaged the part the higher the chance to loose the part.
// 0.25 = 25% chance to loose part
// 0.5 = 50% chance to loose part
// 0.75 = 75% chance to loose part
// 0.99 = 99% chance to loose part
_findPercent = (1 - _damage) * 10;
// X = 1 - 0.25 = 0.75 x 10 == 7.5
// X = 1 - 0.99 = 0.01 x 10 == 0.1
//break the part
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
//vehicle is owned by whoever is in it, so we have to have each client try and fix it
["dayzSetFix",[_vehicle,_selection,1],_vehicle] call broadcastRpcCallIfLocal;
player playActionNow "Medic";
@@ -39,9 +49,15 @@ if (_hasToolbox) then {
sleep 5;
_vehicle setvelocity [0,0,1];
//Success!
cutText [format["You have successfully removed %1 from the %2",_namePart,_nameType], "PLAIN DOWN"];
if(ceil (random _findPercent) == 1) then {
// loose part and damage vehicle
player removeMagazine _part;
//Failed!
cutText [format["You have destroyed %1 while attempting to remove from %2",_namePart,_nameType], "PLAIN DOWN"];
} else {
//Success!
cutText [format["You have successfully removed %1 from the %2",_namePart,_nameType], "PLAIN DOWN"];
};
} else {
cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"];

View File

@@ -43,13 +43,17 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
};
// allow removal of any lightly damaged parts
if (_damage < 0.25) then {
if (_damage < 1) then {
// Do not allow removal of engine or fueltanks
if( _part == "PartGlass" or _part == "PartWheel" ) then {
_color = "color='#ff0000'"; //red
_string = format["<t %2>Remove%1</t>",_cmpt,_color]; //Remove - Part
_color = "color='#ffff00'"; //yellow
if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
_percent = round(_damage*100);
_string = format["<t %2>Remove%1 (%3%)</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];
};

View File

@@ -62,6 +62,8 @@ if (_qty >= _qty_in) then {
["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
_veh call fnc_vehicleEventHandler;
cutText [format[("Bought %3 %4 for %1 %2"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
// Sell Vehicle

View File

@@ -55,13 +55,16 @@ if (_qty >= _qty_in) then {
player reveal _veh;
_location = getPosATL _veh;
_veh setVariable ["characterID",dayz_playerUID,true];
//_veh setVariable ["characterID",dayz_playerUID,true];
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
// check if this will add the needed event handlers to correctly track damage client side
_veh call fnc_vehicleEventHandler;
cutText [format[("Bought %3 %4 for %1 %2"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
// Sell Vehicle
@@ -75,7 +78,7 @@ if (_qty >= _qty_in) then {
["dayzDeleteObj",[_objectID,_objectUID]] call callRpcProcedure;
deleteVehicle _obj;
deleteVehicle _obj;
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
};