Started by
Logdawg940
on
Topic category: Help with Minecraft modding (Java Edition)
So I made a GUI for when the player joins a world but the only problem is that it will always open when the player joins the world (if I'm correct by the way the procedure runs). I want it to run only once per player so the players don't run into it over and over again. Please help!
Use entity NBT tags to store data if the GUI was already shown or not.
how would i do that?
Add this to your procedure,
If {Get [EntityNBT - "loggedinbefore"] = 0}
Then {Open the GUI}
Then {Set [EntityNBT - ["loggedinbefore] to 1}
That way when the player joins again the if statement won't be true and the statement won't run
Like this? file:///C:/Users/logda/Pictures/Screenshots/Screenshot%20(112).png
Sorry I pasted the wrong thing
Like this?
if Get entity data logic NBT tag "loggedinbefore" = false
do Open GUI for the provided (entity)player: (GUI name)
then Set entity data logic NBT tag "loggedinbefore" = true
Yes, did it work?
I haven't tested it yet but I hope it works. Otherwise thank you so much.
It didn't work
Can you screenshot the procedure
Hey! I was trying to do something similar, and I found that you should make a global variable, and set it to world, so that way it doesn't show upon reentering the world, hope that helps!
Sure, but it won't work in multiplayer so I wouldn't use GLOBAL_WORLD. I would use GLOBAL_SESSION variables and/or NBT Tags.
Nope don't use global variables for stuff like that!
Global variables are binded globally and not per player which means that this gui will gonna open once and other players will be unable to open it
NBT's are used for everything now because they are more stable and they are both global and private depending on your needs.
Many blocks are using them for cooking timers or to store Forge Energy or RedFlux
Yes but NBT tags are lost on death so use them in conjunction with global variables.