I usually put the restrictions for number of items in the sc. Like this:
int GetNumItems(object oTarget,string sItem)
{
int nNumItems = 0;
object oItem = GetFirstItemInInventory(oTarget);
while (GetIsObjectValid(oItem) == TRUE)
{
if (GetTag(oItem) == sItem)
{
nNumItems = nNumItems + GetNumStackedItems(oItem);
}
oItem = GetNextItemInInventory(oTarget);
}
return nNumItems;
}
int StartingConditional()
{
object oPC = GetPCSpeaker();
if (!(GetNumItems(oPC, "TagOfItem") >= 3)) return FALSE;
return TRUE;
}
So the sc would check for 3 or more of the specified item.
Then in the action taken simply:
#include "nw_i0_plot"
//Put this on action taken in the conversation editor
void main()
{
object oPC = GetPCSpeaker();
object oItem;
oItem = GetItemPossessedBy(oPC, "TagOfItem ");
TakeNumItems(oPC, "TagOfItem", 3);
if (GetIsObjectValid(oItem))
DestroyObject(oItem);
CreateItemOnObject("resrefoitemcreated", oPC);
}
Don't know if that's helpful in this particular case.
Modifié par ffbj, 03 septembre 2011 - 11:34 .