Hello!
I am setting up a store you can use with the coins you got through the game… It’s supposed to disable the button once you buy the powerup, but if you exit the store, and re enter it, you can buy it again… How can I save the disabled button so it remains disabled? I’ll leave the button blueprint just in case
It’s hard to say exactly where your system is going wrong there because some parts are missing ( is there a save game load somewhere? ), and some of it doesn’t make sense ( why deduct 0 from coins and player coins? ).
But generally speaking the problem will be one of two things:
-
Somehow you are not saving the fact the user has purchased the coins
-
You are saving this fact, but elsewhere in your code you are updating the save game without loading it first, which will wipe anything that was stored there.
Number 2 is a common problem with using a save game variable.
Hi @ClockworkOcean
the load is made when the game is first opened (there also checks if it exists and creates one it it doesn’t)
and it deducts 0 because I was testing it (real cost is 300)
To check if they purchase, do I create a boolean variable to save?
In the code there I’m saving only the coins used, not the fact that it was purchased
You could just save a bool. If they have already done this, the button just wont work.
I only saved numbers so far (integer) is saving a boolean the same? or do I need to add aditional info?
Im sorry if this sounds dumb, I’m still learning UE4 and i have very little knowledge of coding
Saving a bool is exactly the same as saving a float or integer. It’s just a variable
Oh, I’ll try that then!
Thanks!