G1R AngelScript
Scripting reference for the Gothic 1 Remake
Loading...
Searching...
No Matches
ULocalPlayerSaveGame Class Reference

Abstract subclass of USaveGame that provides utility functions that let you associate a Save Game object with a specific local player. These objects can also be loaded using the functions on GameplayStatics, but you would need to call functions like InitializeSaveGame manually. For simple games, it is fine to blueprint this class directly and add parameters and override functions in blueprint, but for complicated games you will want to subclass this in native code and set up proper versioning. More...

Static Public Member Functions

Static Functions
static UClass StaticClass ()
Static Public Member Functions inherited from USaveGame
static UClass StaticClass ()
Static Public Member Functions inherited from UObject
static UClass StaticClass ()

Public Attributes

Variables
const FString SaveSlotName
 The slot name this was loaded from and that will be used to save to in the future.
const int SavedDataVersion
 The value of GetLatestDataVersion when this was last saved. Subclasses can override GetLatestDataVersion and then handle fixups in HandlePostLoad. This defaults to 0 so old save games that didn't previously subclass ULocalPlayerSaveGame will have 0 instead of the invalid version.
Public Attributes inherited from UObject
const UClass Class
const UObject Outer
const UPackage Outermost
const UPackage Package
const UWorld World
const FName Name
const bool IsRooted

SaveGame|LocalPlayer

const int LatestDataVersion
 Returns the latest save data version, this is used when the new data is saved.
const APlayerController LocalPlayerController
 Returns the local player controller this is associated with, this will be valid if it is ready to save.
const FPlatformUserId PlatformUserId
 Returns the platform user to save to, based on Local Player by default.
const int PlatformUserIndex
 Returns the user index to save to, based on Local Player by default.
const int InvalidDataVersion
 Returns the invalid save data version, which means it has never been saved/loaded.
void OnPostSave (bool bSuccess)
 Blueprint event called after saving finishes with success/failure result.
int GetInvalidDataVersion () const
 Returns the invalid save data version, which means it has never been saved/loaded.
int GetLatestDataVersion () const
 Returns the latest save data version, this is used when the new data is saved.
APlayerController GetLocalPlayerController () const
 Returns the local player controller this is associated with, this will be valid if it is ready to save.
FPlatformUserId GetPlatformUserId () const
 Returns the platform user to save to, based on Local Player by default.
int GetPlatformUserIndex () const
 Returns the user index to save to, based on Local Player by default.
int GetSavedDataVersion () const
 Returns the game-specific version number this was last saved/loaded as.
FString GetSaveSlotName () const
 Returns the save slot name to use.
bool IsSaveInProgress () const
 Returns true if a save is in progress.
void OnPostLoad ()
 Blueprint event called after loading, is not called for newly created saves.
bool AsyncSaveGameToSlotForLocalPlayer ()
 Asynchronously save to the slot and user index. This will return true if the save was requested, and errors should be handled by the HandlePostSave function after the save succeeds or fails.
void OnPreSave ()
 Blueprint event called before saving, do any game-specific fixup here.
void OnResetToDefault ()
 Blueprint event called to reset all saved data to default, called when the load fails or manually.
void ResetToDefault ()
 Resets all saved data to default values, called when the load fails or manually.
bool SaveGameToSlotForLocalPlayer ()
 Synchronously save using the slot and user index, stalling the main thread until it completes. This will return true if the save was requested, and errors should be handled by the HandlePostSave function that will be called immediately.
bool WasLastSaveSuccessful () const
 Returns true if it has been saved at least once and the last save was successful.
bool WasLoaded () const
 Returns true if this was loaded from an existing save.
bool WasSaveRequested () const
 Returns true if a save was ever requested, may still be in progress.
static bool AsyncLoadOrCreateSaveGameForLocalPlayer (TSubclassOf< ULocalPlayerSaveGame > SaveGameClass, APlayerController LocalPlayerController, FString SlotName, FOnLocalPlayerSaveGameLoaded Delegate=FOnLocalPlayerSaveGameLoaded())
 Asynchronously loads a save game object in the specified slot for the local player, if this returns true the delegate will get called later. False means the load was never scheduled, otherwise it will create and initialize a new instance before calling the delegate if loading failed.
static ULocalPlayerSaveGame LoadOrCreateSaveGameForLocalPlayer (TSubclassOf< ULocalPlayerSaveGame > SaveGameClass, APlayerController LocalPlayerController, FString SlotName)
 Synchronously loads a save game object in the specified slot for the local player, stalling the main thread until it completes. This will return null for invalid parameters, but will create a new instance if the parameters are valid but loading fails.

Additional Inherited Members

Public Member Functions inherited from UObject
bool MarkPackageDirty () const
void RemoveFromRoot ()
bool GetIsRooted () const
bool IsTransient () const
bool Modify (bool bAlwaysMarkDirty=true)
void SetTransactional (bool bTransactional)
bool IsSupportedForNetworking () const
UClass GetClass () const
UObject GetOuter () const
UObject GetTypedOuter (TSubclassOf< UObject > Target) const
 Traverses the outer chain searching for the next object of a certain type.
UPackage GetOutermost () const
UPackage GetPackage () const
void AddToRoot ()
UWorld GetWorld () const
FName GetName () const
FString GetFullName (const UObject StopOuter=nullptr) const
FString GetPathName (const UObject StopOuter=nullptr) const
bool IsA (const UClass Class) const
 Returns true if this object is of the specified type, or a child of that type.
void SaveConfig ()
void LoadConfig ()
void ReloadConfig ()
void CopyScriptPropertiesFrom (const UObject OtherObject)
void opCast (?&Address) const
FString ToString () const

Detailed Description

Abstract subclass of USaveGame that provides utility functions that let you associate a Save Game object with a specific local player. These objects can also be loaded using the functions on GameplayStatics, but you would need to call functions like InitializeSaveGame manually. For simple games, it is fine to blueprint this class directly and add parameters and override functions in blueprint, but for complicated games you will want to subclass this in native code and set up proper versioning.

Member Function Documentation

◆ AsyncLoadOrCreateSaveGameForLocalPlayer()

bool AsyncLoadOrCreateSaveGameForLocalPlayer ( TSubclassOf< ULocalPlayerSaveGame > SaveGameClass,
APlayerController LocalPlayerController,
FString SlotName,
FOnLocalPlayerSaveGameLoaded Delegate = FOnLocalPlayerSaveGameLoaded ( ) )
static

Asynchronously loads a save game object in the specified slot for the local player, if this returns true the delegate will get called later. False means the load was never scheduled, otherwise it will create and initialize a new instance before calling the delegate if loading failed.

◆ AsyncSaveGameToSlotForLocalPlayer()

bool AsyncSaveGameToSlotForLocalPlayer ( )

Asynchronously save to the slot and user index. This will return true if the save was requested, and errors should be handled by the HandlePostSave function after the save succeeds or fails.

◆ GetInvalidDataVersion()

int GetInvalidDataVersion ( ) const

Returns the invalid save data version, which means it has never been saved/loaded.

◆ GetLatestDataVersion()

int GetLatestDataVersion ( ) const

Returns the latest save data version, this is used when the new data is saved.

◆ GetLocalPlayerController()

APlayerController GetLocalPlayerController ( ) const

Returns the local player controller this is associated with, this will be valid if it is ready to save.

◆ GetPlatformUserId()

FPlatformUserId GetPlatformUserId ( ) const

Returns the platform user to save to, based on Local Player by default.

◆ GetPlatformUserIndex()

int GetPlatformUserIndex ( ) const

Returns the user index to save to, based on Local Player by default.

◆ GetSavedDataVersion()

int GetSavedDataVersion ( ) const

Returns the game-specific version number this was last saved/loaded as.

◆ GetSaveSlotName()

FString GetSaveSlotName ( ) const

Returns the save slot name to use.

◆ IsSaveInProgress()

bool IsSaveInProgress ( ) const

Returns true if a save is in progress.

◆ LoadOrCreateSaveGameForLocalPlayer()

ULocalPlayerSaveGame LoadOrCreateSaveGameForLocalPlayer ( TSubclassOf< ULocalPlayerSaveGame > SaveGameClass,
APlayerController LocalPlayerController,
FString SlotName )
static

Synchronously loads a save game object in the specified slot for the local player, stalling the main thread until it completes. This will return null for invalid parameters, but will create a new instance if the parameters are valid but loading fails.

◆ OnPostLoad()

void OnPostLoad ( )

Blueprint event called after loading, is not called for newly created saves.

◆ OnPostSave()

void OnPostSave ( bool bSuccess)

Blueprint event called after saving finishes with success/failure result.

◆ OnPreSave()

void OnPreSave ( )

Blueprint event called before saving, do any game-specific fixup here.

◆ OnResetToDefault()

void OnResetToDefault ( )

Blueprint event called to reset all saved data to default, called when the load fails or manually.

◆ ResetToDefault()

void ResetToDefault ( )

Resets all saved data to default values, called when the load fails or manually.

◆ SaveGameToSlotForLocalPlayer()

bool SaveGameToSlotForLocalPlayer ( )

Synchronously save using the slot and user index, stalling the main thread until it completes. This will return true if the save was requested, and errors should be handled by the HandlePostSave function that will be called immediately.

◆ StaticClass()

UClass StaticClass ( )
static

◆ WasLastSaveSuccessful()

bool WasLastSaveSuccessful ( ) const

Returns true if it has been saved at least once and the last save was successful.

◆ WasLoaded()

bool WasLoaded ( ) const

Returns true if this was loaded from an existing save.

◆ WasSaveRequested()

bool WasSaveRequested ( ) const

Returns true if a save was ever requested, may still be in progress.

Member Data Documentation

◆ InvalidDataVersion

const int InvalidDataVersion

Returns the invalid save data version, which means it has never been saved/loaded.

◆ LatestDataVersion

const int LatestDataVersion

Returns the latest save data version, this is used when the new data is saved.

◆ LocalPlayerController

const APlayerController LocalPlayerController

Returns the local player controller this is associated with, this will be valid if it is ready to save.

◆ PlatformUserId

const FPlatformUserId PlatformUserId

Returns the platform user to save to, based on Local Player by default.

◆ PlatformUserIndex

const int PlatformUserIndex

Returns the user index to save to, based on Local Player by default.

◆ SavedDataVersion

const int SavedDataVersion

The value of GetLatestDataVersion when this was last saved. Subclasses can override GetLatestDataVersion and then handle fixups in HandlePostLoad. This defaults to 0 so old save games that didn't previously subclass ULocalPlayerSaveGame will have 0 instead of the invalid version.

◆ SaveSlotName

const FString SaveSlotName

The slot name this was loaded from and that will be used to save to in the future.