question

fiercy avatar image
fiercy asked

Sending the Data to the Cloud Script.

I have a question is there an example somewhere on how to make an Event in Unity to invoke a function on the Cloud Script and pass it some data like and PlayFab ID's for the players and the amount of virtual currency to subtract from all of them or at least how to send that number.

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

·
brendan avatar image
brendan answered

Can you explain at a game design level what it is you're trying to do (the actual gameplay experience)? It's usually best to start from a top-down level, so that we can identify the best approach. It is possible to trigger a Cloud Script from a PlayStream Action, and the details of the event are passed into the Cloud Script handler when that happens. But an event is specific to a single player, so I'd like to make sure you mean acting upon a single player in this call.

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

fiercy avatar image fiercy commented ·

I have a card multiplayer game built with photon and I want to shuffle chips from losing players to the player who won in the cloud script. My idea was that player who lost would be calling cloud script function to subtract chips and player who won would be sending an event to add chips but i need to send the number of chips to the cloud script.

0 Likes 0 ·
brendan avatar image brendan fiercy commented ·

Well, given that it's Photon, you could conceivably drive this off the PlayerLeft action from Photon, and only distribute rewards when the last player leaves the room (assuming you're tracking on game info in Shared Group Data). But you may also want to consider moving this logic to a custom game server, in order to have more control over it.

0 Likes 0 ·
fiercy avatar image fiercy commented ·

I have a multiplayer card game and at the end of the round, I just want to subtract chips for players that lost and give them to the player who won. I imagine to prevent cheating the cloud script is the way to do it but I need to give it that number.

0 Likes 0 ·
brendan avatar image brendan fiercy commented ·

As I said, you have options, then. You can perform this operation in Cloud Script, or in a custom game server. Either one would give you the ability to have server authority over the operation, but which you go with is dependent upon your requirements.

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.