I wanted to change the player's data when he buy some special goods. I don't know whether the CloudScript can run client function. If it can't, can I trigger a CloudScript when the client runs a purchase API Call?
I wanted to change the player's data when he buy some special goods. I don't know whether the CloudScript can run client function. If it can't, can I trigger a CloudScript when the client runs a purchase API Call?
Yes, you could set an Action in PlayStream to call into your script whenever the player_vc_item_purchased event occurs (or the player_inventory_item_added on, if you also want to catch any case where it is granted to the player, whether by a server call or via the game manager).
Is there a way to access the client api from cloudscript? I was looking at something similar, but instead of updating data, I wanted to return data. I can just make separate calls, but was trying to be efficient -- I wanted to return both the GetCharacterInventoryResult and purchasedItem in one call (after the item is purchased, return a new inventory list)~
Also, since PurchaseItem requires a session, it's considered "safe/good practice" to purchase an item client-side, right?
Just making sure!
That's correct - purchases should be made client-side (in part because that should always be directly due to a player action). The Client API is not available to Cloud Script, but if there's a specific API call that's needed in the Server API, that'd be good to add to the Feature Requests forum.
2 People are following this question.