How to create a level menu screen with buttons enabled on a condition?

I’m trying to create a menu (that is accessible at the control panel) that lists the available levels to travel to only if the player reaches a certain score. The buttons for the level are set to not enabled when the game begins, but should be enabled once the player reaches 500 points, for example. I’m having trouble getting the buttons to enable.

Control Panel BP (player interacts with level screen widget here)

Level Screen BP

Level BP (the score/quota condition is here)

Hey @RetroMonroe!

So first, let’s get rid of that “Get Control Panel Obj->Cast to…-> Set Control Panel Obj” Because it’s doing nothing :stuck_out_tongue: just for readability’s sake. All it’s doing is setting it to what it already is. Ex: “Get 1. Make it behave as itself. Then set 1 as 1.”

Next let’s take some low level testing measures. Throw a PrintString at 1 and 2 here in order to make some checks, if the “1” printstring goes off, it’s making it to the enable point.
If “2” goes off, the cast is failing, and that’s your issue.

We have to know the problem before we can come up with a solution, so we need to seek out the problem! :slight_smile:

Give this stuff a shot and let us know how it goes!

1 Like

Hi @Mind-Brain !

So I did what you said and deleted those nodes and I finally got an error.

Also I added the print strings to the 1 and 2 and got these messages.

Screenshot 2024-04-30 132758

Hey again @RetroMonroe!

Hmm… Did you possibly have multiple variables named the same thing? And are you sure you only did those things?

If the variable you were setting there was for a different Blueprint, you need a better naming scheme. Never, ever, ever let any two variables have the same name unless they’re local or things get confusing.

Now, if the only place a “Control Panel Obj” exists is on this blueprint, there shouldn’t be any reason that removing those should cause an error. But hey, if it’s not working without them, put them back in.

As far as the printstrings, you have to say which one is supposed to say which thing :stuck_out_tongue: they are custom so we don’t know if the 1 or the 2 is the one going off- going to assume only #1 based on context.

So the further matter here is if it IS INDEED ENABLED- what is happening? We need some details. Is it invisible, is it visible but unclickable (if so, show the button code)?

Get back to us with some details and let’s iron this out! :slight_smile:

Hi @Mind-Brain!

Using the previous screenshots as reference, this was my logic:

The level screen widget has the functions of the buttons where they are enabled on a click. Then in the control panel blueprint, the level screen widget is created and added to viewport when the player comes near the control panel and presses E. Then in the level bp, after the condition of 500 points(quota in the screenshot), I added a branch node, casted to control panel obj bp and set to the control panel obj variable to get it as a reference (which has since been deleted), then I grabbed a reference of the level screen widget from the control panel obj variable and I grabbed a reference of the button from the level screen widget reference and set the button to enabled.

After the print string coming from “1”, the button shows that’s it’s not enabled. When I collect the right amount of points and return to the level menu screen, the button still shows it’s not enabled.

I may be misunderstanding exactly what your trying to do

But I would disable/hide buttons from the widget BP, when the Widget gets created do your cast to there and retrieve the players points then just have branch statements that enable a button when you reach X points

like so, you could also implement disabling or hiding the button but clickable and having it do the check is more UE(user experience) friendly

i do this from my character in this example but you should be able to do something very similar in the level bp if that’s how you’d like to do it, usually not good to do too much in the level bp

Something like this if you have multiple characters/Multiplayer would keep track of your points

Hi @Nightwolf483!

If I have the points condition in the level blueprint, how can I get a reference for it into widget blueprint? This is what the condition looks like in the level bp:

i had the wrong screenshot attached to the post above, i have fixed it that may give you some idea
But if your simply trying to access the value of Quota

@RetroMonroe
you’d do the same thing in the widget,
cast to->Get “Quota”


i believe this is what your looking for Something like this

Generally speaking id do the math of the points in the Game mode or level bp then retrieve it with the cast to node

Character>tells gamemode hey i got X points, gamemode verifies it is within range ( verify sp you can prevent it being as easy manipulated by cheat engine for example )

Then in the Widget youd do Cast to gamemode → get Quota → Some action ( load level )

Finally in the character BP you’d just create the widget when your near the console object/asset

hope this helps cheers!


This might help give you a more direct answer if your trying to call the actual function

Thanks I’ll try that. @Nightwolf483 What is the best way to enable a button? I tried this below and it didn’t work.

That node your trying to use is for the widget as a whole
if you just wanna do the button/condition you do something like this
Screenshot 2024-05-02 050808

1 Like

Do you have any training/learning material? i can send over some good links to learn a lot of basics

Next let’s take some low level testing measures. Throw a PrintString at 1 and 2 here in order to make some checks, if the “1” printstring goes off, it’s making it to the enable point.
If “2” goes off, the cast is failing, and that’s your issue.

1 Like

Just in case, some of the videos that i looked at to understand how stuff connects together and what it does, Your better off trying to understand Why How and Where usually in that order what i mean by this is don’t try and just copy what they do, yes do the project with them maybe try and change some bits to your liking but overall try and understand what’s going on under the hood so to speak

There’s tons more content out there as well this is just my basics bookmarks that i have from the when i started

Specifically about widgets

General motivation/feeling discouraged This man will ALWAYS lift you up 50/10 recommend

If your using steam

Landscapes

Lighting Love this guy really explains good

Save system basics would learn this close to last

Multiplayer Very complicated to understand and do properly

More weapons stuff

Understanding arrays

Advanced sessions Multiplayer with better BP nodes

Steam Achievements

Long video

2 Likes

Sorry for the mega post lol i didn’t realize it was gonna pull all the thumbnails

Thank you this is a good workaround! Is there a way to change the opacity of the button (like below) to show the button is disabled? When I check off the “Is Enabled” box on the button in the widget, it gives this effect. Ideally the button will look transparent to signal to the player that it’s disabled.

Goto the playlist about WTF widgets and find the one about buttons, there’s a set transparency node

Always try and search around a bit yourself aswell, if you’d searched opacity it comes up almost immediately

Thanks I guess I’ll search around some more. I already tried the set color and opacity node before and it changed the opacity of the entire widget.

Did you set the target as the button? otherwise it assumes self which would be the Widget