How to use button display conditions?

Started by swelkinn_n on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to use button display conditions?

I want to use the button display conditions to hide a button in a GUI if the player doesn't have an advancement, and show when it does.

I thought it'd be simple, as I expected it to just be "Return: Has Event/target entity completed advancement (advancement)" or at most "Return: Has Event/target entity completed advancement (advancement) = true," but neither of these worked. It also didn't work when I did if the player had the advancement return true, but that doesn't work since the return block has to be the end, and if I just put a return false outside of the if block, it too does not work.

What would work then? 

I am using the most recent snapshot, so it could possibly just be broken, but I could also just be missing something.

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if Advancementcompleted …
Mon, 02/13/2023 - 01:52

if Advancementcompleted "advancement"

do; Return true

Return false

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this returns false…
Mon, 02/13/2023 - 02:34

this returns false regardless due to the return false having to be outside the if statement (and if its not supposed to do that it does either way)

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sorry, I'm rare online, this…
Wed, 02/15/2023 - 19:27

sorry, I'm rare online, this is the basic version of what you're looking for.

then on your button, go to Button Display Condition find the name of your procedure and apply it.

it's checks if the event/target entity (player) has completed the advancement, if the player has then it will return true (then display the button), if the player hasn't completed it, it moves down the hierarchy then returning false

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I screwed up the last bit it…
Wed, 02/15/2023 - 19:32

I screwed up the last bit it should return false not true

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm guessing that it's…
Wed, 02/15/2023 - 23:41

I'm guessing that it's broken then, since it hides the button with and without the advancement. If I flip the true and false it shows regardless, which to I assume means it's reading the last one one regardless

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is the best way to do…
Thu, 02/16/2023 - 14:09

Here is the best way to do that:

  1. Make a Global Player Persistant Variable that is default to false. This Variable checks if you have the advancement or not.
  2. After that make a new Procedure with the Global Trigger "Player completes Advancement" and make the if statement where you check the specified Advancement.
  3. Inside the If-statement set the Global Player Persistant Variable to true.
  4. Then make the Procedure for the Display Condition of your button and just return the Variable.

That's all!

 

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It seems at the newer…
Thu, 02/16/2023 - 14:13

It seems at the newer Versions of Minecraft (1.18+ I think) there no Getting Wood Advancement anymore.

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also make sure you choose…
Thu, 02/16/2023 - 14:14

Also make sure you choose the Procedure "is provided advancement equal to"!

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Completely forgot about…
Thu, 02/16/2023 - 22:09

Completely forgot about using variables, this worked, thanks !