Talk:GetItemCount

From GECK
Jump to: navigation, search

New Vegas

This function seems to change when dealing with Level Items that are no longer in the originating container.

Using the Level Item "FoodLiquorHard100" as an example, lets say there's a container that has 3 of them in it. What spawns in the container would be something like:

  • 2 Beer
  • 1 Vodka
  • 3 Whiskey
  • 1 Wine

Running [GetItemCount] on "Beer" will return "2", Vodka "1", Whiskey "3", etc (IE correct). But, after the player takes all of the items out of the container, it should return:

  • 0 Beer
  • 0 Vodka
  • 0 Whiskey
  • 0 Wine

But instead, returns:

  • 1 Beer
  • 1 Vodka
  • 1 Whiskey
  • 1 Wine

Any item from the Level Item list originally spawned in the container will return "1" even if there are now "0" and even though there were more than "1" at spawn.

The logic seems to change from "how many are in the container?" to "was this item in a LVL List that spawned in the container?".

If you place an actual "Beer" item in the container (not a LVL Item container Beer), it will always return the correct count. IE, if you place 3 Beers in the container, GetItemCount will return "3". After the player (or whomever) takes them, it will return "0".

Hopefully this is just a bug that gets patched.

Discussed in the forums here: GetItemCount returning 1 for Level Items in containers

Inventory reference

I stupidly used this function on an inventory reference. That put my script to a halt. Only use base references on this function.


Player.GetItemCount EquippedWeaponRef


"GetEquippedItemRef" was previously used on EquippedWeaponRef, but I needed to switch to "GetEquippedObject" for being able to process the script.--JustChill (talk) 20:23, 5 April 2019 (UTC)