• Hey! Register here to create your account, engage with the community, and talk about what is new!

Saving inventories shouldn't be Noble exclusive

HackerDragon9999

Forum adept
Joined
Jan 18, 2023
Messages
114
Reaction score
20
There is an extremely easy workaround for unranked players, so the Noble-exclusive code block is just a shortcut. If you don't know the workaround, learn it!

Save inventory workaround:
fn(SaveInv):
%default SavedInv = gameValue(InventoryItems)
%default SavedArmor = gameValue(ArmorItems)
%default SavedOffhand = gameValue(OffHandItem)
Then put the SaveInv function where you want players' inventories to be saved.

Load inventory workaround:
fn(LoadInv):
ClearInv()
GiveItems(%default SavedInv)
SetEquipment(%default SavedOffhand, #OffHand)
SetArmor(%default SavedArmor)
Then put the LoadInv function where you want players' inventories to be loaded. The way the inventory is organized is not saved.

Sorry if my code is confusing.
Since there's a workaround that only takes a few extra blocks, it reduces reason to buy Noble.
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,263
Reaction score
353
The problem is, saved variables have a limit, the limit is between 4 and 7 megabytes depends on how the code/database compresses them. Unfortunately, saving like 50 players with all of this data will get to the limit and no more players' inventories will be saved :frown:.
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,263
Reaction score
353
Also, one more thing, replace the %default with %uuid so the saved variables stay even when the player changes their name.
 
Top Bottom