From e205f7522c4b055f693f2e12250263dc5f8a9fcf Mon Sep 17 00:00:00 2001 From: Rafal Swierczek Date: Thu, 1 Feb 2024 15:32:43 +0000 Subject: [PATCH] Integrated Tutorial Bounty and WIP Apartment Bounty using Save System --- .../.idea.EndlessVendetta/.idea/workspace.xml | 16 ++++++++-- .../ApartmentBounty/MB_Apartment.uasset | 4 +-- .../ApartmentBounty/OWCP_Apartment.uasset | 3 ++ .../Blueprints/BP_FirstPersonCharacter.uasset | 4 +-- .../OverloadModule/CG_OverloadModule.uasset | 4 +-- .../RingModule/RG_RingModule.uasset | 4 +-- .../VisionLink/RG_VisionLink.uasset | 4 +-- .../Content/Levels/ControlTutorialLevel.umap | 4 +-- .../Content/Levels/MainMenuLevel.umap | 4 +-- .../Content/Levels/TempOpenWorld.umap | 4 +-- .../Gameplay/MainMenuPlayerController.uasset | 4 +-- .../Architecture/Floor_400x400.uasset | 2 +- .../BountySystem/BountyClass.h | 7 ++--- .../CheckPoints/FinalCheckpoint.cpp | 19 ++++++++++++ .../CheckPoints/FinalCheckpoint.h | 22 ++++++++++++++ .../BountySystem/MainBountyClass.cpp | 26 ++++++++++++++--- .../BountySystem/MainBountyClass.h | 16 +++------- .../BountySystem/SideBountyClass.cpp | 10 ++++--- .../Characters/BountyHunterCharacter.cpp | 29 +++++++++---------- .../Characters/BountyHunterCharacter.h | 17 +++++++---- .../Source/EndlessVendetta/EVGameInstance.cpp | 5 ++-- .../EndlessVendetta/MainSaveGameClass.h | 2 +- 22 files changed, 139 insertions(+), 71 deletions(-) create mode 100644 EndlessVendetta/Content/BountySystem/ApartmentBounty/OWCP_Apartment.uasset create mode 100644 EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.h diff --git a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml index 36cea23c..e65ed336 100644 --- a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml +++ b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml @@ -9,16 +9,23 @@ + + + + + + + - - + + + - diff --git a/EndlessVendetta/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset b/EndlessVendetta/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset index 9110e2c0..bfce5907 100644 --- a/EndlessVendetta/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset +++ b/EndlessVendetta/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bf06e49f17ab25c9dc3262bca893f73ef07c79a7ec7535d77a8228abe61b14b -size 22201 +oid sha256:b3961e22842e8bb12c11a7a3e55793f49209fbdecbcb861ef0296af14b5c36b0 +size 23374 diff --git a/EndlessVendetta/Content/BountySystem/ApartmentBounty/OWCP_Apartment.uasset b/EndlessVendetta/Content/BountySystem/ApartmentBounty/OWCP_Apartment.uasset new file mode 100644 index 00000000..7a36f7e0 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/ApartmentBounty/OWCP_Apartment.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d9166bbded21f9f0972c11067858db21c9157ff4b5acbbb1113348f9ae065e7 +size 27092 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 8a5364f1..9c6a1eff 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4eb5c92180442aaa9dae7586d0d0effec22d5dc4ca432330aac7899e893ba608 -size 458530 +oid sha256:6f04647dc2631937f70cae35ade2cb79606f89676a7552e29ea9b2e5f02c9bce +size 458370 diff --git a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset index ac45c725..37d99b25 100644 --- a/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset +++ b/EndlessVendetta/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a0ac6bb1c776390adbc9e10c1a9e9c6629c4f69eea6d3720d502a3b7807abf0 -size 110595 +oid sha256:fb1496b56a8e87f9025f0c245ee55e585e0b81277a74162d0531f777414f8443 +size 111687 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset index e5b9faad..c9f59c0f 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:163e6c220966ca84c1c7e3f9ae176fe99bb0f7b8b364403ad5cf42f0272a87f0 -size 108688 +oid sha256:d3ae912ab5c02aa352d2e9d4f1885e7217791a701f23b241535cd24def3e1a20 +size 109272 diff --git a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset index aea6e927..74f5f55e 100644 --- a/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset +++ b/EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:576cf6674035552a043dab60a2173beec40cf65683d138ad0df40f66fd48370b -size 108618 +oid sha256:d6c1b0360db438f17c7cbb7a907c95ae67d455c711d94866ee07bbeb932f0acd +size 109202 diff --git a/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap b/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap index 23faf0e1..acf3a596 100644 --- a/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap +++ b/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:924ade82fb0a438d9bc4dcfd060169432df9be4026eb3d47c5e3c24e2caf8eb5 -size 3452050 +oid sha256:c78dde892caa4b4cb292592b66f9ee2fd986382798310e40212c1f80ee418cee +size 3452507 diff --git a/EndlessVendetta/Content/Levels/MainMenuLevel.umap b/EndlessVendetta/Content/Levels/MainMenuLevel.umap index 410d9bd5..e211378a 100644 --- a/EndlessVendetta/Content/Levels/MainMenuLevel.umap +++ b/EndlessVendetta/Content/Levels/MainMenuLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e347eab07faf7d90209e7e64ba12694fe4804e27f840b4e171fd428466e9803 -size 299618 +oid sha256:9d351bbac850938f4243559fb2004190dc0a9ecc375e967e1beee57237a90123 +size 299666 diff --git a/EndlessVendetta/Content/Levels/TempOpenWorld.umap b/EndlessVendetta/Content/Levels/TempOpenWorld.umap index 1c06f05b..abad9c56 100644 --- a/EndlessVendetta/Content/Levels/TempOpenWorld.umap +++ b/EndlessVendetta/Content/Levels/TempOpenWorld.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dfdc199106ad2fca8d90af627e6c092483714378c3e4014dd6124fb5538b36b5 -size 13860679 +oid sha256:fd850d01c7675c006d7aa19c1ea2d9592326c10d27331654c11c6f2f79454d6a +size 13864680 diff --git a/EndlessVendetta/Content/MainMenu/Gameplay/MainMenuPlayerController.uasset b/EndlessVendetta/Content/MainMenu/Gameplay/MainMenuPlayerController.uasset index 78014c4e..142ba9c9 100644 --- a/EndlessVendetta/Content/MainMenu/Gameplay/MainMenuPlayerController.uasset +++ b/EndlessVendetta/Content/MainMenu/Gameplay/MainMenuPlayerController.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97f269934ce59b24b2c67b91559683c19b2f22cbcc081c843655f7dc3320fe2f -size 146848 +oid sha256:fb2866d4ceb699f5ab8a45d5fe54ca1d4c7110cd78fde174771b73e6a9bc2253 +size 108722 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index 8d790d9a..42a6c437 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6038bf29408d4c5be111de70be0878efba11fba22cfe715ed745704d48e6c243 +oid sha256:22ae623a43a551b2c36f14689aeb372567771b015c4668c364a3fd54d4f325d5 size 14831 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h index a0216f7d..94cb313b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h @@ -8,6 +8,7 @@ #include "BountyClass.generated.h" DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedFirstCheckpoint); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedACheckpoint); UCLASS() class ENDLESSVENDETTA_API ABountyClass : public AActor @@ -21,13 +22,11 @@ class ENDLESSVENDETTA_API ABountyClass : public AActor TArray> CheckpointsToSpawn; protected: - // Has a Get Func, Used for Identifying if the Bounty has been Completed - bool Completed = false; - // Array of References to the Spawned in Checkpoints for this Bounty TArray BountyCheckpoints; public: + FCompletedACheckpoint CompletedACheckpoint; // ------------------- METHODS --------------------------------- @@ -85,7 +84,7 @@ public: // ------ Getters for Bounty and Checkpoint Properties ------ bool IsCompleted() { - return Completed; + return false; } FString GetBountyTitle() diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.cpp new file mode 100644 index 00000000..2556bda7 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.cpp @@ -0,0 +1,19 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "FinalCheckpoint.h" +#include "EndlessVendetta/EVGameInstance.h" +#include "EndlessVendetta/Characters/BountyHunterCharacter.h" +#include "Kismet/GameplayStatics.h" + +void AFinalCheckpoint::CompleteBounty() +{ + UEVGameInstance* GI = Cast(GetWorld()->GetGameInstance()); + if (!IsValid(GI)) return; + + GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave++; + UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0); + + FName OpnWrldLvlName = FName(Cast(GetWorld()->GetFirstPlayerController()->GetPawn())->GetOpenWorldLevelName()); + UGameplayStatics::OpenLevel(GetWorld(), OpnWrldLvlName); +} diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.h new file mode 100644 index 00000000..ad1f9d2b --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/CheckPoints/FinalCheckpoint.h @@ -0,0 +1,22 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "EndlessVendetta/BountySystem/CheckpointClass.h" +#include "FinalCheckpoint.generated.h" + +/** + * + */ +UCLASS() +class ENDLESSVENDETTA_API AFinalCheckpoint : public ACheckpointClass +{ + GENERATED_BODY() + +protected: + // Increment and Save Current Main Bounty Index, as well as load Open World Level + UFUNCTION(BlueprintCallable) + void CompleteBounty(); + +}; diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp index 71fd48fc..1af830e7 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp @@ -6,13 +6,31 @@ void AMainBountyClass::IncrementBountyCheckpoint() { Super::IncrementBountyCheckpoint(); - FString TipToDisplay = ""; - if (!Completed) TipToDisplay = BountyCheckpoints[0]->GetCheckpointTip(); - Cast(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI(TipToDisplay, Completed); + CompletedACheckpoint.Broadcast(); + // FString TipToDisplay = ""; + // if (!Completed) TipToDisplay = BountyCheckpoints[0]->GetCheckpointTip(); + // Cast(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI("", false); +} + +void AMainBountyClass::SpawnOpenWorldCheckpoint() +{ + if (!IsValid(OpenWorldCheckpointClass)) return; + + FActorSpawnParameters SpawnParameters; + SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + FVector Loc = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetLocation(); + FRotator Rot = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetRotation().Rotator(); + + OpenWorldcheckpoint = GetWorld()->SpawnActor(OpenWorldCheckpointClass, Loc, Rot, SpawnParameters); + OpenWorldcheckpoint->SpawnWaypoint(BountyTitle); } -void AMainBountyClass::SpawnAmmoDrops() + + + + + void AMainBountyClass::SpawnAmmoDrops() { UE_LOG(LogTemp, Display, TEXT("Bought Ammo Drops, but its not implemented yet")); // FActorSpawnParameters SpawnParameters; diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h index bd7f8016..1617dfe6 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h @@ -20,8 +20,8 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass UPROPERTY(EditDefaultsOnly, Category = "Bounty") TSubclassOf OpenWorldCheckpointClass; - // Only Function of this Checkpoint is to Guide the Player to the Bounty Start Area - ACheckpointClass* OpenWorldCheckpointRef; + // Used to Store Ref for Bounty Tracking Functionality + ACheckpointClass* OpenWorldcheckpoint; protected: @@ -34,19 +34,11 @@ private: void IncrementBountyCheckpoint() override; protected: - // Sets completed to true when last checkpoint broadcasts completion - UFUNCTION() - void CompletedMainBounty() - { - Completed = true; - } + public: // Spawns the Single Checkpoint in the Open World for this Main Bounty - void SpawnOpenWorldCheckpoint() - { - UE_LOG(LogTemp, Warning, TEXT("Spawning Open World Checkpoint")); - } + void SpawnOpenWorldCheckpoint(); diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp index d28c84e6..6daec97b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp @@ -13,10 +13,12 @@ void ASideBountyClass::IncrementBountyCheckpoint() { Super::IncrementBountyCheckpoint(); - if (Completed) - { - CompletedSideBounty.Broadcast(FavoursEarnedForCompletion); - } + // Rework!!!! + + // if (Completed) + // { + // CompletedSideBounty.Broadcast(FavoursEarnedForCompletion); + // } } void ASideBountyClass::DestroyCheckpoints() diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp index cf60bf68..6b15a8b8 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp @@ -6,26 +6,18 @@ #include "EndlessVendetta/EVGameInstance.h" #include "Kismet/GameplayStatics.h" -void ABountyHunterCharacter::SpawnBounties() +void ABountyHunterCharacter::SpawnMainBounty() { - UE_LOG(LogTemp, Warning, TEXT("Spawning Bounty...")); - UEVGameInstance* GI = Cast(GetGameInstance()); + if (!IsValid(GI->MainSaveGameInstanceRef)) return; - if (!IsValid(GI->MainSaveGameInstanceRef)) + if (GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave > CurrentMainBountyIndex) CompleteCurrentMainBounty(); + + if (MainBountyClasses.IsEmpty() || MainBountyClasses.Num() <= CurrentMainBountyIndex|| !IsValid(MainBountyClasses[CurrentMainBountyIndex])) { - UE_LOG(LogTemp, Warning, TEXT("Main save Game Object isnt initialized in GI")); + AllBountiesCompleted(); return; } - - int TestNum = GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave; - UE_LOG(LogTemp, Warning, TEXT("Current Index is set to....%d"), TestNum); - - GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 40; - - UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0); - - if (MainBountyClasses.IsEmpty() || !IsValid(MainBountyClasses[CurrentMainBountyIndex])) return; CurrentMainBounty = GetWorld()->SpawnActor(MainBountyClasses[CurrentMainBountyIndex]); const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true); @@ -36,12 +28,19 @@ void ABountyHunterCharacter::SpawnBounties() void ABountyHunterCharacter::CompleteCurrentMainBounty() { + // Collect rewards for bounty and move onto next UE_LOG(LogTemp, Warning, TEXT("Would be collecting reward for completing bounty and moving onto next if possible")); + CurrentMainBountyIndex++; +} + +void ABountyHunterCharacter::AllBountiesCompleted() +{ + UE_LOG(LogTemp, Warning, TEXT("Game Completed!!!! No more Bounties left... or you forgot to set a bounty at one of the indexes oof")); } void ABountyHunterCharacter::BeginPlay() { - if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) SpawnBounties(); + if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) SpawnMainBounty(); Super::BeginPlay(); } diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h index 6001ab9b..cc1719e9 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h @@ -22,7 +22,6 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac TArray> MainBountyClasses; // Reference to the Currently Active Main Bounty - UPROPERTY(VisibleAnywhere, Category = "Bounty Hunter") AMainBountyClass* CurrentMainBounty; // Index of Currently Active Main Bounty, Used for MainBountyClasses @@ -40,12 +39,13 @@ public: // ------------------- METHODS --------------------------------- private: // Spawns Current Main Bounty along with its Side Bounties, and spawns its appropriate CP's based on level - UFUNCTION(BlueprintCallable, Category = "Bounty Hunter") - void SpawnBounties(); + void SpawnMainBounty(); - // Checks if Player Completed Current Main Bounty, if so Collects Reward and Tries to Move onto Next Main Bounty - UFUNCTION(BlueprintCallable, Category = "Bounty Hunter") + // Collects Reward for Current Main Bounty and Increments the Main Bounty Index void CompleteCurrentMainBounty(); + + // Replaces Normal Bounty Info UI with Unique Game Over UI + void AllBountiesCompleted(); protected: // Called When Player Spawns @@ -53,6 +53,11 @@ protected: // Called every frame virtual void Tick(float DeltaTime) override; -public: +public: + // Used by Final Checkpoint to always load the Level set as the Open Level in here + FString GetOpenWorldLevelName() + { + return OpenWorldLevelName; + } }; diff --git a/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp b/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp index 0dee7d08..663ed63e 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp @@ -8,10 +8,9 @@ void UEVGameInstance::CreateNewSaveGameInstance() { if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0); - - UE_LOG(LogTemp, Warning, TEXT("Creating new save game instance")); + MainSaveGameInstanceRef = Cast(UGameplayStatics::CreateSaveGameObject(UMainSaveGameClass::StaticClass())); - MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 20; + MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 0; UGameplayStatics::SaveGameToSlot(MainSaveGameInstanceRef, "MainSave", 0); } diff --git a/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h b/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h index 8059f8d7..b673e1e7 100644 --- a/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h @@ -14,7 +14,7 @@ class ENDLESSVENDETTA_API UMainSaveGameClass : public USaveGame { GENERATED_BODY() -public: +public: UPROPERTY() int CurrentMainBountyIndexSave;