i have a script which checks if the PC got 5 of the weak spidervenom, when he have them, it should start a conversation namend questsuccess. So i got a loop to search the storage, it works fine with self productet items, but when i use the original weak spidervenom, it dosen´t work. It´s the correct tag. Here is the not working part.
if (iRE == 4)
int iZiel = 5;
string sItem = “x2_it_poison007”;
oItem = GetFirstItemInInventory(oPC);
while ((OBJECT_INVALID !=oItem) && (iCount < iZiel))
string iSo = GetTag(oItem); // I just wat see if the
ActionSpeakString(iSo); // tag of the item was correct
if (GetTag(oItem) == sItem)
oItem = GetNextItemInInventory(oPC);
if (iCount == iZiel)
if (iCount < iZiel)
x2_it_poison007 is the resref of the weak spidervenom, but are you sure it’s the tag?
I’m not at my desk to check right now, but often the tag is different - upper case, or whatever.
I don’t see where iCount is initialised - though it will default to zero if not assigned earlier in the script, which would be OK.
x2_it_poison007 ist both resref and tag, to be sure i insert the Actionspeakstring, so i can see it in the chat.
The count is initialiesed at the beginning of the hole script, like i said, the loop works for selfmade items, i´ve got the same loop with diffrent tags 4 times in this script. And the ActionSpeakString returns the same tag as i´ve gived to sItem.
Thanks for your reply.
Does the inventory of weak spider venom stack in the inventory?
If so, it may just count as 1 and may require to take into account stacked items.
The script should actually work and the venom isn’t stackable by default. To make it stackable a change of baseitems.2da is necessary (could it be???)
I would suggest 2 changes:
- if (GetTag(oItem) == sItem) iCount += GetItemStackSize (oItem); // stacksize aware, works with any item, not matter if stackable or not
- if (iCount >= iZiel) // in Case there are more than iZiel which can happen in conjunction with adding the stack size
You could also use GetResRef(oItem) instead of GetTag, since there does seem to be an issue.
thanks for your comments, i found my fault. I had 2 if (iRE == 4) in the script, the first should be if (iRE == 3),
that was my mistake, sorry.
But i´m sure, i´m coming back.