How do I replicate an inventory?

You use standard C/C++ casts with pointers to structs. You can’t cast structs by value.
So you can do:


FItemWeapon* weapon = (FItemWeapon*)item;

assuming item is a pointer to FItemBase.

But as I said above, this won’t work for your inventory. TArray< FItemBase* > is no good since pointers to structs are not replicated (at least I’m pretty sure they’re not). If you just had a TArray< FItemBase > then this isn’t polymorphic - all the items have to be of FItemBase, you can’t put a derived type in that array.