I need help making a save file or code for my game please

Do you mean save it to the map?

What I mean is, what kind of save file?

no a save code

I need help making a save file to save money, med packs, and shield cans and corn

NOT how to save a map for future editing. I need help making a system so that players can import a save file and get their progress back.

You could make a system that if it senses that code it will give you that stuff.

can you help to do that

Hmmm maybe :smiling_imp: maybe.

(?)

please can you help me

No, not in the game but I will make a guide I guess.

2 Likes

ok, thank you a lot GimGamer1

Just adding some context here.

This post is a continuation of this one if I’m not mistaken
https://forum.creative.gimkit.com/t/i-need-help-making-a-save-file/62943/15

I believe @Kosm0-o was in the process of simplifying this guide before it closed.

3 Likes

Since you’re creating a save file for money, medpacks, and shield cans, you will need an inventory item manager for each of them along with their own number-type, player-scoped property. Make each inventory item manager update their corresponding property (i.e. money manager updates the “money” property). Now have all 3 properties broadcast on the same channel when they update (ex. the properties broadcast on the “saveCodeUpdate” channel). Get a button that says “Export Data”/“Get a Save Code” and wire it or “channel it” to a popup. Make the popup have a header of “Your Save Code” or something like that. Create a block that runs when receiving on the (ex. “saveCodeUpdate”) channel that the properties broadcast on. In the blocks, make this:

Creating and exporting your save code/file is now complete!


Now to import the data, just have 3 counters, that each represent the amount of one of the 3 items. Get 3 new properties that are copies of the 3 properties you already have but add this to the end of the names of the new properties: “Grant”. Ex. if you had a “money” property, the copied version of it would be “moneyGrant”. Make the counters update their corresponding “----Grant” property. Get 3 new buttons (or triggers), one titled “+1”, one titled “-1” and one titled, “Next Digit”. Make the “Next Digit” button increment a new counter. Have this counter track a new, player-scoped, number-type property (ex. “digitNum”) and make sure the counter’s default value is 1. Give the counter a target value of 4, and when it reaches it’s target value, make it broadcast on channel “resetImportCounter”. Also have the counter reset when receiving on “resetImportCounter”. Get the +1 and -1 buttons to broadcast on their own channel when pressed (i.e. the +1 button broadcasts on “addOne” and the -1 button broadcasts on channel “subtractOne”). Get 6 checkers, with 2 of them checking if the “digitNum” property is equal to 1, 2 of them checking if the “digitNum” property is equal to 2, and the last 2 checking if the “digitNum” property is equal to 3. Now give 1 of each checker to the +1 and -1 buttons (1,2, and 3 checker for +1 and 1,2, and 3 checker for -1). Let’s start with the +1 button’s checkers. Make each of it’s checkers check when receiving on channel “addOne” and if the check passes then the checker broadcasts on it’s own channel (i.e. the 1 checker broadcasts on “addOne1”, and the 2 checker broadcasts on “addOne2” etc). Now make the 3 counters from before increment when receiving on one of the checker’s channels (ex. the 1st counter increments when receiving on channel “addOne1” etc). Repeat what you did for the +1 button and it’s checkers but for the -1 button and it’s checkers. Make sure that the checkers broadcast on a channel to decrement the counters, not increment. Get a new button that has the message of “Import Data”/“Use Save Code” or something like that. Make it broadcast on a channel (ex. “importData”). Get 3 item granters: one item granter grants money, one item granter grants medpacks, and the last item granter grants shield cans. Create a new block for each of the item granters and make sure that the block runs when receiving on channel “importData”.
Finally, in each of the blocks have this block code but modify it depending on which item it is:

Note: the property that is in the blocks will be changed based on the item granter. Ex. if the blocks above were used for the money item granter, then the dashes would be swapped with “money” making the 1st property (the property labeled 1) be “money” and the 2nd property (labeled 2) be “moneyGrant”.

What the blocks do is set the player’s money to 0 (Idk if you can have negative of an item so I used different block code just in case) so that they can’t cheat the save code system and get infinite resources. After the blocks subtract the money, it grants the money from the imported data.

Last Step!!!:

Get a new trigger with a delay of 1 second (make sure player collision is off!) and make it trigger when receiving on “importData”. Also, make it broadcast on channel “resetDataCounters” when it’s triggered. Make the 3 counters that track the “----Grant” properties reset when receiving on the “resetDataCounters” channel.


All done! FINALLY!

This took me a bit of a while to write so if you don’t understand it then I’ll be darned.
If you just don’t understand some parts of it feel free to reply and ask a question so I can clarify!

7 Likes

Also, don’t forget that camel casing rocks!

1 Like

Of course it’s possible anything is possible if you put your mind to it

unless their are limitations. then you just wait for the limitations to be broken.

2 Likes

can you add more images please

on what exactly? where in the guide?
The counters?

2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.