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"

Best practices/methods to list a variable number of levels/Blueprints?

Hi all,

Admittedly this is my first foray in to anything Unreal Engine related so it is entirely possible I have missed the functionality that meets my requirements. Or, perhaps there is a different way of achieving what I'm after?

I'm prototyping a music+puzzle game and want to see how far I can get without writing a single line of code.

I have a Blueprint, let's call it "Puzzle Stage", which defines some core functionality/behaviour and variables for Blueprints based on this.

Then each puzzle level is essentially a Blueprint based on that "Puzzle Stage" Blueprint. Each puzzle level has their own music files, camera components, artist/track details, timelines, etc.

Is there a way I can iterate all Blueprint classes derived from "Puzzle Stage" to get the artist/track strings, without actually instantiating that Blueprint Actor? (Presuming you can even treat blueprint variables as "static")

Until I can work out a decent method for this I'm manually creating menu items/etc for each puzzle level Blueprint.

I suppose if there is a way to dynamically list levels in the game package I could change the structure so that a level is a puzzle...

Ultimately, if I have to manually define all menu items then I'll have to do that, but it would be nice not to do that for every new puzzle/song that is added to the project.

Thanks!

Product Version: Not Selected
Tags:
more ▼

asked May 06 '14 at 11:22 PM in Blueprint Scripting

avatar image

daneherbert
6 2 4 7

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Blueprints do support inheritance, and any blueprint derived from the base class does inherit all of the functionality from the parent class. It is also possible for child classes to override the default functionality. In order to create a child class, right click on the parent class in the content browser and select "Create Blueprint Using.."

As for iterating through the list, the answer is actually much easier than you might think. Create a Struct for your Soundtrack information with whatever variables you want. Then, in your Puzzle Stage base class, create an array variable. Create the structs for each song, either procedurally or manually, and add them to the array.

After that, you can iterate through the array and perform whatever functions you want. Alternatively, you could create a class specifically for your music and put the functionality there. One small note though. To my knowledge you will not be able to act upon something that does not exist in your level unless it is added to your game mode class. So, if you want to act upon something that does not exist in the scene, that would be a good place to do it.

Hope that helps Tony

more ▼

answered Nov 10 '14 at 05:07 AM

avatar image

RAVaught
694 43 28 68

avatar image daneherbert Nov 11 '14 at 03:26 AM

Thanks for your answer, Tony.

I did eventually work out a solution and forgot about this question altogether. The solution wasn't as you explained, which is far more logical, but it suited the experiment at the time.

Your remark about Structs has given me a couple ideas for something unrelated as well.

Thanks for taking the time to answer, especially for such an old question! Much appreciated.

Dan

avatar image RAVaught Nov 11 '14 at 05:23 AM

You are very welcome. Just make sure you know that you cannot (as of 4.5) set an element on a struct directly, you need to break the struct, make a new struct and relink the pins, and then set it to the proper array element.

(comments are locked)
10|2000 characters needed characters left
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