I will try to do a quick edit, but this is not guaranteed it will work, but you will get better understandings of your mistakes in your code
case EItemType::E_Weapon:
{
if (const UDataTable* DT_ItamWeaponRows = LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/DT_ItamWeapon")))
{
OutRowNames = DT_ItamWeaponRows->GetOutRowNames();
}
for (auto& StructArrElem : OutRowNames)
{
if (const UDataTable* DT_ItamWeapon{ LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/DT_ItamWeapon")) })
{
if (const FST_ItemWeapon * OutRow{ DT_ItamWeapon->FindRow<FST_ItemWeapon>(FName(StructArrElem ), "") })
{
if (OutRow)
{
WeaponItemDatas = *OutRow;
TempItemTypeAndID_var.ID = StructArrElem ;
}
}
}
}
for (int i = 1; i <= WeaponItemDatas.ProbabalityPercent; i++)
{
TempItemTypeAndID_var.Type = EItemType::E_Weapon;
StructArr.Add(TempItemTypeAndID_var);
}
}
hope it helps
cheers.