I get this error message. What is wrong with my rule? Title is over the limit of 3 for ActionTriggerCount. No more can be created until some are deleted.
It's the first time that I create a rule. I want to create a rule that checks if the player has finished the current level the very first time. I f yes, then create a rating based on his score and add 100 gold coins to his account.
https://api.playfab.com/docs/tutorials/landing-automation/using-cloud-script-actions-with-playstream
I followed this tutorial but I'm not sure if my CloudScript is correct.
What are the last two lines doing? Are they necessary?
var content = JSON.stringify({user: profile.PlayerId, event: psEvent.EventName}); var response = http.request('https://httpbin.org/status/200', 'post', content, 'application/json', null, true);
Is it possible to get the rating somehow displayed in the client or is it not possible to return something from the function handlePlayStreamEventFirstTimeLevelFinished in my game?
CloudScript:
handlers.UpdateLeaderboard = function (args, context) { ... var isfirsttime = true; var resultevent = server.WritePlayerEvent({ PlayFabId: currentPlayerId, EventName: "player_finished_level_first_time", Body: { "IsFirstTime": isfirsttime.toString(), "Comment": "The player finished this level the first time.", "Level": args.Level.toString(), "Playerscore": args.Playerscore.toString() } }); if (resultevent.Error == null) log.info("Writing player_finished_level_first_time event successful."); else log.info("Writing player_finished_level_first_time event not successful."); } handlers.handlePlayStreamEventFirstTimeLevelFinished = function (args, context) { // The event that triggered the action // (https://api.playfab.com/playstream/docs/PlayStreamEventModels) var psEvent = context.playStreamEvent; // The profile data of the player associated with the event // (https://api.playfab.com/playstream/docs/PlayStreamProfileModels) var profile = context.playerProfile; var level = context.Level; var playerscore = context.Playerscore; var rating = ""; if (Number(playerscore) < 50) { rating = "Not bad for your first time."; server.AddUserVirtualCurrency({PlayFabID: currentPlayerId, VirtualCurrency: "GO", Amount: "100"}); } if ((Number(playerscore) >= 50) && (Number(playerscore) < 150)) { rating = "The first time and already a professional."; server.AddUserVirtualCurrency({PlayFabID: currentPlayerId, VirtualCurrency: "GO", Amount: "100"}); } if (Number(playerscore) >= 150) { rating = "Is this the first time you played this level? This was amazing!"; server.AddUserVirtualCurrency({PlayFabID: currentPlayerId, VirtualCurrency: "GO", Amount: "100"}); } log.info("Level: " + level + "Your highscore: " + playerscore + " " + rating); log.info("Congratulations! You just got 100 gold coins for finishing " + level + " the first time."); // Post data about the event to an external API var content = JSON.stringify({user: profile.PlayerId, event: psEvent.EventName}); var response = http.request('https://httpbin.org/status/200', 'post', content, 'application/json', null, true); return { externalAPIResponse: response }; }