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

How to code "save inventory" and "load inventory" with free.I do not want to buy Nobles.

brian_poon

New member
Joined
Aug 12, 2021
Messages
1
Reaction score
0
How to code "save inventory" and "load inventory" with free.I do not want to buy Nobles.
 
Solution
On leave, append list with the hotbar, inventory and armor game values then append value offhand item.
On join, repeat for each in list and increase the index (a number to keep track of the position) by 1, then use SetSlotItem to set the item at that index to the loop item.



1628827786713.png

bumpy

Forum adept
Overlord
Joined
Oct 6, 2020
Messages
113
Reaction score
35
On leave, append list with the hotbar, inventory and armor game values then append value offhand item.
On join, repeat for each in list and increase the index (a number to keep track of the position) by 1, then use SetSlotItem to set the item at that index to the loop item.



1628827786713.png
 
Solution

Vulcano

Forum adept
Overlord
Joined
Sep 11, 2020
Messages
251
Reaction score
65
On leave, append list with the hotbar, inventory and armor game values then append value offhand item.
On join, repeat for each in list and increase the index (a number to keep track of the position) by 1, then use SetSlotItem to set the item at that index to the loop item.



View attachment 905
KEEP IN MIND this is not a good alternative for those with a rank. This takes up saved var space, which save inventory does not.
 

bumpy

Forum adept
Overlord
Joined
Oct 6, 2020
Messages
113
Reaction score
35
Player Event [Join] {
Player Action [Give Item] { (%default Inv) }
Player Action [Set Armor Items] { (%default Armor) }
Player Action [Set Equipment (OffHand) ] { (%default Offhand) }
}

Player Event [Leave] {
Set Variable [=] { (%default Inv) (Game Value [Item Values - Inventory items]) }
Set Variable [=] { (%default OffHand) (Game Value [Item Values - OffHand item]) }
Set Variable [=] { (%default Armor) (Game Value [Item Values - Armor items]) }
}

All variables should be SAVE
generally explaining code to a new player like this isn't a good idea. some people would find it "confronting".
 

stinkey

Forum adept
Joined
Sep 8, 2020
Messages
225
Reaction score
74
KEEP IN MIND this is not a good alternative for those with a rank. This takes up saved var space, which save inventory does not.
keep in mind that any plot will take up var space and this is not going to matter for most plots
 

Vulcano

Forum adept
Overlord
Joined
Sep 11, 2020
Messages
251
Reaction score
65
keep in mind that any plot will take up var space and this is not going to matter for most plots
Yes, but items take up a large amount, and it is optimal to avoid when you have a rank. There is no reason not to use save/load inventory
 

Magnus6109

New member
Joined
Jul 3, 2023
Messages
1
Reaction score
0
On leave, append list with the hotbar, inventory and armor game values then append value offhand item.
On join, repeat for each in list and increase the index (a number to keep track of the position) by 1, then use SetSlotItem to set the item at that index to the loop item.



View attachment 905
I'm confused, could you send a screenshot of the block code? It seems to duplicate items weirdly.
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,260
Reaction score
356
I'm confused, could you send a screenshot of the block code? It seems to duplicate items weirdly.
it's because of the Hotbar Items game value, remove it and it should work since the Inventory Items game value already has the hotbar items.
 
Top Bottom