#How to make it so its not per player but per location

1 messages · Page 1 of 1 (latest)

balmy plinth
#

Im trying to make it so on a location it makes a gui and on another location another gui for now i only have per player

#

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

copper hamlet
#

Change the variable player to the location of event block

#

If that is what you mean ofc

balmy plinth
copper hamlet
#

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

balmy plinth
copper hamlet
#

No spoon feed

#

Just change %player% to %location of event-block%

balmy plinth
copper hamlet
#

Send current code

balmy plinth
#

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::*}

copper hamlet
#

Idk where ur error comes from cause there is no command in that code

balmy plinth
#

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}

copper hamlet
#

There is no event block in a command

balmy plinth
copper hamlet
#

Send current full code

balmy plinth
#

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::*}

copper hamlet
#

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

balmy plinth
#

ok

#

idk how to fix it

balmy plinth
#

it doesn't save the location

steel temple
#

please use code blocks

#

also you can set slot (integers between a and b) to ...

#

also use vanilla guis

copper hamlet
balmy plinth
steel temple
#

```code here ```

balmy plinth
#

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}```
steel temple
#

3 backticks. Not 1

balmy plinth
#

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

balmy plinth
balmy plinth
#

i changed the code a lot and now it saves but it shows the same gui everywhere

steel temple
balmy plinth
#
  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}```
steel temple
balmy plinth
steel temple
#

Well yeah

#

Otherwise its gonna take that as literal text

balmy plinth
steel temple
#

Please turn off reply pings

#

You’re still not using vanilla guis

balmy plinth
#

can i change them when they are closed?

steel temple
#

If they arent local

balmy plinth
#

its per location

#

different gui

#

can i make it that it generates in the gui dirt every 10 seconds?

steel temple
#

yes

balmy plinth
#

how can i make it vanilla ?

steel temple
steel temple
#
set slot 12 of {_a} to diamond
open {_a} to player```
balmy plinth
#

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

steel temple
#

no

#

you loop and set slot x of {_a}

#

then open it

balmy plinth
#

if i want to put stone in it how can i save it so next time i open it the stone is there

steel temple
#
set slot 4 of {notLocal} to stone``` every time you open it, it will have the stone inside
balmy plinth
#

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 ?

steel temple
#

yes

#

just set the slots to whatever they are on close

balmy plinth
#

how ?

#

set slot 2 to chest inventory slot 2?

steel temple
#

same way you set it in the first place

balmy plinth
#

im sorry im stuck

steel temple
balmy plinth
#
  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```
steel temple
#

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```
balmy plinth
steel temple
#

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

balmy plinth
#

can i make it a armor stand instand of a block

#

?

steel temple
#

what do you mean?

#

link the gui to the armour stand?

balmy plinth
#

yes

steel temple
#

i think entities will be wiped when the server restarts too

balmy plinth
#

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

steel temple
#

okay

#

then use that

balmy plinth
#

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

steel temple
#

because you're setting {myStuff} to "Test", not an inventory

balmy plinth
#

so set to event inventory?

steel temple
#

?

#

you only need to set it once

#

use the armour stands uuid or something

balmy plinth
#

set {myStuff} to uuid of the armor stand?

steel temple
#

{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

balmy plinth
#

cant i just load it back on load

steel temple
#

?

#

the {myStuff} will be none

#

gone

#

if you dont need to save stuff over restart, fine

#

if you do youll need to save it

balmy plinth
#

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?

steel temple
#

well

#

you'd have to parse them all as items

balmy plinth
#

so it would work

#

?

#

but the file would be too big

steel temple
#

i would just set a singe variable to an item, then use nbt to set the tags of that item to the items

#

that way only one variable per inventory

balmy plinth
#

im gonna try it tomorow

steel temple
#

although you can use a list if you want

balmy plinth
#

wanna go to dms?

#

Or we write it here?

steel temple
#

here

balmy plinth
#

ok

steel temple
#

cause the more the merrier

balmy plinth
#

ok im trying to make a server with machines so we see how this go

balmy plinth
#

it works but cant save the inventory