Hi guys! First time posting on this forum . I’ve been thinking, wouldn’t it be very powerful to be able to edit or add to a data table at runtime? For example: I have a crafting system that uses data tables to define the recipe, output, and ingredients. For the output and ingredients, they have to be the same as the item data on the item actor in order for the recipe to realize that the player has the right items. Right now, the way I got about it is that I copy paste the item data struct from the item actor class into the data table. This has been working and I have no real problem with it. However, I think it would be much more efficient if I could make a blutility function that would look for the recipe name in the data table and update it with the correct item data if they’ve changed. And if not, it would add the recipe to the table. Is there a way to do this with C++ that I don’t know of? If so, would it be possible to make a blueprint expose of it? I’d be happy to make one for everyone to use! Thanks
Sounds like you are going about creating your items in a very strange fashion. You would be better off generating your items based on your data table instead of doing it the other way around.
I agree with being able to edit data tables at runtime being a very desirable thing but I would still look at the ways you are using them and see if there is a better way to do it
Hmm yeah you’re right; I may try switching over to that. Honestly, I just prefer having each item’s data being held and editable in its own class; but I’ll look into it. Even then though, I would still a way to add to data tables in order to add recipes and keep them updated. Is it worth using Rama’s write to text file node to write to a .csv? Or is there a better way? Thanks for the response!
> Or is there a better way?
Yeah I would use the SaveGame class
Hmm also a valid point, I’ll try that out. But I really like the ease of use of datatables. Is there no way to add to them in engine besides using the data table editor manually? Thanks for the response!
Ive used data tables for simple reading but quiet surprised it doesnt support writing…?
Yeah - though honestly, if there was a function that parsed structs into plain text, that might work as well. I could read from the .csv, then update the lines that need updating, then write again. The biggest hurdle is just that it’s difficult to convert a struct into plaintext without a lot of text formatting and everything. Is there a way to do that?
ehh, check out the save game class. You can create a property of your struct type and use the save game functions to just store it on file in UE.