Solved Any way to save what inventory slot

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

BatDev0

Member
May 16, 2020
25
2
3
17
Hey!

I am trying to create a command that saves all inventory items to a list. But when I try to load the inventory, it just randomly picks what slot to load. Any way I could save the slot?
[doublepost=1649709502,1649445765][/doublepost]
Code:
function saveInventory(p: player):
    set {s} to 1
   
    loop player's inventory 35 times:
        set {%{s}%::loop} to loop-item
        set {inventory:%player%:%{s}%} to loop-item
        add 1 to {s}
       
function loadInventory(p: player):
    set {_optionalLoopCount} to 1
    loop player's inventory 35 times:
        set slot {s} of loop-player's inventory to {%{s}%::loop} 
       
        add 1 to {_optionalLoopCOunt}
       
    if {_optionalLoopCount} is 36:
        send "Loading Finished | SkInventory" to player

I figured it out, might not work haven't tested yet.
 
Status
Not open for further replies.