Difference between revisions of "GetItemsInInventory"
From Dragon Age Toolset Wiki
BryanDerksen (Talk | contribs) m (1 revision: Importing auto-generated function articles) |
m (Fixing error with extraction) |
||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| − | |||
{{dafunction | {{dafunction | ||
| − | |name=GetItemsInInventory | + | |name = GetItemsInInventory |
| − | |brief=Gets all items in an object inventory | + | |brief = Gets all items in an object inventory |
| − | |param1type=object | + | |param1type = object |
| − | |param1name=oObject | + | |param1name = oObject |
| − | |param1desc=A creature or placeable with an inventory | + | |param1desc = A creature or placeable with an inventory |
| − | |param2type=int | + | |param1default = |
| − | |param2name=nGetItemsOptions | + | |param2type = int |
| − | |param2desc= | + | |param2name = nGetItemsOptions |
| − | |param3type=int | + | |param2desc = A [[GET_ITEMS_OPTION_*]] constant |
| − | |param3name=nBaseItemType | + | |param2default = GET_ITEMS_OPTION_ALL |
| − | |param3desc= | + | |param3type = int |
| − | |param4type=string | + | |param3name = nBaseItemType |
| − | |param4name=sTagFilter | + | |param3desc = Only return items with a matching base item type or 0 to disable this filter |
| − | |param4desc= | + | |param3default = 0 |
| − | |param5type=int | + | |param4type = string |
| − | |param5name=bIgnorePlotItems | + | |param4name = sTagFilter |
| − | |param5desc= | + | |param4desc = Only return items with a matching tag or "" to disable this filter |
| − | |returntype=object | + | |param4default = "" |
| − | |returndesc= | + | |param5type = int |
| − | |sourcefile=script.ldf | + | |param5name = bIgnorePlotItems |
| − | | | + | |param5desc = Only return items which are NOT plot items or FALSE to disable this filter |
| + | |param5default = FALSE | ||
| + | |returntype = object | ||
| + | |returnarra = TRUE | ||
| + | |returndesc = An array of all items in/on the object that match the specified filters | ||
| + | |sourcefile = script.ldf | ||
| + | |sourcemodul = | ||
}} | }} | ||
== Description == | == Description == | ||
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. --> | <!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. --> | ||
| − | Provides access to a | + | Provides access to a [[creature|creature's]] or [[placeable|placeable's]] inventory and equipped items. |
| − | + | == Remarks == | |
<!-- This section contains additional comments, observations and known issues. --> | <!-- This section contains additional comments, observations and known issues. --> | ||
| + | The <code>nGetItemsOptions</code> filter is not a bit field, i.e. you cannot use the [[bitwise or operator]] to combine options. | ||
| − | < | + | The <code>nBaseItemType</code> filter does not work on placeable's inventories. |
| + | |||
| + | == Examples == | ||
<!-- This section contains examples transcluded from the snippet library. --> | <!-- This section contains examples transcluded from the snippet library. --> | ||
| + | <dascript> | ||
| + | // Remove all equipped items from a creature and put them in the creature's inventory. | ||
| + | void UnequipAllEquippedItems(object oCreature) | ||
| + | { | ||
| + | int nItem; | ||
| + | |||
| + | object[] oItems = GetItemsInInventory(oCreature, GET_ITEMS_OPTION_EQUIPPED); | ||
| + | int nItems = GetArraySize(oItems); | ||
| + | |||
| + | for(nItem = 0; nItem < nItems; nItem++) | ||
| + | { | ||
| + | UnequipItem(oCreature, oItems[nItem]); | ||
| + | } | ||
| + | } | ||
| + | </dascript> | ||
<!-- == See also == --> | <!-- == See also == --> | ||
<!-- This section contains links to articles, functions or constant groups. --> | <!-- This section contains links to articles, functions or constant groups. --> | ||
| − | [[Category: Items functions]] | + | [[Category:Items functions]] |
Latest revision as of 09:55, 8 June 2014
Gets all items in an object inventory
object[] GetItemsInInventory(
object oObject,
int nGetItemsOptions = GET_ITEMS_OPTION_ALL,
int nBaseItemType = 0,
string sTagFilter = "",
int bIgnorePlotItems = FALSE
);
object oObject,
int nGetItemsOptions = GET_ITEMS_OPTION_ALL,
int nBaseItemType = 0,
string sTagFilter = "",
int bIgnorePlotItems = FALSE
);
- Parameters:
- oObject
- A creature or placeable with an inventory
- nGetItemsOptions
- A GET_ITEMS_OPTION_* constant
- nBaseItemType
- Only return items with a matching base item type or 0 to disable this filter
- sTagFilter
- Only return items with a matching tag or "" to disable this filter
- bIgnorePlotItems
- Only return items which are NOT plot items or FALSE to disable this filter
- Returns:
- An array of all items in/on the object that match the specified filters
- Source:
- script.ldf
Description
Provides access to a creature's or placeable's inventory and equipped items.
Remarks
The nGetItemsOptions filter is not a bit field, i.e. you cannot use the bitwise or operator to combine options.
The nBaseItemType filter does not work on placeable's inventories.
Examples
// Remove all equipped items from a creature and put them in the creature's inventory. void UnequipAllEquippedItems(object oCreature) { int nItem; object[] oItems = GetItemsInInventory(oCreature, GET_ITEMS_OPTION_EQUIPPED); int nItems = GetArraySize(oItems); for(nItem = 0; nItem < nItems; nItem++) { UnequipItem(oCreature, oItems[nItem]); } }