Hey Everyone! Welcome to my first ever GDevelop Community Tutorial!
(Not gonna lie, there should be a tutorial subtopic for the community topic)
In this tutorial I will teach you how to set up a Month Checker, to tell what month it is for a player! This system works online and partially offline. Now you are probably thinking “Snowy! Can’t you just use time(“mon”)?” Yes, you can use that, but that is easily abusable and can lead to people changing their month VERY easily. This system uses online verification to verify the current month, so that people don’t skip ahead months.
Small note before we start, people CAN STILL bypass this system if they really want to. This is not a 100% guaranteed working system, it just stops the average user from bypassing.
Notes before we start:
When using storage in this system, make sure you are saving & loading TEXT not save and load a value. If you use save or load a value, the system won’t work! ![]()
Set up 2 variables named MonthJson and MonthError, both text variables with a text of “nil”.
Next, set up a web request with these parameters. This asks the website for the API showing the time, and saves it in a JSON text variable.
Now create 2 more variables named MonthStructure (empty structure) and MonthScene (“nil” text).
Now wait 3 seconds, and convert JSON string “MonthJson” to variable “MonthStructure”. The reason we wait 3 seconds is because sometimes it takes the GET request a few seconds to load.
Now if the MonthJson is NOT equal to nil, that means it has successfully got the API from the website, and we can continue to get the Day of Year from the structure. Now your MonthScene variable will equal whatever day of the year it is.
Now at this point, you may want to create a label called “OfflineLabel”. All this does it display to the player whether they are in Offline Mode or not. The system will STILL WORK if you don’t have this label, it is completely optional. In this tutorial example, I am setting it so the position of my label starts at 100, 100 (on screen) and gets moved to 100, -100 when I want the label to go off screen (hence the player being in online mode).
Now we just do a quick double check here that MonthScene is not “nil” or “0” meaning that we have a valid month and the player is in online mode. Since they are in online mode, we move the label off screen.
Now set up a global variable called “CurrentMonthOnline”. This variable will track what the current online month is.
Now we run all these checks to pretty much sort the day of the year into each month.
This system is off by 1 day on leap years, but it isn’t that noticeable.
Small check to see if the storage exists. If it doesn’t the player will be in offline mode and text label will appear for them.
Create a new scene variable and name it “OfflineMonthDoubleCheck”.
Now we double check the player is offline. If there are offline the MonthError will not be equal to nil, and the MonthJson will be equal to nil. If they are offline, we load a TEXT from the month storage. Remember, load a TEXT not a value.
Lastly, we check if the OfflineMonthDoubleCheck is equal to the local month + 1. The reason we use the +1 here is because our storage month is saved as January is 1, February is 2, etc. The local time will be saved as January is 0, February is 1, etc. What this does is verifies that the local time is still the same month as what we have saved from offline. If so, it lets them proceed.
Well, that’s the end of this tutorial! Once it’s complete you should have the CurrentMonthOnline variable saved as the number of the current verified month. Otherwise, the CurrentMonthOnline will be “nil” and the player will be put into offline mode!
Thanks for reading and if you have any questions or ideas, let me know!












