- Joined
- Jul 27, 2006
- Messages
- 357
- Reaction score
- 25
I started a little research about how items can be repaired and I share my results. I know for some this is not something new, and I think the result of reinventing the wheel is because not all wants to share, their reasons are their own.
Aaaanyways, in Dayz items durability is given as damage % for item:
Items that can be repaired have a property that defines it could be repaired with what:
on boots for example :
and items that are assumed as "repairKitType", have also a property:
Still not sure about what repair items is repairKitType = 0; that some items have repairableWith = 0;
The only item that don't have property "repairKitType" is duct tape, and because from starting is assumed it can repair all items except some blacklisted, defined in modules_dayz/scripts/fnc_isItemDuctTapeCompatible.sqf
Also there is also defined how much it can repair:
The other items, maximum level that it can repair is defined in server_data/scripts/players/player_mendItem.sqf :
I think custom repair items can be defined as repairKitType = "SomeCustomRepairKit" and items that can be repaired with must have property repairableWith="SomeCustomRepairKit";
Aaaanyways, in Dayz items durability is given as damage % for item:
Code:
0 - 0.3 - pristine
0.31 - 0.6 - worn
0.61 - 0.9 - damaged
0.9 - 0.99 - badly damaged
1 - ruined, 100% damaged
Items that can be repaired have a property that defines it could be repaired with what:
Code:
itemSize[] = {2, 2};
repairableWith = 2; // < -- repairable with "repairKitType"
on boots for example :
Code:
repairableWith="RepairLeatherSewingKit"; //this means maybe that you can define a new class for repair (as string)
and items that are assumed as "repairKitType", have also a property:
Code:
Tool_WeaponCleaningKit -> repairKitType = 1;
Tool_SewingKit -> repairKitType = 2;
Tool_LeatherSewingKit -> repairKitType = "RepairLeatherSewingKit";
Still not sure about what repair items is repairKitType = 0; that some items have repairableWith = 0;
The only item that don't have property "repairKitType" is duct tape, and because from starting is assumed it can repair all items except some blacklisted, defined in modules_dayz/scripts/fnc_isItemDuctTapeCompatible.sqf
Also there is also defined how much it can repair:
Code:
ductTapeRepairDamage = 0.5; // Damage tolerance. No repairing below this amount. <-- means if ductTapeRepairDamage = 0, then duct tape will repair to pristine, if _item setDamage 0.0 in function player_mendItem.
The other items, maximum level that it can repair is defined in server_data/scripts/players/player_mendItem.sqf :
Code:
switch true do
{
case (_damageItem >= 1):
{
[_owner,format["%1 is ruined and cannot be mended with %2",displayName _item,displayName _kit],'colorAction'] call fnc_playerMessage;
};
case (_damageItem > 0.3):
{
[_owner,format["I have mended %1.",displayName _item],'colorAction'] call fnc_playerMessage;
_item setDamage 0.31; // <-- setDamage 0.0; = repair to pristine
_kit setDamage (_damageKit + 0.1); //<-- (_damageKit + 0.1) if commented, kit will not suffer degradation
};
case (_damageItem <= 0.3):
{
[_owner,format["%1 is pristine and it doesn't need to be mended.",displayName _item],'colorAction'] call fnc_playerMessage;
};
};
I think custom repair items can be defined as repairKitType = "SomeCustomRepairKit" and items that can be repaired with must have property repairableWith="SomeCustomRepairKit";