question

kosar avatar image
kosar asked

Player Inventory

Hello everyone, its me again haha. Apologies for asking alot of questions lately. But there is not alot of documentation for Unreal Blueprint to go about. So this forum is all I can do.

Question time. I want to extract the player Inventory after calling the Get User Inventory.

For instance, I have made the catalogue and store along side an item which I have called Pistol_1.



How can I retrieve this item?

Player DataPlayer Inventory
inkedcapture-li.jpg (484.8 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Hernando avatar image
Hernando answered

You can extract them in turn through the ForEachLoop node. And modify the "Field Name" of the Get Field node to the key which you want.

The blueprint in the above picture will print out the ItemId of all items in player's inventory.

If you are not sure which information can be retrieved from the Get User Inventory node using the Get Field method, section “Response Details” in GetUserInventory will be helpful for you. Here it prompts you to use these keys: ItemId, ItemInstanceId, ItemClass, CatalogVersion...you can also get this information form Postman. Other APIs are similar.

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "Inventory": [
      {
        "ItemId": "shield_level_5",
        "ItemInstanceId": "9879843",
        "ItemClass": "shields",
        "CatalogVersion": "5",
        "UnitPrice": 0
      },


      .
      .
      .

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kosar avatar image kosar commented ·

Thanks for that Hernando. One more thing. Is the same method applies if we want to store something in the inventory?

0 Likes 0 ·
renhe avatar image renhe kosar commented ·

Sorry for my late reply, It is recommended that you can call GrantItemsToUser on the server (or CloudScript), for security.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.