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"

How to do set up a multiple-choice question at the end of my sidescroller level

No clue what to do

Product Version: UE 4.19
more ▼

asked Apr 16 '18 at 06:37 PM in Blueprint Scripting

avatar image

1 1 2

avatar image mightyenigma Apr 16 '18 at 07:20 PM

Do you want to select it by a menu like something they click with a mouse?

avatar image jack_dines Apr 16 '18 at 07:40 PM

yeah that would be ideal, at a stretch I'd like the questions to be random each time from a pre-created pool, but ill settle for one thing at a time

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

1 answer: sort voted first

Sounds like you don't know about Unreal's UMG system yet. Have you checked out any of the tutorials about it? Mathew Wadstein has a lot of great ones on YouTube.

If I were the person making this system, I would create two Widget classes, one for the dialog box that holds the question and possible answers, and put a Text widget inside that one's canvas, and a Vertical Box widget under that.

Then I'd make an Answer widget class that is nothing but a button with a text widget inside of it. Then when I construct the dialog box widget. I have a function programmed on that dialog box class which takes in that pool of questions and/or answers as a parameter. I call that function right after creating the dialog box widget, and the function creates Answer widgets, setting their text elements to the answers in the pool which is an array of Strings or Texts.

You can call Shuffle on Array variables to randomly re-order them before calling this function.

Now the tricky part is how you're going to decide what happens when someone clicks the answers.

Your Answer class' button widget will have an OnClick event you can use to make stuff happen. You'll need to decide how to structure that so each answer does something different. You'll need to get rid of the dialog once an answer is chosen, I assume, as well.

more ▼

answered Apr 16 '18 at 07:53 PM

avatar image

3.8k 18 24 21

avatar image jack_dines Apr 16 '18 at 09:46 PM


avatar image mightyenigma Apr 17 '18 at 03:24 PM

You're welcome. Now, you don't have to do it my way, but I like making little sub-widgets so I can dynamically generate how the main widget is built, especially when it involves things like choosing random text or random arrangements of it. I think you'll need to reference the Vertical Box and use the Add Child function on it to put the answer buttons in, during that function that populates it.

If blueprint constructor events could take in-parameters, I would do it that way, but they can't so that's why you make your own function for initializing the main widget.

(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