question

joeypc6 avatar image
joeypc6 asked

How To See Other Players Inventory

So in The Past Week I Had An Idea That I Want My Player To See Others Inventories

So I Made This :)

handlers.GetOthersInv = function (args,ID){


    var inventory = server.GetUserInventory({ PlayFabId: args.ID});
  
     for (var i = 0; i < inventory.Inventory.length; i++) {
       if (inventory.Inventory[i].ItemClass == "Inventory"){
        log.info(inventory.Inventory[i].DisplayName + " x" + inventory.Inventory[i].RemainingUses);
       }
    }


}


CloudScript
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

·
Andy avatar image
Andy answered

Great! That's a good way to go about it. Did you have a question?

7 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.

Andy avatar image Andy ♦♦ commented ·

Also, one thing to be careful about is how many different players you have reading from a single player's inventory. That can lead to bad things. If it's more distributed or based on matchmaking or something like that, no problem.

0 Likes 0 ·
joeypc6 avatar image joeypc6 Andy ♦♦ commented ·

I have An Island -based game and every island can get up to 8 players they work to upgrade their Island with a bit of resource mangment and fighing

0 Likes 0 ·
brendan avatar image brendan joeypc6 commented ·

And what data do the players need to request from each other? How are you planning to manage state for the island? Given the design, it sounds like you'll require a fairly high rate of data exchange between the players, so are you using a custom game server or are you simply trusting the clients to share the data without cheating? If your thinking was that you'd use Cloud Script, you'll need to make sure the call rate is low enough for this to be supportable - a few calls per minute, at most. Ideally, one at the start to set up the session, one every once in a while to checkpoint, and one at the end to validate and finalize the session.

0 Likes 0 ·
Show more comments

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.