Jump to content

[Papyrus] AddItem bugged for form lists?


M3rvin

Recommended Posts

I want to add 1 unit of every item in a form list to a container. But the basic

Container_ListView.AddItem(List_Sort, 1, true)

doesn't work. If I replace that by the following loop, it works like a charm.

int i = 0
Form Item
while(i < List_Sort.GetSize())
Item = List_Sort.GetAt(i)
Container_ListView.AddItem(Item)
i += 1
endwhile

 

Does anyone know what the cause of this problem is?

Link to comment
Share on other sites

Yes. In your first example you are actually trying to add the form list itself into the container, not the base forms that are in the list. You can't do that.

In the second example you are retrieving the item's that the form list is pointing to, via the GetAt(i) function. That is the correct way.

Link to comment
Share on other sites

I'm sure that the 1st way worked a few patches back.

And the creation kit wiki article on additem says: akItemToAdd: [...] If a form list, then it will add aiCount of each item in the list.

 

Also from the wiki

As of 6/5/2012, it appears that the latest beta patch (1.6) no longer allows for the AddItem method to add an object or objectreference of Form 'Container' to the player's inventory.

Link to comment
Share on other sites

  • 4 weeks later...

What's curious about this bug is that it's so arbitrary - always works for some users, never works for others, and is sporadic for the rest.

 

In the game, the most obvious instance of the bug is that Salmon are no longer lootable. I'm not sure if it's used elsewhere.

 

http://forums.bethsoft.com/topic/1403481-additem-formlist-not-working-in-17-please-verify/

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...