#include "x2_inc_switches" #include "adv_include" #include "dcy_include" // Item Repair script. // // When a player uses repair kit on a damaged item, they will begin the item repair process. // During this process the player's Item Repair skill will be checked to determine how much // of a bonus to durability repair they receive. On successful completion, the repair kit // is destroyed and the item's durability is increased. void main() { if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return; object oPC = GetItemActivator(); object oKit = GetItemActivated(); object oItem = GetItemActivatedTarget(); string sResref = GetResRef(oKit); int iSkill = ADV_GetUpgradeLevel(oPC, ADV_ID_ITEM_REPAIR); int iRepairAmount; // Repair Kit Alpha - Restores 10% - 30% durability if(sResref == "repair_kit_alpha") { iRepairAmount = 10 + FloatToInt((iSkill * 1.5)); if(iRepairAmount > 25) iRepairAmount = 25; } // Repair Kit Beta - Restores 20% - 70% durability else if(sResref == "repair_kit_beta") { iRepairAmount = 20 + FloatToInt((iSkill * 2.5)); if(iRepairAmount > 50) iRepairAmount = 50; } // Repair Kit Gamma - Restores 35% - 90% durability else if(sResref == "repair_kit_gamma") { iRepairAmount = 35 + FloatToInt((iSkill * 3.5)); if(iRepairAmount > 75) iRepairAmount = 75; } // Run the repair function DCY_RunItemRepair(oPC, oItem, iRepairAmount); // Remove the kit from the game DestroyObject(oKit); }