#How to make it so its not per player but per location
1 messages · Page 1 of 1 (latest)
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
open chest inventory with 3 rows named "test" to player
set {_slot} to 1
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::%player%}
add 1 to {_slot}
on inventory close:
if name of event-inventory is "test":
set {_slot} to 1
loop 26 times:
set {chest::%{_slot}%::%player%} to slot {_slot} of current inventory of player
add 1 to {_slot}
send "&aSaved chest" to player
Change the variable player to the location of event block
If that is what you mean ofc
Do you mean like instanded of %player% make it %event-block%
If you want each block to have a gui with it’s own items and not a gui with the players items then yes change players to location of event block
Ps. Not event block. Location of event block
can you write me a code how im lost
error there is no block in a command event
Send current code
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
open chest inventory with 3 rows named "test" to player
set {_slot} to 1
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::%location of event-block%}
add 1 to {_slot}
on inventory close:
if name of event-inventory is "test":
set {_slot} to 1
loop 26 times:
set {chest::%{_slot}%::%location of event-block%} to slot {_slot} of current inventory of player
add 1 to {_slot}
send "&aSaved chest" to player
add event-block's location to {blocklist::*}
Idk where ur error comes from cause there is no command in that code
wait
on block place of chiseled stone brick:
if item is chiseled stone brick named "&6Test":
add event-block's location to {blocklist::*}
send "hi"
command /test:
trigger:
give player chiseled stone brick named "&6Test"
on block break of chiseled stone brick:
if {blocklist::} contains event-block's location:
remove event-block's location from {blocklist::}
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
open chest inventory with 3 rows named "test" to player
set {_slot} to 1
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::%location of event-block%}
add 1 to {_slot}
on inventory close:
if name of event-inventory is "test":
set {_slot} to 1
loop 26 times:
set {chest::%{_slot}%::%location of event-block%} to slot {_slot} of current inventory of player
add 1 to {_slot}
send "&aSaved chest" to player
add event-block's location to {blocklist::*}
command /test1:
trigger:
open chest inventory with 3 rows named "test" to player
set {_slot} to 1
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::%location of event-block%}
add 1 to {_slot}
i deleted it now it deleets the items in the gui after close
Send current full code
on block place of chiseled stone brick:
if item is chiseled stone brick named "&6Test":
add event-block's location to {blocklist::*}
send "hi"
command /test:
trigger:
give player chiseled stone brick named "&6Test"
on block break of chiseled stone brick:
if {blocklist::} contains event-block's location:
remove event-block's location from {blocklist::}
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
open chest inventory with 3 rows named "test" to player
set {_slot} to 1
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::%location of event-block%}
add 1 to {_slot}
on inventory close:
if name of event-inventory is "test":
set {_slot} to 1
loop 26 times:
set {chest::%{_slot}%::%location of event-block%} to slot {_slot} of current inventory of player
add 1 to {_slot}
send "&aSaved chest" to player
add event-block's location to {blocklist::*}
I think ur main issue is ur having pieces of code where you need the location of the event block but then you have other pieces of code where there is no event block involved
So ofc that won’t do anything
i think the problem is in on inventory close:
it doesn't save the location
please use code blocks
also you can set slot (integers between a and b) to ...
also use vanilla guis
When you click the block. Save a var with the location of the block then replace %location of event-block% with that variable
what is that?
```code here ```
ok
if {blocklist::*} contains event-block's location: send "how did you do it" open chest inventory with 3 rows named "test" to player set {_slot} to 1 set {_location} to event-block's location loop 26 times: set slot {_slot} of current inventory of player to {chest::%{_slot}%::{_location}} add 1 to {_slot}```
3 backticks. Not 1
done
if item is chiseled stone brick named "&6Test":
add event-block's location to {blocklist::*}
send "hi"
command /test:
trigger:
give player chiseled stone brick named "&6Test"
on block break of chiseled stone brick:
if {blocklist::*} contains event-block's location:
remove event-block's location from {blocklist::*}
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
open chest inventory with 3 rows named "test" to player
set {_slot} to 1
set {_location} to event-block's location
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::{_location}}
add 1 to {_slot}
on inventory close:
if name of event-inventory is "test":
set {_slot} to 1
loop 26 times:
set {chest::%{_slot}%::%location of event-block%} to slot {_slot} of current inventory of player
add 1 to {_slot}
send "&aSaved chest" to player
set {rgloc1.%player%} to location of player's target block
send "{rgloc1.%player%}"```
gives this error
when i use vanilla gui can i make changes in it if its closed?
hi i tried it
i changed the code a lot and now it saves but it shows the same gui everywhere
No percents around {_location}
if item is chiseled stone brick named "&6Test":
add event-block's location to {blocklist::*}
send "hi"
command /test:
trigger:
give player chiseled stone brick named "&6Test"
on block break of chiseled stone brick:
if {blocklist::*} contains event-block's location:
remove event-block's location from {blocklist::*}
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
open chest inventory with 3 rows named "test" to player
set {_slot} to 0
add player's target block to {location::*}
loop 27 times:
set slot {_slot} of player's current inventory to {SHKI::%{_slot}%}
add 1 to {_slot}
on inventory close:
if {location::*} contains player's target block:
set {_slot} to 0
send "hi" to player
loop 27 times:
set {SHKI::%{_slot}%} to slot {_slot} of player's current inventory
add 1 to {_slot}```
.
like add them ?
ok so i did it and it deletes the inventory on close
can i change them when they are closed?
If they arent local
its per location
different gui
can i make it that it generates in the gui dirt every 10 seconds?
yes
how can i make it vanilla ?
i meant if you're not storing them in something local, ie deleted after that event
google "vanilla guis tutorial"
set slot 12 of {_a} to diamond
open {_a} to player```
ok
i did it here is the code
if item is chiseled stone brick named "&6Test":
add event-block's location to {blocklist::*}
send "hi"
command /test:
trigger:
give player chiseled stone brick named "&6Test"
on block break of chiseled stone brick:
if {blocklist::*} contains event-block's location:
remove event-block's location from {blocklist::*}
on right click:
if {blocklist::*} contains event-block's location:
send "how did you do it"
set {_a} to chest inventory with 3 rows
open {_a} to player
set {_slot} to 1
set {_location} to event-block's location
loop 26 times:
set slot {_slot} of current inventory of player to {chest::%{_slot}%::%{_location}%}
add 1 to {_slot}
on inventory close:
if name of event-inventory is "Chest":
set {_slot} to 1
send "hi"
loop 26 times:
set {chest::%{_slot}%::%location of event-block%} to slot {_slot} of current inventory of player
add 1 to {_slot}```
but it still deletes the inventory after close
if i want to put stone in it how can i save it so next time i open it the stone is there
set slot 4 of {notLocal} to stone``` every time you open it, it will have the stone inside
can I interact with it?
like if i put four dirt in it and then i want to take it back after sometime can i ?
same way you set it in the first place
im sorry im stuck
if its in a variable, you can modify it whenever you want
if {blocklist::*} contains event-block's location:
send "how did you do it"
set {_a} to chest inventory with 3 rows
set {_slot} to 1
set {_location} to event-block's location
loop 26 times:
set slot {_a} to {_a} of current inventory of inventory of player
add 1 to {_slot}
open {_a} to player```
no, still slot ({_slot} | loop-number)
i would honestly just use loop-number, less lines and you dont need the local var
heres an example:
set {myStuff} to chest inventory with 3 rows named "My stuff!"
command open:
trigger:
open {myStuff} to executor
on inventory close:
if name of event-inventory = name of {myStuff}:
loop 27 times:
set slot (loop-number - 1) of {myStuff} to slot (loop-number - 1) of event-inventory```
yeah, will be deleted when the server stops
if you need it to persist you could use a list, one index per slot
or, set a variable to an item and use nbt to modify that lol
yes
i think entities will be wiped when the server restarts too
if you click him put 4 dirt in him and then close it then open it again the 4 dirt will be in him
no
armor stand stays
i was making a custom block with armor stands and it stays
ok so it would be like
if helmet of clicked entity is an gravel with custom model data 6:
set {_a} to chest inventory with 3 rows
open {_a} to player```
ok so i have this
if helmet of clicked entity is an gravel with custom model data 6:
set {myStuff} to "Test"
set {_a} to chest inventory with 3 rows named {myStuff}
open {_a} to player
on inventory close:
if name of event-inventory = name of {myStuff}:
loop 27 times:
set slot (loop-number - 1) of {myStuff} to slot (loop-number - 1) of event-inventory
on place:
if item is chiseled stone brick:
send "armor standooo"
set event-block to air
spawn armor stand
set helmet of last spawned entity to gravel with custom model data 6```
now i need it to save the inventory
it does not save the inventory
because you're setting {myStuff} to "Test", not an inventory
so set to event inventory?
set {myStuff} to uuid of the armor stand?
{myStuff::%uuid%}
so that you have a different one per armour stand
but the gui will still be deleted on restart
you would need a list of seperate items for each slot
which adds up fast
cant i just load it back on load
?
the {myStuff} will be none
gone
if you dont need to save stuff over restart, fine
if you do youll need to save it
can i save them in a text file?
then it would just take the info from the file on load
or its not gonna work like that?
i would just set a singe variable to an item, then use nbt to set the tags of that item to the items
like shane does in the backpacks https://github.com/ShaneBeee/SkriptSnippets/blob/master/snippets/Backpack.sk
that way only one variable per inventory
im gonna try it tomorow
although you can use a list if you want
here
ok
cause the more the merrier
ok im trying to make a server with machines so we see how this go
it works but cant save the inventory