x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to make lock and unlock button for levels?

I am making a game which contains 8 level, so when the levels are locked the button color is different or icon is different . and you can also help me with any other idea which relate with this.

alt text I want to make like this

alt text

Product Version: UE 4.18
Tags:
screenshot-228.png (141.6 kB)
hqdefault.jpg (27.1 kB)
more ▼

asked Apr 15 '19 at 06:30 PM in Blueprint Scripting

avatar image

VIROH
1 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Im new to Unreal myself, but my first attempt would be to create a Game-mode Boolean Variable Array. You have 8 levels so you would have indexes 0-7 and you could set the Boolean for each index indicating if level is unlocked. The array would be set on begin-play reading values from a save (Never done this yet). Your UMG level icons would be variables and you could set the image according to the Boolean value in your array. You could get then enable or disable interaction according to your array Boolean?

more ▼

answered Apr 15 '19 at 06:47 PM

avatar image

blindminds
43 1 3

avatar image VIROH Apr 15 '19 at 07:04 PM

can you show the bluprint of this .

avatar image blindminds Apr 16 '19 at 06:47 AM

alt text The top 3 images are from my UMG Widget Designer Section where I did an Xbox controller and the buttons highlight when pressed. I just remembered I could not find a way to dynamically change the image so I had to put an image on top for the highlighted version of the button and then dynamically set the visibility. To layer the buttons (Image on far left top) I had to use a Scale Box, Then an Overlay Box and the Place in the Images. Put the image with Lock on top of one without. Then When You read your boolean Variable from the array, if true you could set the image to Hidden, and if false set image to Visible along with disabling user input on the button.

alt text

You will need to do some homework and look up tutorial videos on creating save game files/information to be able to save the variable info for the levels that are unlocked. Here is link to Tutorial for that - https://youtu.be/Adeu5yCDUuI

snapshots.jpg (160.7 kB)
boolean.jpg (66.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can do something like this. Create an integer variable in the game instance. Each time a player beats a level you increment it (+1 to the value) and set it. When you open up the main menu with the level selection, enable or disable the buttons based on whether or not they are greater than or less than or equal to this value. Sample setup is below. If you are new to UE4 you can also check out these beginner tutorials they may help you with questions/issues you have in the future. It also gives a really good foundation for the basics of blueprints and setting up logic.

https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy

alt text

alt text

more ▼

answered Apr 15 '19 at 09:30 PM

avatar image

Nebula Games Inc
5.4k 28 9 14

avatar image VIROH Apr 17 '19 at 05:34 PM

variable type of level array?

avatar image VIROH Apr 17 '19 at 05:45 PM

i did this but in my editor set enable's target is not connecting with for each loop, i think i'm setting wrong data type. waht data type you set to level array. alt text

screenshot-232.png (235.6 kB)
avatar image Nebula Games Inc Apr 17 '19 at 05:49 PM

The level array is a button type. You can only use the buttons if the level is unlocked.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Don't forget you will also need to create some type of save variable to archive the players progress for a later load up.

more ▼

answered Apr 16 '19 at 07:09 AM

avatar image

Debaucher
69 1 6 8

avatar image VIROH Apr 17 '19 at 01:28 AM

I made This But there is a problem that when i complete level-1 the level-2 will unlock , then i play level-2 and unlock level-3 but when i unlock Level-3 my level-2 is locked .it is not saving all previous data it only save the current data

alt text

screenshot-229.png (357.8 kB)
avatar image blindminds Apr 17 '19 at 11:39 AM

Do you want the levels to Unlock in Order or is the Player able to Play and Unlock Levels out of Order? I unfortunately I don't have time to watch the tutorial and I am unable to read anything on your screenshot as it is zoomed out too far to read the text.

To Unlock in Order - I would check a Level Unlock Variable which would contain an integer of the highest level completed. The run a for Loop from 1 to the Level Unlock Variable. In this loop I would then set all the attributes for your widgets (Will buttons accept user input? Make your layered images visible or invisible to show the lock image).

To Lock/Unlock in any order I would do what I mentioned before and use a boolean array and set the boolean to true if level is unlocked. Then when your menu loads, run a for each loop to set the attributes of your widgets as mentioned above.

I included an Epic Tutorial on Savegame in my post above.

Does this help you?

avatar image VIROH Apr 17 '19 at 05:57 AM
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question