Counting Instances of Names

I’m curious what the most performant way is to do this.

Suppose that, periodically during gameplay, I generate a name value (in this case, the name of a move which successfully connects). I want to count all of the moves that occur so that, at the end of a round, I can supply a player with which move they used the most.

Suppose also, for the sake of argument (since it’s true), that there are something on the order of 200+ things that this name value could BE, so it would be rather unwieldy to use a SwitchOnName node and a big-*** list of Integer vars, one for each possible name.

I considered using an array of Ints for this, but the problem is I don’t have a really meaningful way of transforming names into array indices. I have all of the moves stored in a large DataTable, but given a RowName for a DataTable there’s not actually a way to retrieve the row number.

I COULD go and add a new column to this table and just manually number from 0-whatever and use that value as a “MoveIndex” value… but it seems like I might be overlooking a much simpler way of doing this.

Does a single player character actually have 200+ moves, are does each individual character have like 10 and total there’s 200 unique moves? If it’s the latter I would create an array for each character in its BP that contains just it’s own set of moves. Then whenever the player performs a move increment a separate int array where the index corresponds to the move in the string array of moves. Basically just assign moves 1-10 or whatever and when it’s executed call the update array function with the move number. At the end of the round you can get the index of the largest item in the int array, and then use that index to get the name of that move from the move array.

It’s the former. The player character currently has about 35 unique attacks and I’ve only implemented 1 of the 8 available weapons.

I ended up just using an “Index” integer in the attack table, though, since some moves have multiple entries in the table (for different segments of the attack with different properties) so I need to be able to manually specify attack indices rather than just counting rows.

Hello,
Not sure this is what you are looking for but you can create two arrays, one with list of names, one with int.
When attack is done, you use a function with the index value of the attack. (by ordering attacks and array identically this value will be the same) function as an input int : IndexIn and is a “get” value from int array using IndexIn as index / “set” value from int array using IndexIn as index.

When finished : “for each loop” names array : loop body : “set text” of element / “get” value in int array with same index / “set text”