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 create a High Score Table (saved)

Hello!

I`m trying to create a game where you control a character running straight forward and dodging objects / picking up objects. I have a timer which counts down from 60, and at 0 I use "SetGamePaused" to stop the game and bring up the new widget, where I want a High Score Table to appear. The "score" is the amount of objects you have managed to pick up during the 60 seconds. I do have a pick-up system working where it does count every pick up and adds it to the view port when playing.

The problem is that I cant figure out how to bring the score into a "high score table", and even harder for me, is how to make it work like a high score table in the sense that it puts the highest score on top and so on.

Does anyone know any good tutorials to this, or does anyone know how to do it? Screenshots of blueprints is really helpful, as I am very new to Unreal Engine 4 and blueprints. (I have the basic knowledge only.)

I really hope someone has an answer for this, it would save my game! ;) (Also I know loads of people are wondering the same thing, as there arent many tutorials showing how to do exactly this, but only showing how to make a score and counter.)

Product Version: UE 4.13
Tags:
more ▼

asked Nov 01 '16 at 05:19 PM in Using UE4

avatar image

Jacobs89
12 6 8 8

avatar image Jacobs89 Nov 02 '16 at 09:23 PM

Thanks for the reply's @ScottSpadea ! I tried reading it and understanding it, even tried it (I think), but it seemed a bit complex, so I tried a tutorial. Maybe you understand the tutorial it better than me?

So I’ve looked at a tutorial. I followed the youtube tutorial ( https://www.youtube.com/watch?v=ZseexEWWOJg ) and it gave us this:

(It’s a LARGE ((2104x2272)) picture, where we gathered it all, so if you want to take a look you should download it and zoom in to see it more clearly if you already cant). alt text

I see how this would work, and I understand most of the setup. However there are a few details which I need to understand in order to make this work for my game. As you can see in the «PlayerController» blueprint, there is a red box around a Integer variable that I named «fix». The guy in the tutorial (as far as I understand) uses that integer to connect it to the coins he picks up (which gives him a score), and thereby connecting the score to the Score Board.

Here you can see our Object PickUp BP:

alt text

(again, you should download in order to see clearly, if you already cant.)

You may notice the yellow marked integer. Is that the integer we’re suppose to somehow use in the «PlayerController blueprint» ? Or is it something else? At this point I`m a bit stuck.

Hopefully someone knows what I've done wrong / what I've missed. If there are any problems with the images, please let me know so I can post ever picture in single files with better resolution.

Keep in mind I`m not a blueprint expert, so please be gentle with the techincal language! hehe. :) Thank you in advance!

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

1 answer: sort voted first

in c++ you can sort arrays, but in blueprint its a bit trickier. if you have an array of Ints representing score, you can organize that array by copying the Max Int from the array, to another array, and removing it from the first array. keep doing this until the first array is empty, and if you want each score to have a name or a structure of data, those should go in a separate array that is kept in sync with the integer array. every time you copy over a score from the integer array, you should also copy over the name/data that corresponds to that score. so basically 4 arrays, copying from 1 pair into the other pair, keeping the score separate from the rest of the data so you can sort by it.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Integer/MaxOfIntArray/index.html

more ▼

answered Nov 01 '16 at 11:05 PM

avatar image

ScottSpadea
9.6k 319 205 449

avatar image Jacobs89 Nov 01 '16 at 11:16 PM

Thank you for the quick quick, @ScottSpadea ! I will try what you said, and hopefully I understood what you meant!

If someone has done it and has screens of blueprints showing this it would be amazing tho!

avatar image ScottSpadea Nov 01 '16 at 11:26 PM

you may never have to sort it at all, if you insert new scores into the list in the proper location in the first place. first, check if the new score is greater than the first score in the array, if not, you didn't get a high score. if it is greater than the lowest score in the array, foreach through the array, comparing the new score with each score in the array, until you find one larger or reach the end of the array, then insert the new score at that index.

(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