#include "x2_inc_itemprop" //This is actually the main function. void script(object oItem, object oPC) { itemproperty ipAdd; ipAdd = ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_10); IPSafeAddItemProperty(oItem, ipAdd); SetLocalString(oPC, "LastProperty", "SpellResistance"); } 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); } }