What is the difference between these two and why would you use a data table in the first place? From what I think I understand, you want a data table for static things not meant to change and a struct to contain variables you want to change. I’ve been trying to make an inventory system that basically when you walk over an object, it picks it up, and adds it to the struct but I haven’t had any luck trying to figure it out.
I tried using the character blueprint for a test of adding a specified amount and printing it to the screen and it works. I can’t figure out why the two aren’t communicating with each other.
The data table needs a struct as basis, it’s usually used for static massive data that’s right. Struct is a basic variable and it’s been used everywhere. If you want to pass several related vars or simplify your graph, just use it without doubt.
For an inv system, DT and struct usually work together to define items’ attribute. One would like to use an array of enums or names for item storage. When interacting in the world, your character manage his/her inventory by adding/removing things in that array, when an item take effect, you wanna search the table to decide what the effect is.
Btw, no politically correct in my country lol.
Not much of a help, but I too find sctructs tricky to update, especially if you make things deeper and add arrays in them. However you can try to use Set Members… to modify the struct - it usually works fine.
I’ve tried using the set members in struct but it still doesn’t work. As far as I can tell it’s coming down to the Struct simply not setting the amount. If I break the node from the set and plug it into a print, it’ll read each value it’s getting from the random 3 to 8 range. It’s just not saving it.
I broke it up like this and tied it directly to the print and the 3 to 8 randomizer is reading fine. It really does just seem to not want to set inside the struct itself. I’ve tried breaking and making and set member and even tried setting the variable and I’ve had no luck at all.
Doing this I think what’s happening is that it’s taking that value of 3 - 8, reading it, then setting it back to zero. Because if I pick up 3 scrap that are worth 4,3,6
It’ll read each of them instead of adding them.
I figured it out! The solution was I had two different variables set to the same struct and assumed altering the struct in one would change it for the other. It didn’t. So I brought in the struct variable from my character blueprint and altered it that way and it’s working now.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.