Topic category: Help with Minecraft modding (Java Edition)
Hello,
Today I updated MCreator from 2020.3 to 2020.5, and after that I finally saw why I had bug of everlasting overlay in my mod - overlays, previously triggered by its own set of triggers, now supports only procedures. Which is great, but...
I see no way of returning "true" value with any "if" conditions. Let's say that, for example, I want to add potion (I used that for overlay durations) and trigger overlay only when potion is active, I have to place return block AFTER "if" condition.
From my small programming knowledge, it means that "if" won't be used, and procedure will be still everlastingly returning "true" value.
Maybe it's weird and tiring month for me, so I don't see obvious ways to solve this due to my messed up brain.
Or maybe it's indeed that kind of thing, which changed from extremely easy, to something requiring more brain cells than I actually have :D
Anyway, I would be so grateful if someone explains me that.
(don't mind "on player tick update" trigger, it's exactly the same no matter if it's empty or if it has something - there's still that warning/error on bottom, solved only with adding "return" after "if")
Add another Return block after the if block or inside the else statement.
I just wrote that I have to add another return block for procedure to work - but that mean returning "true" always, from what I understand... :c and I need it to return "true" only when potion is active
Tried to do that with else, but error was still there
I found the solution though; but it's really annoying that instead of simple trigger from 2020.3, newer versions requires additional ~3 separate procedures for that (and as I use two overlays for player messaging, that means 5 new procedures).
What I found is that you need to make global variable "player_persistent", with default value of false.
Then, anytime you start potion effect, you need to change it to true - and also everytime potion effect expires, you need to change it back to false (2 separate procedures, with potion triggers).
Therefore you can use another procedure, bond with overlay this time, returning the value of global variable, therefore no "if" is needed:
I hope that helps anyone who come across this topic.