From 797c447d4798889630baf514f2e4e687500fcafe Mon Sep 17 00:00:00 2001 From: MH261677 Date: Mon, 6 Feb 2023 23:51:45 +0000 Subject: [PATCH 1/8] Added Ammo Icon to Images --- .../Items/ItemsInWorld/BP_HealingJellyItem.uasset | 4 ++-- Content/Images/ammoicon.uasset | 3 +++ Content/Levels/MerchantPrototype.umap | 4 ++-- Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp | 2 -- Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp | 7 ------- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 1 + 6 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 Content/Images/ammoicon.uasset diff --git a/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset b/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset index 5e94613..b53dd84 100644 --- a/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset +++ b/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:32388bd47d08a69c1f782c682fdf67358fb2fdd5f9dd821ed9fc97d66a0bda70 -size 31327 +oid sha256:14abf326c7821612e3c60b5312759ae40948cadf47a909bf25201e0dfa39ea7d +size 31322 diff --git a/Content/Images/ammoicon.uasset b/Content/Images/ammoicon.uasset new file mode 100644 index 0000000..f2ed9de --- /dev/null +++ b/Content/Images/ammoicon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c3fc688d58293f796f23824c1478b40cf0d62f868547a7f0e6bf25a471db496 +size 9826 diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index ea85903..b26f4c0 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:838c48c134383d4b1db178233640e11ef2c4bcd49102f53648cf621dd1dcbf8a -size 27100 +oid sha256:a85cec4d3024ec9a40e0fd888530e7982d06461cf90dca88004eae911b6a8431 +size 33243 diff --git a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp index a208bd0..2c808c8 100644 --- a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp +++ b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp @@ -40,13 +40,11 @@ bool UInventoryComponent::AddItem(class UBaseItem* BaseItem) BaseItem->StoredItems = this; BaseItem->World = GetWorld(); bool isNewItem = true; - // for every item in inventory for (auto & Item : Items) { //if the item is the same as the item that is being added if (Item->ItemDisplayName.ToString() == BaseItem->ItemDisplayName.ToString()) { - //add the amount of the item that is being added to the item in the inventory Item->StackCount++; UE_LOG(LogTemp, Display, TEXT("ITEM STACKCOUNT: %d"), Item->StackCount); isNewItem = false; diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index ceae474..eb3ceaa 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -22,7 +22,6 @@ void UEatableItems::Use(ATempCharacter* Character) { Character->Health += 10; UE_LOG(LogTemp, Display, TEXT("Healed")); - //delete itself Character->Inventory->RemoveItem(this); } else if (Character->Health >= 100) @@ -37,11 +36,5 @@ void UEatableItems::Use(ATempCharacter* Character) Character->Inventory->RemoveItem(this); } } - - /* - when player uses the item syrengine to debuff enemies - detect what enemie actors the player is fighting with - lower their damage by a value. - */ } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 42a36fe..039fdd4 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -33,6 +33,7 @@ void ATempCharacter::BeginPlay() PlayerCapsule = GetCapsuleComponent(); TArray AllActorsInScene; + //MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene); PostProcessVolume = Cast(AllActorsInScene[0]); } From 324f062cc7c72728367483a2a27aaa3c4d7d1a8a Mon Sep 17 00:00:00 2001 From: MH261677 Date: Tue, 7 Feb 2023 00:11:00 +0000 Subject: [PATCH 2/8] Updated EatableItems for AmmoFunctionality Added ammo base functionality for using the ammo item in game --- Content/Levels/MerchantPrototype.umap | 4 ++-- Source/the_twilight_abyss/BaseItems/Items/BaseItem.h | 3 +++ .../BaseItems/Items/EatableItems.cpp | 11 +++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index b26f4c0..e1f4942 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:a85cec4d3024ec9a40e0fd888530e7982d06461cf90dca88004eae911b6a8431 -size 33243 +oid sha256:c5cc473e60c24da835baacec54217c1f6c675c42c29643b889f07bff057a9c95 +size 34830 diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h index 346966f..4ff62dd 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h @@ -53,6 +53,9 @@ public: UPROPERTY(EditAnywhere, Category = "Item") bool isDamageBuffItem; + UPROPERTY(EditAnywhere, Category = "Item") + bool isAmmoItemType; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item") int32 StackCount = 1; diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index eb3ceaa..dab88bc 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -16,7 +16,7 @@ void UEatableItems::Use(ATempCharacter* Character) { if(Character) { - if(isHealingItem == true) + if(isHealingItem) { if (Character->Health < 100) { @@ -29,12 +29,19 @@ void UEatableItems::Use(ATempCharacter* Character) UE_LOG(LogTemp, Display, TEXT("Health is full")); } } - if(isDamageBuffItem == true) + + if(isDamageBuffItem) { // need to add the damage buff functionality here UE_LOG(LogTemp, Display, TEXT("Damage Buffed")); Character->Inventory->RemoveItem(this); } + + if (isAmmoItemType) + { + UE_LOG(LogTemp, Display, TEXT("ADD AMMO FUNCTIONALITY HERE")); + Character->Inventory->RemoveItem(this); + } } } From a6436c9110bca13e1edb22ce296586505e63063e Mon Sep 17 00:00:00 2001 From: MH261677 Date: Tue, 7 Feb 2023 00:11:19 +0000 Subject: [PATCH 3/8] Added BP_AmmoItem Added Ammo into the game for the player to find --- Content/Blueprints/Items/AmmoItem.uasset | 3 +++ Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 Content/Blueprints/Items/AmmoItem.uasset create mode 100644 Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset diff --git a/Content/Blueprints/Items/AmmoItem.uasset b/Content/Blueprints/Items/AmmoItem.uasset new file mode 100644 index 0000000..9991ade --- /dev/null +++ b/Content/Blueprints/Items/AmmoItem.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d7e4e608a5183142630757d1496d08c76ac9cdcb16b039c3b2e51848ab89d9d +size 6552 diff --git a/Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset b/Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset new file mode 100644 index 0000000..fa2720b --- /dev/null +++ b/Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:733e8e625dc0b5a4b8e64f50ccda5397cdeb71aa75470f42b44a4c2606730875 +size 31844 From 77c43ab3d1f4eeb8148d634b5022aae0d80e0cfa Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 16 Feb 2023 15:02:58 +0000 Subject: [PATCH 4/8] Updated TempCharacter to find AI Sphere --- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- Content/Levels/Top_layer_level.umap | 4 ++-- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 2 ++ Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 5 +++++ 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index 8d884e7..6078475 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d41dd0f4c13a2823d7cda168b1109dfa219681d8f7fda30c966830823dc227a6 -size 71310 +oid sha256:53c111471c3a161fb4ed5408ebeac5cfca08d224652308dbb07cac6d7b829d6b +size 76303 diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index 21e9727..26ace7f 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f65775451fb2105a879b7ceed94887ea520b41464c773052234285414565157 -size 54763 +oid sha256:8cbb4fe454e40e00845b7b268c15000891cfc86bf0afba299b127f6634fc5edc +size 55495 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index a338efc..b2c1483 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b12ca45d23f48747799c368c38e00f316adb025ea913272a4a36b69ec4b30fa3 -size 247139 +oid sha256:255a45f7e3d4362cc3378dd7a9858608bc92e2b4aa43fbe22db8e72eaa11e126 +size 247199 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 039fdd4..661de57 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -36,6 +36,8 @@ void ATempCharacter::BeginPlay() //MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene); PostProcessVolume = Cast(AllActorsInScene[0]); + + UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); } //Binds the input we made in the setup player component to the forward vector diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index f162b7f..4c6c866 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -89,4 +89,9 @@ public: bool disableTab = false; APostProcessVolume* PostProcessVolume; + + TArray AIActors; + + FName Enemy; + }; From 43ef8e2110506dfa5c65082dfa3584dbc71d71cb Mon Sep 17 00:00:00 2001 From: MH261677 Date: Fri, 17 Feb 2023 13:12:28 +0000 Subject: [PATCH 5/8] Updated TempCharacter to sneak functionality Added sneak functionality which makes the sphere radius smaller near enemies. --- Config/DefaultEngine.ini | 12 +++++++ Content/Levels/Top_layer_level.umap | 2 +- .../PlayerTemp/TempCharacter.cpp | 32 ++++++++++++------- .../PlayerTemp/TempCharacter.h | 1 - 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index b792816..f3f6b2f 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -128,3 +128,15 @@ CompressionQualityModifier=1.000000 AutoStreamingThreshold=0.000000 SoundCueCookQualityIndex=-1 +[/Script/GameplayDebugger.GameplayDebuggerConfig] +CategorySlot1=One +CategorySlot2=Two +CategorySlot3=Three +CategorySlot4=Four +CategorySlot5=Five +CategorySlot6=Six +CategorySlot7=Seven +CategorySlot8=Eight +CategorySlot9=Nine +CategorySlot0=Zero + diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index b2c1483..a836a5f 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:255a45f7e3d4362cc3378dd7a9858608bc92e2b4aa43fbe22db8e72eaa11e126 +oid sha256:483069f41683db60a67e1b2417c5f3cd17005922d2a67500997ebbc20cb3cbba size 247199 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 661de57..6a7ace7 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -5,10 +5,11 @@ #include "Blueprint/UserWidget.h" #include "the_twilight_abyss/BaseItems/InventoryComponent.h" #include "the_twilight_abyss/BaseItems/Items/BaseItem.h" -#include "Components/CapsuleComponent.h" #include "GameFramework/CharacterMovementComponent.h" #include "the_twilight_abyss/MerchantInteraction/Interaction.h" #include +#include "Components/SphereComponent.h" +#include "Kismet/KismetMathLibrary.h" // CONSTRUCTOR @@ -37,6 +38,7 @@ void ATempCharacter::BeginPlay() UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene); PostProcessVolume = Cast(AllActorsInScene[0]); + Enemy = TEXT("Enemy"); UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); } @@ -58,10 +60,26 @@ void ATempCharacter::Sneak() { UnCrouch(); PostProcessVolume->Settings.VignetteIntensity = 0.0f; + for (AActor* Actor : AIActors) + { + USphereComponent* SphereComponent = Actor->FindComponentByClass(); + if (SphereComponent != nullptr) + { + SphereComponent->SetSphereRadius(40.0f); //default value + } + } } else { Crouch(); + for (AActor* Actor : AIActors) + { + USphereComponent* SphereComponent = Actor->FindComponentByClass(); + if (SphereComponent != nullptr) + { + SphereComponent->SetSphereRadius(15.0f); + } + } PostProcessVolume->Settings.VignetteIntensity = 0.8f; } @@ -185,11 +203,7 @@ void ATempCharacter::InputDisabler() PlayerController->bShowMouseCursor = true; disableTab = true; - if (ThisCamera == nullptr) - { - return; - } - else + if (ThisCamera != nullptr) { OriginalCameraLocation = ThisCamera->GetComponentLocation(); OriginalCameraRotation = ThisCamera->GetComponentRotation(); @@ -213,11 +227,7 @@ void ATempCharacter::InputEnabler() UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); disableTab = true; TraceDistance = 300; - if (ThisCamera == nullptr) - { - return; - } - else + if (ThisCamera != nullptr) { ThisCamera->SetWorldLocation(OriginalCameraLocation); ThisCamera->SetWorldRotation(OriginalCameraRotation); diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 4c6c866..44ba91e 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -6,7 +6,6 @@ #include "GameFramework/Character.h" #include "the_twilight_abyss/BaseItems/Items/BaseItem.h" #include "Camera/CameraComponent.h" -#include "Kismet/KismetMathLibrary.h" #include "Engine/PostProcessVolume.h" #include "TempCharacter.generated.h" From 3c2d0579515402632b344f15b5b16f9dd070b2b0 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sun, 19 Feb 2023 15:28:34 +0000 Subject: [PATCH 6/8] Updated TempCharacter to destory ammo ore destroys ammo ore when the player presses e on it --- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 6 ++++++ Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 6a7ace7..6710218 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -40,6 +40,8 @@ void ATempCharacter::BeginPlay() Enemy = TEXT("Enemy"); UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); + + Ammo = TEXT("Ammo"); } //Binds the input we made in the setup player component to the forward vector @@ -150,6 +152,10 @@ void ATempCharacter::LineTraceLogic() { UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); } + if(OutHit.GetActor()->ActorHasTag(Ammo)) + { + OutHit.GetActor()->Destroy(); + } } // if the actor hit has the interaction component/script then it will activate the code diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 44ba91e..57675b2 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -93,4 +93,6 @@ public: FName Enemy; + FName Ammo; + }; From 618a9509cabf01f97be0b9108653ef5b9bab86d8 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sun, 19 Feb 2023 15:29:16 +0000 Subject: [PATCH 7/8] Updated EatableItems to add ammo {UNSTABLE} Added functionality to the ammo count currently unstable as need to wait for other programmer to understand why it crashes. --- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- Content/Levels/Top_layer_level.umap | 4 ++-- .../the_twilight_abyss/BaseItems/Items/EatableItems.cpp | 9 ++++++++- Source/the_twilight_abyss/BaseItems/Items/EatableItems.h | 6 ++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index 26ace7f..b161173 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cbb4fe454e40e00845b7b268c15000891cfc86bf0afba299b127f6634fc5edc -size 55495 +oid sha256:8e348a27c5a931226dba531ec739fec1e28b9f912e91b46078ed811fe50f06bd +size 54956 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index a836a5f..dbb4467 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:483069f41683db60a67e1b2417c5f3cd17005922d2a67500997ebbc20cb3cbba -size 247199 +oid sha256:3ddfcf9a4f7c3b3ab626893a0d6d13cac4483f9a471bbdba97d0d00efc563dd7 +size 248803 diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index dab88bc..94a308e 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -39,7 +39,14 @@ void UEatableItems::Use(ATempCharacter* Character) if (isAmmoItemType) { - UE_LOG(LogTemp, Display, TEXT("ADD AMMO FUNCTIONALITY HERE")); + if (TurnBaseCombat->IronResource > 10) + { + TurnBaseCombat->IronResource += 5; + } + if (TurnBaseCombat->SulfurResource > 10) + { + TurnBaseCombat->SulfurResource += 5; + } Character->Inventory->RemoveItem(this); } } diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h index d636bcd..dadfc27 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "BaseItem.h" +#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h" #include "EatableItems.generated.h" /** @@ -19,4 +20,9 @@ class THE_TWILIGHT_ABYSS_API UEatableItems : public UBaseItem protected: virtual void Use(class ATempCharacter* Character) override; + + +private: + + ATurnBaseCombatV2* TurnBaseCombat; }; From e9af8b713fa2964169d0e68835d273ca4d3411e0 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 20 Feb 2023 14:49:05 +0000 Subject: [PATCH 8/8] Updated EatableItems to fix Ammo Consuming Fixed ammo consuming crashing the client --- Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp | 1 + Source/the_twilight_abyss/BaseItems/Items/BaseItem.h | 1 + Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp index 2fac2d1..40ea61b 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp @@ -14,3 +14,4 @@ void UBaseItem::Use(ATempCharacter* Character) { } + diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h index 4ff62dd..613c763 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h @@ -72,4 +72,5 @@ public: //This is the same as the use item class but its in BP instead UFUNCTION(BlueprintImplementableEvent) void OnUse(class ATempCharacter* Character); + }; diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index 94a308e..c481d7b 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -39,6 +39,7 @@ void UEatableItems::Use(ATempCharacter* Character) if (isAmmoItemType) { + TurnBaseCombat = GetWorld()->GetGameState(); if (TurnBaseCombat->IronResource > 10) { TurnBaseCombat->IronResource += 5;