June 2016
Intermediate to advanced
384 pages
8h 20m
English
As we already have included the needed header files within the main game header file, we will be able to access the SaveGame methods from anywhere.
So, within the AGladiator::OnChangeHealthByAmount(float usedAmount) method of the player controller, I'll be adding a logic to save the health value any time it gets changed.
void AGladiator::OnChangeHealthByAmount(floatusedAmount) { TotalHealth -= usedAmount; FOutputDeviceNullar; this->CallFunctionByNameWithArguments(TEXT("ApplyGetDamageEffect"), ar, NULL, true); //A message to be printed to screen FString message; //Creating an instance of the bellz save class UBellzSaveGame* BellzSaveGameInstance = Cast<UBellzSaveGame>(UGameplayStatics::CreateSaveGameObject(UBellzSaveGame::StaticClass())); ...Read now
Unlock full access