This is a bit of a naïve question, but I’m wondering if it’s possible to, in effect, get the content of a specific cell in a data table, or if there’s a better way to achieve the result I’m looking for.
Problem
In the example table below, I get the row based on the player’s input. What I want to do next is to get a specific cell depending on the character’s current Pose (1, 2, 3, etc.). Just for ease of set-up, all the cells here have the same value, but in our use case they would have different values:
For example, if the player enters Input 1 and they are in Pose 2, I want them to do something different from if they did Input 2 in Pose 2, or Input 1 in Pose 5, etc.
The actual use case for this is fairly complex; there are about 50 possible poses (columns) and about 18 inputs; that’s also why I don’t want to just break the row–because it would give an onerous number of outputs.
Ideal outcome
Because of the large number of columns (or rows, if the table was transposed), an ideal outcome would be to be able to set an enum or other variable directly from a specific cell of the table. E.g., I’d love to be able, for row X, column Y, get then set set variable Z.
But are there alternative solutions? Is there a way to do this in C++ rather than BPs?
Thank you, gardian! Yes, I have. Could you explain a little more what part of this my question has missed?
I understand that the rows of tables are structs (the columns being the structs’ members). Is that right? The difficulty comes when having to split those structs; it necessitates things like this:
the Table is a Struct (this one is dynamically derived by the Engine from the CSV), but the Row is also a Struct (this is programmer defined, and what I was talking about in my previous post) so in essence a DataTable object is (a struct of structs) a CSV defined Engine Dynamically Generated Struct of Programmer defined Structs with known Members.
considering the final section of the Data Driven Gameplay Doc
goes over the concepts of working with the Data Table in C++
you could have an enum (don’t give it class or derive it from uint8 so that it derives natively to int32 instead) then use that enum cast to (int32) as the argument to FindRow()
this should return a struct that is the Row. if you would want to work on some parts in Blueprints it looks like you will need to wrap the FindRow into a BlueprintCallable at the least,
It appears from the description that these functions are intentionally not exposed to blueprints, so you at least kind of get your wish for wanting to do it in C++
It’s great to have such clear and informative answers!
I’ve marked pezzott1’s response as the solution, as this seems very promising for our use-case, but the extra info from Gardian is really helpful, too!