#backpack

1 messages · Page 1 of 1 (latest)

supple sinew
#

skript variable lists start from number 1

#

not 0

sharp plover
#

also why i can't put items with nbt?

supple sinew
#

ofc its possible to fix start with 1 instead of 0

supple sinew
sharp plover
#
    set {_n} to nbt of tool of {_p}
    loop items in current inventory of {_p}:
        set {_s} to index of loop-slot
        set {_i} to full nbt of loop-slot
        set tag "Slot" of {_i} to {_s}
        add {_i} to {_items::*}
    set {_size} to size of {_items::*}
    set compound list tag "Backpack;Items" of {_n} to {_items::*}``` can't understand "set tag "Slot" of {_i} to {_s}"
supple sinew
#

it needs tag type

#

idk which tho

#

something like int/string/long tag

#

just try em all ig

#

there is a list on wiki

sharp plover
#
    if name of player's inventory is "&8Backpack":
        if event-item is chest:
            cancel event``` and for this one? works fine but if i have a chest and i press 1 on the backpack gui the event is not cancelled
supple sinew
#

well yeah shortcuts are buggy

#

you could just drop it out of there when people close backpack

sharp plover
#

how

supple sinew
#

id start with on inventory close event

sharp plover
#

then?

rose acorn
#

i think you can stop it with this https://skripthub.net/docs/?id=10123

#

you might need reflect actually

sharp plover
#

how do i drop the chest if the backpack contains one?

#
  if name of player's inventory is "&8Backpack":
    loop player's inventory:
      broadcast "%loop-value%"``` i want to loop only the items in the backpack gui
rose acorn
#

event-inventory

sharp plover
#

can't understand this condition "loop event-inventory:"

terse ruin
#

You need to loop the items in it

#

Or, to preserve the slot indices, loop 54 times

sharp plover
#
  if name of player's inventory is "&8Backpack":
    loop items in event-inventory:
      if loop-item contains chest named "&cBackpack":
        broadcast "%loop-value%"``` ok i did but i want to drop that item with nbt on the ground
#

how do i do that?

terse ruin
#

Drop it at the players location

#

And then I guess set the slot to air

sharp plover
#

but how do i drop the same item with the nbt and everything?

terse ruin
#

loop-value should work, no?

#

If youre looping the items

sharp plover
#

nope it doesn't contain the items in the backpack

#

i just get a chest named &cBackpack

#
  if name of player's inventory is "&8Backpack":
    loop items in event-inventory:
      if loop-item contains chest named "&cBackpack":
        drop loop-item at player's location```
terse ruin
#

Try name of loop-item = …

sharp plover
#
  if name of player's inventory is "&8Backpack":
    loop items in event-inventory:
      if all:
        loop-item is a chest
        name of loop-item is "&cBackpack"
      then:
        drop loop-item at player's location```how to set the slot where the loop-item is to air without doing another loop?
rose acorn
#

probably loop a number of times

#

and then use slot (loop-number - 1) of event-inventory

sharp plover
#
  if name of player's inventory is "&8Backpack":
    loop items in event-inventory:
      loop integers from 0 to 8:
        if all:
          loop-item is a chest
          slot (loop-number) of event-inventory is chest: 
        then:
          drop loop-item at player's location
          set slot (loop-index) of event-inventory to air``` doesn't work
terse ruin
#

Yea

#

Because theres no loop-item anymore

rose acorn
#

also just do loop 9 times

sharp plover
#

I could do something like this? set slot (integers between 0 and 8) of event-inventory where [imput contains chest] to air

rose acorn
#

i mean you could, but a filter is just a loop

#

although you're not looping, skript is

sharp plover
#

But it's gonna work just like the loop does?