Saving Items with NBT (1.7.10)

  • 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.

AlexJW

Member
Jan 26, 2020
3
0
0
21
Code:
on death of player:
    if {souls.%player%} is greater than 3:
        send "&e&lMandalorian MC &8» &fOnly the middle part of your inventory dropped because you have &e%{souls.%player%}%x &fsouls." to victim
        set {_templocation::%victim%} to the block below the victim
        set block above {_templocation::%victim%} to chest named "&8Player » &f%victim%"
        set block 2 above {_templocation::%victim%} to red carpet
        add the victim's skull to the inventory of the block above {_templocation::%victim%}
        loop numbers from 9 to 35:
            add the victim's slot loop-number with the item's nbt to the inventory of the block above {_templocation::%victim%}
            set slot loop-number of player's inventory to air

How could I add the NBT data information from SkStuff to the items in the chest?
 
Code:
on death of player:
    if {souls.%player%} is greater than 3:
        send "&e&lMandalorian MC &8» &fOnly the middle part of your inventory dropped because you have &e%{souls.%player%}%x &fsouls." to victim
        set {_templocation::%victim%} to the block below the victim
        set block above {_templocation::%victim%} to chest named "&8Player » &f%victim%"
        set block 2 above {_templocation::%victim%} to red carpet
        add the victim's skull to the inventory of the block above {_templocation::%victim%}
        loop numbers from 9 to 35:
            add the victim's slot loop-number with the item's nbt to the inventory of the block above {_templocation::%victim%}
            set slot loop-number of player's inventory to air

How could I add the NBT data information from SkStuff to the items in the chest?
so far i f changed code a little bit but i'm getting other error :emoji_unamused:
Code:
on death of player:
    if {souls.%player%} is greater than 3:
        send "&e&lMandalorian MC &8» &fOnly the middle part of your inventory dropped because you have &e%{souls.%player%}%x &fsouls." to victim
        set {_templocation::%victim%} to the block below the victim
        set block above {_templocation::%victim%} to chest named "&8Player » &f%victim%"
        set block 2 above {_templocation::%victim%} to red carpet
        add the victim's skull to the inventory of the block above {_templocation::%victim%}
        set {random} to a random integer between 9 and 35
        loop {random} times:
            add {random} of the victim's slot with the item's nbt of the inventory to the block above {_templocation::%victim%}
            set slot {random} of player's inventory to air
ERROR : '{random} of the victim's slot with the item's nbt of the inventory' can't be added to a block because the former is neither an item type nor an inventory (test.sk, line 10: add {random} of the victim's slot with the item's nbt of the inventory to the block above {_templocation::%victim%}')
 
I’m not sure why you would use a random value, my code works with no errors, but when it puts the items inside of the death chest they lose their damage values, nbt data, and whatever else. I have skStuff, but I don’t actually know how to use it and the documentation is very brief.
 
loop numbers from 9 to 35:
edit: thats why
Yes, I’m selecting the inventory slots 9-35 so I looped them and each one sets the item inside of the death chest created. I’m not sure if there’s a way to grab nbt with skStuff though.
 
Status
Not open for further replies.