1) Here's a vanilla Container with n Items, all coming from Lvd Lists. THIS is the key of the problem
2) Player picks one Item, its Ref is registered in an ObjectReference[] by scripts. As it is the first, index = 0
3) Player continues to pick Items one by one, repeating 2) until there's only one Item left (n - 1) in the Container. Until this moment included, the Items already in Player Inventory can be dropped, put back in their original Container or another one, they will always be recognized as (akItemReference) from a Player Alias OnItemRemoved().
4) But now if Player takes the last Item and so the Container is empty, this last ObjectReference is NOT recognized if i put it back in its Container, not because the ObjectReference[i] is not matching, but because (akItemReference) is NULL !
A few more details :
- Player OnItemRemoved(akItemReference) is though not equal to None for the last ObjectReference[] index, if dropped on the ground or in most of others Containers (but not all)
- No problem with the others ObjectReference[i]
- No problem at all with the last Item if all the Items are NOT coming from Lvd Lists.
- No problem at all (even if Items come from Lvd Lists) if Container is an Actor, living or dead
- Once the problem occured, if i take back the last Item from Container to Inventory, it will be given the next index of the array, the system considering it as new. But from there, this new ObjectReference[i] will finally be recognized in EVENT OnItemRemoved() to its original Container. It's usually the case, but not all the time though.
Skyrim 1.6 + corresponding SKSE
No others mods than this one and SkyUI
I can't figure what's happening. Any idea ?