ludovicsadri-faure avatar image
ludovicsadri-faure asked

Bonus items on first bundle purchase

We wish to add a feature to some of our bundles, and I'm not sure how to do it.

Basically, we want to give (for example) bonus items the first time each player buys the bundle.

I didn't find a similar feature in the bundles page, and I believe there's currently no API endpoint to access a player's purchase history (to check whether they have already bought the bundle or not)

My current workaround idea is something like this:

Create a player statistic for each affected bundle.

Create a rule that increments the statistic when the player buys the bundle (or when the bundle item is added to their inventory).

Create another rule that gives the bonus items when the statistic is changed and its new value is 1.

Obviously this is not an ideal way to do it. Is there anything I'm missing to make it better?


In-Game EconomyPlayer Inventory
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

Gosen Gao avatar image
Gosen Gao answered

For the feature to give additional items the first time players purchase a bundle, I think the most important part is to store the status information whether the bundle was purchased for the first time or not. Since Statistic has a maximum limit of 300, “Create a player statistic for each affected bundle” may take some resources. I would recommend that you can use Player Data to store the status all in one key/value pair. The workflow should be something like below.

  • 1.Create a Key/Value pair in Player Data to store the list of purchased bundles.
  • 2.Create a Rule to execute a Cloud Script when the bundle is added to the inventory.
  • 3.In that Cloud Script, you can check if the current bundle is in the list. If not, give the player additional items, and add the current bundle to the list.

BTW, if not all of the bundles need such a feature, you can either edit the rule to restrict condition to specify which bundles will trigger the rule, or you can change the data structure of that Key/Value pair to store more info to meet your needs.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ludovicsadri-faure avatar image ludovicsadri-faure commented ·

Thanks for your answer, I thought about using PlayerData but ideally I'd like to do it without using Cloud Script functions, and we won't reach the Statistics limit of 300 anytime soon.
It seems there's no easy way to achieve this feature, so I'll try using Statistics and keep your suggestion in mind if needed.

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.