#include "x2_inc_itemprop" //This is actually the main function. void script(object oItem, object oPC) { itemproperty ipAdd; int nType; if (GetLocalString(oPC, "Parameter") == "Acid") nType = IP_CONST_DAMAGETYPE_ACID; if (GetLocalString(oPC, "Parameter") == "Divine") nType = IP_CONST_DAMAGETYPE_DIVINE; if (GetLocalString(oPC, "Parameter") == "Sonic") nType = IP_CONST_DAMAGETYPE_SONIC; if (GetLocalString(oPC, "Parameter") == "Fire") nType = IP_CONST_DAMAGETYPE_FIRE; if (GetLocalString(oPC, "Parameter") == "Cold") nType = IP_CONST_DAMAGETYPE_COLD; if (GetLocalString(oPC, "Parameter") == "Electrical") nType = IP_CONST_DAMAGETYPE_ELECTRICAL; if (GetLocalString(oPC, "Parameter") == "Magical") nType = IP_CONST_DAMAGETYPE_MAGICAL; if (GetLocalString(oPC, "Parameter") == "Negative") nType = IP_CONST_DAMAGETYPE_NEGATIVE; if (GetLocalString(oPC, "Parameter") == "Slashing") nType = IP_CONST_DAMAGETYPE_SLASHING; if (GetLocalString(oPC, "Parameter") == "Piercing") nType = IP_CONST_DAMAGETYPE_PIERCING; if (GetLocalString(oPC, "Parameter") == "Bludgeoning") nType = IP_CONST_DAMAGETYPE_BLUDGEONING; ipAdd = ItemPropertyDamageResistance(nType, IP_CONST_DAMAGERESIST_20); IPSafeAddItemProperty(oItem, ipAdd); SetLocalString(oPC, "LastProperty", "Resistance"); } void main() { object oPC = GetPCSpeaker(); int nSlot = 0; object oItem; //Check if the item being crafted is equipped while (nSlot < 18) { oItem = GetItemInSlot(nSlot, oPC); if (GetLocalInt(oItem, "Prototype") == TRUE) {script(oItem, oPC); return; } nSlot++; } //If the item is not equipped, search for it in the inventory oItem = GetFirstItemInInventory(oPC); while (GetIsObjectValid(oItem)) { if (GetLocalInt(oItem, "Prototype") == TRUE) {script(oItem, oPC); return; } oItem = GetNextItemInInventory(oPC); } }