Updated Merchant

Fixed crash error and merchant dialouge box pops up now, Started working on item stacking
This commit is contained in:
MH261677 2023-01-12 13:05:43 +00:00
parent 320a74d4bb
commit c107c9a490
5 changed files with 8 additions and 7 deletions

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

View File

@ -24,7 +24,7 @@ public:
// Called every frame // Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(EditDefaults) UPROPERTY(EditDefaultsOnly)
bool bInteractable = false; bool bInteractable = false;
UFUNCTION(Blueprintcallable) UFUNCTION(Blueprintcallable)

View File

@ -77,13 +77,14 @@ void ATempCharacter::LineTraceLogic()
if (bHit) if (bHit)
{ {
//we store the GetItem function from InventoryComponent into ItemArray variable //we store the GetItem function from InventoryComponent into ItemArray variable
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if(OutHit.GetActor() == nullptr) if(OutHit.GetActor() == nullptr)
{ {
return; return;
} }
if(OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()) if(OutHit.GetActor()->FindComponentByClass<UInventoryComponent>())
{ {
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if(GoldBalance >= ItemArray->ItemCostPrice) if(GoldBalance >= ItemArray->ItemCostPrice)
{ {
GoldBalance -= ItemArray->ItemCostPrice; GoldBalance -= ItemArray->ItemCostPrice;