Difference between revisions of "GetInventoryObject"
Jump to navigation
Jump to search
imported>Odessa m (minor) |
imported>Odessa m |
||
Line 31: | Line 31: | ||
</pre> | </pre> | ||
==Notes== | ==Notes== | ||
*Beware removing items from a container within a loop, because it may change the index of those later. | |||
*Multiple instances of the same base form in a container are considered as just one item by the function. | *Multiple instances of the same base form in a container are considered as just one item by the function. | ||
==See Also== | ==See Also== | ||
*[[ForEach]] | |||
*[[GetNumItems]] | *[[GetNumItems]] | ||
*[[GetEquippedObject]] | *[[GetEquippedObject]] |
Latest revision as of 10:54, 14 September 2014
< [[::Category:Functions|Category:Functions]]
A function added by the Fallout Script Extender.
Description
Returns the base form of the Nth item in a container.
Syntax
(baseform) Container.GetInventoryObject index:int
Or:
(baseform) Container.GetNthObject index:int
Example
ref rItem set rItem to PlayerREF.GetInventoryObject 21
Often you may wish to use this in a loop, to go through every item in an inventory:
int x ref rItem let x := PlayerREF.GetNumItems while x > 0 let x -= 1 ; decrement x, the first item is '0' let rItem := PlayerREF.GetInventoryObject x ; do something loop
Notes
- Beware removing items from a container within a loop, because it may change the index of those later.
- Multiple instances of the same base form in a container are considered as just one item by the function.