question

Michal Töpfer avatar image
Michal Töpfer asked

Event properties in PlayStream actions

I mean when creating the action, it could be possible to use some of the event's properties as the input.

Example: Increment player statistic: Change by (whole number)

com.playfab.player_statistic_changed.StatisticValue

or only

StatisticValue

Detailed Example: I want to have several level packs in my game and for each of them, I have a statistic that tells me, how many levels of the pack the player has played. I also want to have a statistic that will show how many levels the player played in total (a sum of all the statistics for each level pack). I know this is achievable through Cloud Script, but it seems to me like a really good and powerful enhancement to PlayStream. So I would create an action on player_statistic_changed with conditions that will match my level packs statistics and the action will be Increment player statistic TotalLevelsPlayed by value

StatisticValue - StatisticPreviousValue
Leaderboards and Statisticsgame managerPlayStream
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

Actually, you can do this now, though what you really want is to use a Segment, so that you can use the Segment Enter to trigger the Action you want. For an action that's triggered when a statistic value gets to a certain point, you could set it up with the Conditions being StatisticName equal to your stat's name (ID), and the StatisticValue being the value you're looking for. However, if you set it to be equal to that value, you run the risk of missing that number in some cases, or hitting it multiple times if the value can go down. Meanwhile, if you use greater than, the Action will fire every time the player ups that statistic past that point. But if you use a Segment, you can set the Segment's conditions up the same way, but then only trigger the Action when the palyer enters the Segment.

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

Michal Töpfer avatar image Michal Töpfer commented ·

I probably meant something a bit different. My case is not just once enter the segment, but every time the player plays a new level, I want to increment levelsPlayedInPack1 (or Pack2, ...) and also LevelsPlayedTotal stats. As I wrote, it is not hard to do in CloudScript, but I think this would add a lot of freedom to PlayStream.

0 Likes 0 ·
brendan avatar image brendan Michal Töpfer commented ·

So is the issue that you don't want to use a Cloud Script in the Action to set the values, but rather, simply increment the values as the action? If so, you can still do this now by using the SegementName and SegmentValue as the Conditions, as I described above, and IncrementPlayerStatistic, as you described in the question. What do you feel is missing from this?

0 Likes 0 ·
Michal Töpfer avatar image Michal Töpfer brendan commented ·

I probably don't understand your answer with segments. I thought that when you have a segment, then something happens if player enters or exits the segment. But in this case I would have a lot of possibilities for the stats. Do you mean using multiple segments for that? I just want to have a stat that is sum of two (or more) other stats and updates whenever one of the stats changes (up or down).

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.