Hi everyone,
I am making a MOBA game. I managed to get store working so that players are able to purchase a Hero from store. However, at the moment the item goes directly to player inventory after purchase. I have set the Hero item to be a Token for Character Creation. Is there a way to automatically consume the item when player purchase a Hero then add that Hero to Character List that the player owned?
Thank you for your reply and support
Best Regards,
Active Dream
Answer by Andy · Oct 09, 2018 at 07:42 PM
While you can set items to be consumable and automatically consume after a fixed period of time, that's not going to be a complete solution for you in this case. In order to redeem an item for a character, you have to call GrantCharacterToUser (client or server version). My preference is generally to do that myself versus rely on automation.
You could, if it fits within the structure of your game, set up a rule that triggered on player_consumed_item with a matching itemId. This rule could then execute cloud script, which would then grant the character. Do be aware if you go this route, though, that cloud script executed as part of automation like this has lower limits when it comes to execution time and API call count.