Description
Wiki Description
Returns how many of the specified item is in this reference's inventory.
Documentation Comment
Returns how many of the specified item is in this object reference's inventory
If None is passed, it counts every item in the inventory
Caveats
CK Wiki - Notes
- if using a keyword for akitem the keyword must be defined on the base form. Keywords added at runtime are ignored by this function.
Parameters
FormakItem=NONE
CK Wiki Description
The item to look for in this reference's inventory.
- If a reference, will look for just that particular reference.
- If a base object (like armor or a weapon), it will count the how many instances of that base object are in the container
- If a form list, it will count how many of each item in the form list is in the container and sum it all up
- If a keyword, it will count how many items with that keyword are in the container
- Note:keyword must be defined on the base form.
- If None, will count how many items are in the container in total
- Default:None
Examples
if (Game.GetPlayer().GetItemCount(WeapTypeSwordKeyword) == 0)
Debug.Trace("Player has no swords")
endIfif (Game.GetPlayer().GetItemCount(SuperSecretPotionReference) == 0)
Debug.Trace("Player doesn't have the super-secret potion")
endIfAuto-Generated Example
Form myForm__akItem
int returnedValue = myObjectReference__toCallFunctionOn.GetItemCount(myForm__akItem)Related Pages
Additional References
View this function’s page on the Fallout 4 Creation Kit Wiki
