In-App Purchases not being saved
ferzheng
Member, PRO Posts: 40
Hello everyone,
I have a problem saving an attribute in a Consumable:
The configurations seem to be all right (the attribute expression in the Save Attribute is "game.Coins" so it is right), but when i quit the game and open it again they are 0 again.
Another issue is about using those Consumables to purchase Lives, i mean, the real IAPs are the Coins, and i made a button to buy Lives with those Coins purchased previously.
Here is a screenshot of the rules:
When i quit the game and re-open it, the Lives are not saved either.
In simple words, when i quit the game and re-open it, both the Coins and the Lives become 0.
Is there anything wrong with my configurations?
I would really appreciate your help!!
Thank you guys!
Comments
Are you using the load attribute behavior at the beginning of the game?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
@Summation
Thank you very much for your reply.
1) Despite being a consumable?
2) Where should i put them? In the beginning scene or in every scene?
It doesn't matter if it's a consumable or not, the attribute is just the game's way of keeping track of it.
I know many people like to use tables to keep track of the same information because tables are automatically loaded at the beginning when your game starts.
So if you have your things in there like lives, coins, or whatever, all you have to do is save the table.
But if you don't want to do that, then all you should have to do is load the attribute one time at the beginning of the game.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
@Summation
Thank you for your reply. I have done that, i created an actor and placed it in the 1st scene, but they still appear 0 when game is quit and re-started. Here are the configurations of the actor:
I know they should work because everything seem to be right. But it just won´t save the values...
@ferzheng On your save and on your load, did you type the key directly into the box, or did you type it into the expression editor?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
I tried both things:
When they were typed directly into the box, both stayed 0 as before.
When i tried typing them in the expression editor both of them became the number of the Coins i purchased, even if i did not purchase any Lives with the Coins.
I deleted all Load Attribute behaviours for the Lives and that seems to have solved the problem but only for the Lives.
In the case of the Coins, they are saved for the next time i open the game, but every time with the same value of the purchased.
I mean, if i purchased 100 Coins, and when playing the game i collected 5 more Coins, which would be 105 now (and Save Attribute behaviour is applied), i re-open the game and the Coins are 100 again!
But which configuration should be the right one in the "key" section as regards loading and saving the attribute? Typing them directly or through expression editor? Because all my save attribute behaviours´"key" section are filled with expression editor.
P.D: this may be out of topic, but i used to receive email notifications every time any of you guys answered or commented in a discussion i opened, but it seems those mails stopped arriving, is there any section in My Account where i can see if anything has been changed?
Thank you!!
@Summation
Everything solved!! Yes! EVERY load and save attribute behaviour "key" section MUST be filled directly! It is a common mistake as @gingagaming said in another post.
It is so weird, what and when should we use the expression editor to write something in the key section?
The expression editor is not for writing. Any text in the expression editor should be contained in "quotation marks"