Find map key based on value

I am making a high score table so I can show the top 10 scores that have been achieved.
i have a functional way sorting my table, but this has the scores as the keys

Sadly, you cannot have the two of the same keys in a map (which makes sense), but this means that player’s can’t score the same amount of points which is a problem

the simple solution to this is to use the usernames as the keys instead of the scores, but this means I need would need to find the key that matches with the value. is there any easy way to do this or am i basically condemned to going through each key and checking whether it has the same value that i’m looking for

here is my existing code for sorting my table: sorting table posted by anonymous | blueprintUE | PasteBin For Unreal Engine

The find node


that’s what i’m using now, but it only works if my keys are the scores due to the sorting

what i need is basically the find node, but with the value as input instead of the key, and that the output is the key

I think switching to an array of structs would be easiest ( name, value ).

Then you can just sort it, and take the top 10.

Why have a map if you don’t want to lookup the players?


the names and scores are linked, but they’re sorted by scores, i know the score, i need to know the player, i’ll try the array of struct, i’ll get back to you

If you maintain a sorted array of structs, you never need to sort it. As long as you have an ‘insert’ function, you can always take the top 10.

the struct isn’t going to work, i’m using a map to make sorting easy, but an array of structs doesn’t let me easily sort it

Like I say, don’t sort it, use an insert routine…

i managed, i want it to sort so that players can easily combine their scoreboards