#include "x2_inc_itemprop" //This is actually the main function. void script(object oItem, object oPC) { itemproperty ipAdd; if (GetLocalString(oPC, "LastProperty") == "Slots") { int nConstant; IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N, -1); string sClass = GetLocalString(oItem, "SpellSlots"); if (sClass == "Wizard") nConstant = IP_CONST_CLASS_WIZARD; if (sClass == "Sorcerer") nConstant = IP_CONST_CLASS_SORCERER; if (sClass == "Cleric") nConstant = IP_CONST_CLASS_CLERIC; ipAdd = ItemPropertyBonusLevelSpell(nConstant, 1); AddItemProperty(2, ipAdd, oItem); AddItemProperty(2, ipAdd, oItem); ipAdd = ItemPropertyBonusLevelSpell(nConstant, 2); AddItemProperty(2, ipAdd, oItem); AddItemProperty(2, ipAdd, oItem); ipAdd = ItemPropertyBonusLevelSpell(nConstant, 3); AddItemProperty(2, ipAdd, oItem); AddItemProperty(2, ipAdd, oItem); ipAdd = ItemPropertyBonusLevelSpell(nConstant, 4); AddItemProperty(2, ipAdd, oItem); AddItemProperty(2, ipAdd, oItem); return; } if (GetLocalString(oPC, "LastProperty") == "AC") { ipAdd = ItemPropertyACBonus(4); IPSafeAddItemProperty(oItem, ipAdd); } } 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); } }