I just spent half an hour hunting a bug crippling my addon, and finally got my hands on it. When SetItemStackSize (or CreateItemOnObject with a nStackSize greater than 1) is used on an item with a variable inherited from the resource (and a custom var_items_blabla table) the items "created" to fill the stack with size-1 items will not get the local variable from the resource if the stack is owned by a store inventory. Not until they are separated from the stack and the game is saved/reloaded.
For instance when I create my ingots in the stores inventories, here what I do :
- http://pastie.org/756418 (excerpt from a script fired by prcscr upon area load, if that detail is important)
As in : if a stack of the relevant resource already exist, I change the stack size, and if no stack is found, I create the stack directly. Either way, the items taken from the stack won't have the custom local variable : it's automatically resetted to the var_items_blabla table default value. Only the item at the bottom of the stack (if you buy items one by one, that the last one remaining in the stack) gets the proper variable value.
Funny thing is none of this happens when the stack is created / modified elsewhere, like inside the party inventory.
That's the kind of sneaky bugs that can drive me crazy, and so I thought others may like to know...
As for a fix, well I'm trying to look into it without having to reduce the BITM max stack size to 1... Even manually setting the local var upon stack creation doesn't work. (the value is glued to the default)
Modifié par Phaenan, 25 décembre 2009 - 04:43 .





Retour en haut






