Battledale_PRC8/_module/nss/user_crate.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

51 lines
1.7 KiB
Plaintext

//::///////////////////////////////////////////////
//:: 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");
}
}