Can't even make a simple dice roller with a data table.

Subject says all. I have been trying to make a function library set up to roll dice, but I can’t get the bloody thing to work. The data table is one column, with a an int - the type of die - but I can’t, for the life of me get a function to recognize and pull the integer from the data table. I can’t even get the function to even read the row. I set up an enum that matches the row name, so I could just select D2, D4, D6, etc in the function, but even that won’t find the row if I do a get row name. And yes, I have a struct file too. All I want to do is to be able to read an integer from a data table, based on an enum. Beyond frustrating…

Does anyone have a screenshot of a dice roller that uses a datatable, so I can at least see what the flow is and can get it right for once?

Thanks in advance.

its be better if you show us your code and we can see where you went wrong.

in saying that do you even need all that, can you just use RandomIntegarInRange 0 - X

1 Like

Nothing to show. All I’m trying to do is read an integer from a datatable, so I can use it in the X placement of RandomIntegerInRange. I have functions for all the dice I needed. Was trying to make a more robust one. Why have 8 functions in a blueprint library when you can have one that can do the job of the other 8, you know?

only one function, its the same thing, X is an input variable,

it can be an integer 4 for D4 or it can be an Enum of D4 that finds a Datatable just to return the int 4

you could also switch on Enum if thats your preferred method

otherwise it really is just GetDataTableRow? but then there is no point using an Enum as you can GetDataTableRowNames as an input

I tried that too. The issue I am having is getting the actual integer. I’m not in front of my PC, as Im at my kid’s kung fu class, but I made a function with 3 inputs: number of dice, type of dice and modifier. Have made type of dice to both name and enum. Link function to a get datatable row with type of dice, but it’s not even getting the row from debug testing. Gives me a fail every time. That’s why I asked if anyone had a screen shot. Wanted to analyze it to see what I am doing wrong as I can’t even get TO the integer.

just a random one i found on the internet for ya, does what you’re trying to do?

i would say make sure your name conversion is correct

Here’s my most recent test. I’m using an enum (Type of Dice) to hook into the Row Name of the Data Table, so the user can just select it from a drop down, instead of manually putting it in. I then split the output, as it’s only a single int and in this case, if it was found it would just set the DieType_Int (dummy variable for testing) and push it to the output of the function. When I test it in a level, it returns with 0. If I add debung strings, it will tell me it goes to row not found, which doesn’t make sense, as the row names are identical to the enum, so no matter which enum you select, it matches a row in the data table. I’ve tried making a DT ref, using row and column handles. Nothing works. I’m missing something simple and I don’t know what it is.

[EDIT] - You can see here that my enum file matches my DT. This is why I’m so frustrated. I’m missing something utterly simple and I know it.

as said be careful with enum to name conversion

to debug just unhook the name pin and choose a row manually to see if it works, if so the conversion is wrong.

you can use a printstring to test but there could by a typo somewhere

1 Like

Just did this and sure enough, it finds the row fine. What else can I use then to allow the user to pick the dice, instead of manually putting it in? Thanks for pointing that out. I’m still learning the basics of blueprinting, but I’m decent enough to typically figure things out. This is the first time I borked something using a DT in a long while. I thought Enums were compatible with names.

out of curiosity printstring the conversion to see what it says, i’m not in editor either.

ive seen in the past Enum → string → name works better but ive not tried it.

otherwise im pretty sure you can use the DataTableRow handle as an input itself instead of the enum

1 Like

That actually worked! It looks messy, going from one to another to another, but it worked. I tip my hat, Sir! Thank you! o7 I’ll have to add this to my notes. I planned on using a lot of enums for my project.

1 Like

yeah seems to be an age old bug that i thought was fixed, good luck!

Nice to know! Well, I got it working and now have a single dice roll function, instead of 8. Means I can rename this library and add more functions to it. In case anyone else comes along and has the same problem I did, here’s the blueprint. I’m sure there’s a way to not use the two local variables I had to create, but at least they’ll have a visual reference if they hit this snag. Thank you again, Auran. o7