Updated TempCharacter to stop crashes

This commit is contained in:
MarcelHara 2023-05-09 12:50:34 +01:00
parent 0632a1770b
commit b3c83f161f
2 changed files with 20 additions and 12 deletions

BIN
Content/Levels/Build.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -271,7 +271,13 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
void ATempCharacter::BuyItem(AActor* Item)
{
UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
if (Item == nullptr)
{
UE_LOG(LogTemp, Display, TEXT("Item is null"));
return;
}
else
{
UBaseItem* ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if (GoldBalance <= 0)
{
@ -283,7 +289,9 @@ void ATempCharacter::BuyItem(AActor* Item)
Inventory->AddItem(ItemArray);
UE_LOG(LogTemp, Display, TEXT("Item Purchased"));
}
// UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING"));
// TraceDistance = 1000;
// LineTraceLogic();
UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING"));
TraceDistance = 1000;
LineTraceLogic();
}
}