diff --git a/Content/Blueprints/Items/ItemsInWorld/BP_BuffPlacedItem.uasset b/Content/Blueprints/Items/ItemsInWorld/BP_BuffPlacedItem.uasset index eae64c2..016dc00 100644 --- a/Content/Blueprints/Items/ItemsInWorld/BP_BuffPlacedItem.uasset +++ b/Content/Blueprints/Items/ItemsInWorld/BP_BuffPlacedItem.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11a9b9b88cf518e73e6bc64dd07a0ba7454a2003fefb91ec7df3f674527a38cb -size 31226 +oid sha256:ad2b40d361c7b3ad8a4c24cce72977f845a9ca15c9adb04e0ed639dbddef6c11 +size 31223 diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index 8a2e9cf..78d4a0a 100644 --- a/Content/Levels/MerchantPrototype.umap +++ b/Content/Levels/MerchantPrototype.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2616e6c43b1e4c6a0150deb3383a64d5b0a9279784748ef8240c5a75dc6ca7bf +oid sha256:a8a5622a6c5baa77fc539a091380c71a185e20f8688e5ded51a48628b582a446 size 27207 diff --git a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp index ccdda07..8a5a53e 100644 --- a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp +++ b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp @@ -40,10 +40,11 @@ bool UInventoryComponent::AddItem(class UBaseItem* BaseItem) BaseItem->StoredItems = this; BaseItem->World = GetWorld(); Items.Add(BaseItem); - BaseItem->ItemID++; + BaseItem->SubItemID++; UE_LOG(LogTemp, Display, TEXT("ITEM HAS BEEN ADDED")); //log the itemid UE_LOG(LogTemp, Display, TEXT("ITEM ID: %d"), BaseItem->ItemID); + UE_LOG(LogTemp, Display, TEXT("SUBITEM ID: %d"), BaseItem->SubItemID); //Refreshes the inventory OnInventoryUpdated.Broadcast(); @@ -59,7 +60,14 @@ bool UInventoryComponent::Remove(class UBaseItem* BaseItem) UE_LOG(LogTemp, Display, TEXT("ItEM HAS BEEN REMOVED")); BaseItem->StoredItems = nullptr; BaseItem->World = nullptr; - Items.RemoveSingle(BaseItem); + if(BaseItem->SubItemID < Items.Num()) + { + Items.RemoveSingle(BaseItem); + BaseItem->SubItemID --; + UE_LOG(LogTemp, Display, TEXT("ItemRemoved")); + UE_LOG(LogTemp, Display, TEXT("SUBITEM ID: %d"), BaseItem->SubItemID); + } + //Items.RemoveSingle(BaseItem); OnInventoryUpdated.Broadcast(); // Updates UI return true; } diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h index d05fe0c..524269a 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h @@ -55,6 +55,9 @@ public: UPROPERTY(EditAnywhere, Category = "Item") int ItemID; + + UPROPERTY(EditAnywhere, Category = "Item") + int SubItemID; //reference to the UInventoryComponent script UPROPERTY() diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index 09b1a43..352aee9 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -10,6 +10,7 @@ UEatableItems::UEatableItems() { ItemID; + SubItemID; } void UEatableItems::Use(ATempCharacter* Character)