How do I change Data Table row with an input?

What I’m trying to do is a weapon system where there’s just one weapon blueprint and a structure with all the weapon data. When I change weapon with an input I want to select the correct row in the data table, so I can get the weapon data. If you look at the screenshot, I just need something to plug into the Row Name to change it.

How do I do that?

How are we selecting the right weapon? Are you requesting a specific weapon or cycling through the stuff in the DT? How do I know which name to pull?

I wish to select a specific weapon. On input I’d want the row name to change to the other weapon that I have on me.

So the other weapon you have on you - it sure has the name you need, right? Pull it out of the weapon and query the DT.

Would that work?


If in doubt, do explain how the weapons are stored on the player. But most importantly: why do we even need to do this? Wouldn’t it be more logical if every weapon had its own data rather then pull it out of a DT every time you need to use one?

Or is this some kind of advanced mechanics where the weapons are highly customisation and / or modifiable.


Generally speaking, you query the DT for the name and make an Actor out of that data. Not the other way round…

Alright maybe I haven’t explained myself all too well, sorry, I’m very new to this. I saw people recommend to create a weapon system based on DT from this thread:

This is what I’m trying to do, but being that the answer didn’t go in depth as to how to actually implement it, I’ve gone through that on my own, but I’m not even sure if I’m doing the right things. If you think this is an actually decent system to use, then I’ll go ahead and explain what I’ve done so far, so that you can figure out what’s left to do. Otherwise, I’ll just switch to a more optimal system.

I’d want the row name to change to the
other weapon that I have on me

So how does the player end with specific weapons in the first place? Each weapons is an actor that gets spawned?

Makes sense, so what is stopping you from storing 2 currently equipped weapon names on the player?

[edited for a more relevant screenshot]

Yes. There’s a master blueprint for how weapons work, a parent class and child blueprints. That way, when you switch weapon, you’re only changing the weapon’s mesh and changing the weapon stats that are contained inside the struct I created. Really cumbersome for 2 weapons, but good for large amounts.

you could do it like that

get Datatable row names array length

get ref from the the same array and set the index to the previous index+1/-1

plug the ref into row name.

ok ,i see.

OP is switching between 2 weapons they already have. You’re cycling through the entire DT…

what if he added a third one?

They will still not want to cycle through the entire Data Table, surely (where there can be 50+ guns) but get 1 out of 3 instead. Probably like this:

Besides, the weapon is already equipped, the goal is to search by specific Name

You could keep names in a Map; there’s dozens of options here. But why complicate things. :expressionless: