firedog118 Posted May 22, 2011 Share Posted May 22, 2011 OBSE has a function called 'GetItems' which returns all the items in either the player's or a container's inventory.It returns the data in the form of an Array. And I understand the basics of an Array, but I can't work out how to read from an Array. So any help would be appreciated. Link to comment Share on other sites More sharing options...
HeyYou Posted May 22, 2011 Share Posted May 22, 2011 You have to define your array first, and then use the getitems to dump your inventory into it. Once it is there..... arrayvariablename [0] will have the first itemarrayvariablename [1] will have the second item Etc..... If you have a bunch of stuff in your inventory, there will be a big array generated. Seems you can restrict what it dumps to the array though, by item 'type', be it weapons, armor, whathaveyou. (you can do up to ten different types....) What specifically are you looking for? Link to comment Share on other sites More sharing options...
fg109 Posted May 22, 2011 Share Posted May 22, 2011 Well, in order to store that array you should do something like let InvArr := ActorOrContainer.GetItems Then all the items in the actor or container's inventory will be stored in the array InvArr. This is an array of type array, meaning that the index is of integer form. So InvArr[0], InvArr[1], InvArr[2] all refer to different elements in the array. InvArr[0.3], InvArr["FirstItem"], etc would be invalid elements. If you want to do things to the items in the array, you can use a while loop. while (index < ar_size InvArr) let tempref := InvArr[index] ; do stuff to tempref, which is an item in the array let index := index + 1 loop Link to comment Share on other sites More sharing options...
Recommended Posts