#disable removing the gui after reset
1 messages · Page 1 of 1 (latest)
set {_location} to location of the entity
if {gui.%{_location}%} is not set:
set {gui.%{_location}%} to a chest inventory with 3 rows named "&6GUI"
open {gui.%{_location}%} for player
else:
open {gui.%{_location}%} for player
on inventory close:
if event-inventory is {gui.%{_location}%}:
clear {gui.%{_location}%}```
disable removing the gui after reset
When i open and Close it the stuff is there
Its only on restart
what is the gui supposed to do?
When i place a armor stand and click it it will make a gui where i can put anything i want
When i Close it and then open it again the stuff will be there
But its giving me an error that the stuff in the guys will be removed after reload
And the armor stands are different on the every location
When I restart the server it deletes the stuff in the guis
yeah...that's normal behavior. Information in a gui based on an entity will be different when the server restarts.
Can I save the information somewhere ?
you can make it so the gui is based on a location instead of an entity
How
by getting the location of the block instead of the entity
x-coordinate of block at location of event-entity
etc.
I try then send you a code OK
i did this and it still does not save after reset
when i restart the server the stuff disapears
set {_x} to x-coordinate of block at location of event-block
set {_y} to y-coordinate of block at location of event-block
set {_z} to z-coordinate of block at location of event-block
set {_location} to "%{_x}% %{_y}% %{_z}%"
if {gui.%{_location}%} is not set:
set {gui.%{_location}%} to a chest inventory with 3 rows named "&6GUI"
open {gui.%{_location}%} for player
else:
open {gui.%{_location}%} for player
send "hi"
on inventory close:
if event-inventory is {gui.%{_location}%}:
clear {gui.%{_location}%}
on break of an chiseled stone bricks:
set {_x} to x-coordinate of block at location of event-block
set {_y} to y-coordinate of block at location of event-block
set {_z} to z-coordinate of block at location of event-block
set {_location} to "%{_x}% %{_y}% %{_z}%"
clear {gui.%{_location}%}
broadcast "hiiii"```
you are still deleting the variable that contains the items whenever you close the gui, so with that logic the items shouldn't be there
^ you’re using a local var across events
Skript wont be able to save the armour stand entity, but would it be able to retain the uuid since its a string?
they're not, actually.
^ the other 2 events it does get set
Although i would set it in one line; ”% x-coord% % y-coord% %z-coord%”
or honestly just event-location
this isnt actually deleting it as its attempting to delete something with an index that is not set
ok so what should i do
like when i close it it stays but on restart of the server it deletes itself
^
also, you're not actually storing the items.
all your doing is setting the variable to an inventory with 3 rows, but then you dont modify it to accomodate for items placed in
if im not storing them how do they stay in the gui
they dont, thats why they are dissapearing
on inventory close you can set the variable again
ok
like this ?
if event-inventory is {gui.%{_location}%}:
set {_x} to x-coordinate of block at location of event-block
set {_y} to y-coordinate of block at location of event-block
set {_z} to z-coordinate of block at location of event-block
set {_location} to "%{_x}% %{_y}% %{_z}%"
clear {gui.%{_location}%}```
ok now it will work ?
it saves the items in it
im going to try to reset
but on reload it still says it will not be saved
if you're using event-location on inventory close it's probably using the player's location which would cause issues if the player cant get in the exact same spot
player's target block i think
if someone click the block in shift he will not be targeting the block
on the edge of the block
so idk
i could just prevent them from sneak clicking
there is still a problem that it does not save after restart
you'll proably need a list so you can keep each item
maybe serialized inventory would work but I have no experience with that
noooo
{list::*}
backwards
you could look at some backpack scripts/functions online, those are pretty close so good examples for that you want
ok
fast question is there a way to put something in an inventory even if its closed?
How can I check for the inventory
lets say you have a cobble generator that should generates 1 cobblstone every 5 seconds
Can I put 1 cobblestone every 5 seconds in it ?
hi i made it so it does not leave the error but now it does not save the inventory
here is the code