//:://///////////////////////////////////////////// //:: user_crate //:: user_crate.nss //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* */ //::////////////////////////////////////////////// //:: Created By: Lysandius //:: Created On: 18-07-2002 //::////////////////////////////////////////////// #include "inc_tavern" void main() { int nUser = GetUserDefinedEventNumber(); if (nUser == 1008) // ON DISTURBED // CHECK INVENTORY LOW { string sTag = GetTag(GetInventoryDisturbItem()); string sTagCrate = GetTag(OBJECT_SELF); string sDrink = GetLocalString(OBJECT_SELF, "sDrink"); if (sDrink != "None") sTag = sDrink; if (GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_REMOVED || sDrink != "None") { if ((sTag == "NW_IT_MPOTION023" && sTagCrate == "item_crate_wine") || (sTag == "NW_IT_MPOTION022" && sTagCrate == "item_crate_spirits")) { object oItem = GetFirstItemInInventory(); int nAmount = 0; while (GetIsObjectValid(oItem)) { if (GetTag(oItem) == sTag) { nAmount += GetNumStackedItems(oItem); } oItem = GetNextItemInInventory(); } if (nAmount < INT_STOCKLIMIT_LOW) { object oWorker = GetNearestObjectByTag("creature_worker"); SignalEvent(oWorker, EventUserDefined(10)); // ON INVENTORY LOW } } } SetLocalString(OBJECT_SELF, "sDrink", "None"); } }