we’ll make a save code for money, med packs, and shield cans or whatever. 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 or whatever.
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.
Now to this
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.
Now End of game Widget code
Now get a end of game widget and property
name it ‘‘save code’’ make property type text and set the end of widget to the new property
Now get lifecycle and relay wire them to each other ‘‘event occurs →Triggers relay’’
Now get two wire repeater and wire each other up
set the first to this
second leave as is. now wire relay to first wire repeater
now get a trigger and set block code this
and wire second wire repeater to the tirgger⬇
and it look likes this
All done! FINALLY!
Feel free to reply and ask a question so I can clarify!
thanks to Kosm0-o for the help. it mean’s alot to me
- 1/10 or
- 2/10 or
- 3/10 or
- 4/10 or
- 5/10 or
- 6/10 or
- 7/10 or
- 8/10 or
- 9/10 or
- 10/10 or /(there’s no way)