/*#include "x2_inc_itemprop" void main() { object oPC = GetPCSpeaker(); object oItem = GetFirstItemInInventory(oPC); int nCost; while (GetIsObjectValid(oItem)) { if (GetLocalInt(oItem, "Prototype") == TRUE) { nCost = 3*GetGoldPieceValue(oItem)/4; TakeGoldFromCreature(nCost, oPC, TRUE); SetItemCursedFlag(oItem, FALSE); SetLocalInt(oItem, "Prototype", FALSE); IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_USE_LIMITATION_RACIAL_TYPE, -1); } oItem = GetNextItemInInventory(oPC); } }*/ #include "x2_inc_itemprop" //This is actually the main function. void script(object oItem, object oPC) { int nCost; int nValue; nValue = GetGoldPieceValue(oItem); if (GetLocalString(oItem, "Type") == "Ammo") nValue = 99*nValue; nCost = 3*nValue/4; TakeGoldFromCreature(nCost, oPC, TRUE); SetItemCursedFlag(oItem, FALSE); SetLocalInt(oItem, "Prototype", FALSE); IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_USE_LIMITATION_RACIAL_TYPE, -1); if (GetLocalString(oItem, "Type") == "Ammo") SetItemStackSize(oItem, 99); } 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); } }