TArray accessible almost from anywhere

Hey guys,

pretty much newbie here. I am just playing around with this FPS template project, I was able to create items, pickup system and created basic structure to store in array as inventory.

What I want to do now, and in C++ for later possibility of modding, is load all available items into array consisting of

int - itemId
FString - itemName
UstaticMeshComponent - itemMesh

Therefore I will have list of existing items available from anywhere, so I can get it’s name and model from more or less anywhere. Right now in one case from player’s inventory to list items player owns and it’s names, and for random pickups where i just generate number and set static mesh and item name from this list.

Is there some way to store data like this globally? With ability to fill the array from C++?

I will be thankful for any insight,
Cheers

Hey!

Yeah there is some containers to store things globally.
Check out this doc and take a look into how DataTables works…
Datatables is designed and used mostly to create datadriven gameplay elements.
Of course you can extend and create your custom datatable asset type (through editor extension) and you can do everything you want (for example fill datatable from mysql database).

Im not really sure how you really want this “modding” stuff, but datatables is a good start. :slight_smile:

https://docs.unrealengine.com/en-us/Gameplay/DataDriven