Topic category: Help with Minecraft modding (Java Edition)
What I'm trying to figure out is to use the overlay feature to display certain values and text. I've tried using player variables and done some minor research but ended up with the values resetting to default values every tick when the player respawns, but this is fixed when the player rejoins the world, only for it to happen again. As for NBT, I've looked around on the forums with most, if not all recent posts telling me that NBTs don't work with overlays. Even after some experimentation, I've ended up with my NBTs returning no information likely due to my mistake. If there is anyone who can help explain how to use the overlay for player specific values, variables, nbts, etc, that'd be wonderful!
Their right, it is impossible. There is no way to change the text in an overlay once it is set in stone, because there is no text input. That is the only way to do it with GUIs.
For better understanding of the situation I am in, I am using mcreator 2023.2 with a minecraft version of 1.19.2 (43.2.0). The procedures I managed to make were able to change the values on an overlay with player variables. For example; I would create a variable named 'comboScore' and set the initial value to 0, a player lifetime variable. I add a string return procedure so that it displays the variable. When an entity is attacked, the source entity (The player) will have their combo score go up by how much damage is dealt. Now the problem is when you respawn, as the value will reset to 0 as intended but stay at 0. Any attempt to rise this value will have it increase by its intended value, but only for a single tick before resetting to 0. Please note that I want this to be multiplayer friendly so global map and world are out of my reach. I will explain my other attempts at working the overlay but for now this is all I will say on it.
Hmm. Interesting. I don't know, sorry. If there is anything else I can help with then just ask.
Solved
Ok. Can you send me a screenshot of your procedure so that I can see how you did it?
I'm unsure how to upload an image onto this reply but I can summarize most of what I experienced.
In short, do not use a server-sided procedure/trigger.
As for the longer explanation I will describe most of my situation. Similar to the example from earlier I had a player lifetime variable to go up whenever it was needed. I needed it to go down after some time not attacking, which led me to make another variable called 'comboScoreDrain', once again another player lifetime and number variable. I would make two procedures, one called 'InitializeScoreDrain' and 'ScoreDrain'. The first procedure would wait one tick then call the next procedure 'ScoreDrain' where 'comboScoreDrain' would be needed, calling 'initializeScoreDrain' to repeat the cycle. If 'comboScoreDrain' was above 0, reduce that number by 1, if it was 0 reduce score by 1 every time the procedure was called. Now here comes the actual problem. 'InitializeScoreDrain' was set to global trigger 'On player join' which was server sided. I'm unsure why it would mess with the overlay but from my knowledge is due to the overlay being client sided only. My fix for this was to change the global trigger to something that was NOT server sided, that solution being 'On entity joins world'. But because it would trigger for every entity, I had it to do an if statement: if is event/target entity (sub)type of 'Player'. That would limit it to only triggering on players.
I can try to send a screenshot to further clarify what to do, but for now I do not know how to without using a third party website to upload a link.
Use Imgur it is free and is safe
I was wrong, you can change the text in an. Overlay.