Spawning an actor with a custom option on the details panel

The game I’m building uses “cards” as equip items. I created a struct for all the different variables a card might have, and then a datatable from the struct to be a library of all the potential cards in the game.

Put simply, what I wanted was to be able to drag the card actor class into my level, and then in the details panel have a drop down list where I choose which card that individual actor is. So I can spawn any card from one actor class, and alter the individual like you would any other parameters.

Enemies and chests and stuff will also spawn cards further down the line, but I just wanted to be able to quickly generate a couple of specific cards, with details from my datatable to have something to work with while I build the pickup / inventory / equip / character stats stuff.

I’ve tried the method outlined here: https://answers.unrealengine.com/que…tails-pan.html but I don’t get the option for the Fdatahandle stuff, despite checking that the .h file is correct, which was disappointing, but that thread is 6 years old, so it’s no wonder things aren’t exactly the same.

https://i.imgur.com/jyxfvqs.png this is the basis of what I was working on. Do I need to interrupt the sequence in the middle and cast to the details panel somehow? Or it this whole thing much more complicated than I’m trying to make it?

https://marketplace-website-node-lau…en-game-items# I also tried the resources detailed here, but I think that’s just a more efficient way of going about the same process I was trying anyway, and has essentially the same missing step, and unfortunately the server is down on all those links so I can’t check through the literature.

Any help would be lovely, thanks guys

Building the list of options … construction/begin play → Get data table row names → Set “Row Names” array.
https://docs.unrealengine.com/en-US/…mes/index.html

In the data table have the first Row be the default “None”. For configuring the card just boolean check the row name before executing. Then use the dropdown value -> Get Data Table Row and Make -> Set the struct.

EDIT

Re-read your post!

Create an ENUM List of the Cards (Data Table Row Names). Create a var in defaults that uses that list.

For generic randomization you can use Random int in Range -> ToByte (integer) -> Byte to enum -> Set row name.

That’s worked for selecting, thanks a lot. I was over thinking it I think.

Will I be able to use that variable to get the actor to refer to the correct row of the DT when the “item” is in my inventory / equipped?

So when I drag the card to the equip slot my characters stats look at that variable, and then go find the equivalent row in the DT and adjust damage etc. accordingly.

I’ve not started building the equip widget yet, just checking if it’s a good idea to try and make it work like that before I start

Here’s a simple demo of it.

For the card (DT_Item) On Begin Play I check if “Rows” (enum_DT_List) is set to something other than None (default value). If None I randomly set a value.

Once Set I call Set Data (event) … Once again I verify Rows != None, then get row and set the mesh material. You’d set all all other values as needed here.

From there I’m just calling a debugger event to print some output.

This bit of code is in my character class. I’m simply spawning a random DT_Item and then letting the DT_Item’s Begin Play logic take over.
Obviously the Row will be set, thus False on the branch -> Set data.

Demo video

Ah, I see what you were saying now. My foundation was correct and I think I was generally on the right path, but getting to the result you’ve shown here would have been beyond me for the moment. Thanks a lot, this is incredible. I’ll give it all a go tomorrow and see how it all comes together.

My concern when I see devs looking at dynamic configs w/data tables is intended usage under load. It boils down to how many rows, columns per row, spawn rates and number of clients.

Say I have a table with 100 items, 15+ columns of data and I’m spawning/pooling upwards of 200 or more per second in a multiplayer game. This can have an impact on the server and increase spawn delays for the clients. In multiplayer the server (authority) is the entity that spawns objects/actors etc for replication. Clients mimic the servers world. Anything that slows the server will have an impact on the client.

food for thought. :slight_smile:

Plenty of rows and columns, but they’ll be spawning sparingly. A few from a chest / dead mob here and there.

Is the Get Mesh that’s the target on your set material node a mesh component variable? It compiles fine, but I don’t get the colour on the actor and I get an error for it when I play the game

DT_Item has a static mesh component (cube). I renamed the component to Mesh. The data table structure contains Color which is a material reference. I’m just setting the mesh material on spawn for a visual reference to show change.