Is there a way to implement a daily reward system in Buildbox right now? is there a way to do this by clicking on the button every 24 hours or starting the game by watching the award-winning video?
I think this is what I would do: go to your game's start UI, go to the Asset Library, add the yellow button object (you can change the image later). Double click on it, add the custom script node, and double click on the node. In the script, change your init() function to look like this: function init(){ if(Settings['startTime'] == undefined) Settings['startTime'] = new Date(); var currentTime = new Date(); var elapsedTime = (currentTime - Settings['startTime']) / 1000; log(elapsedTime); if(elapsedTime > 72000){ // Here you can display the button, for example, maybe the button is off-screen, // now change its X position to be on-screen. } I personally chose the button to unlock the reward after 20 hours (72000 seconds), but you can change it to whatever you want. Every time you go the menu, you can check the log and see how many seconds have passed. Whenever the user clicks the button to collect the rewards, add this: Settings['startTime'] = new Date();
I also want to add, when the user clicks the button, delete it or move it back off-screen after this: Settings['startTime'] = new Date();
You should remove Settings['startTime'] = new Date() from the start() function. When the button it touched, it should trigger a new custom script with Settings['startTime'] = new Date() in the signal() function: function signal(){ Settings['startTime'] = new Date(); }
This might be a bit late (and a bit dumb), but how do you make the yellow object a button which you can press on
@sws While I am trying to run this script to award daily reward I am getting error as elapsedTime is not defined in log while running the script ?