Calling c++ functions of another class in blueprint

Hello there!
The topic isnt really clear I know, its just I do not know how to ask it,
Now let me say this first, I consider myself to be very good in c++ and I have made very big programs in c++ and other languages, I have been making 2d games using allegro library, and it is different than unreal engine, and I guess that is because in allegro I can use my native C syntax, but I could not do it in Unreal engine
now, I have a class called countdown, this class will count from 3 to 0 and then wil be destroyed, my health class is just simple class that contains some functions/methods to reduce health && return health value, what I was thinking is I want to start reducing health after the countdown hits 0; and I want to know how do I implement that both in blue print and in C++ files,

//countdown
// Fill out your copyright notice in the Description page of Project Settings.

#include "QuickStart.h"
#include "Countdown.h"


// Sets default values
ACountdown::ACountdown()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	CountdownText = CreateDefaultSubobject<UTextRenderComponent>(TEXT("CountdownNumber"));
	CountdownText->SetHorizontalAlignment(EHTA_Center);
	CountdownText->SetWorldSize(150.0f);
	RootComponent = CountdownText;
	CountdownTime = 3;
	
	
}

// Called when the game starts or when spawned
void ACountdown::BeginPlay()
{
	Super::BeginPlay();
	
	UpdateTimerDisplay();
	GetWorldTimerManager().SetTimer(CountdownTimerHandle, this, &ACountdown::AdvancedTimer, 1.0f, true);

}

// Called every frame
void ACountdown::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

void ACountdown::UpdateTimerDisplay()
{
	
	if (CountdownTime >= 1)
	{
		CountdownText->SetText(FString::FromInt(FMath::Max(CountdownTime, 0)));
		UE_LOG(LogTemp, Warning, TEXT("Countdown for go %d"), CountdownTime);
	}
}

void ACountdown::AdvancedTimer()

{
	--CountdownTime;
	
	UpdateTimerDisplay();
	if (CountdownTime == 0)
	{
		
		CountdownHasFinished();
		
	}
	 if (CountdownTime < -1)// destroy "GO" text after one second of showing
	{
		CountdownText->DestroyComponent(true);
		//UE_LOG(LogTemp, Warning, TEXT("Destoying that thing"));
		//UE_LOG(LogTemp, Warning, TEXT("health %d"), health);
		GetWorldTimerManager().ClearTimer(CountdownTimerHandle);
	}

}

void ACountdown::CountdownHasFinished_Implementation()
{
	CountdownText->SetText(TEXT("GO!"));
	
	
	
}

// Fill out your copyright notice in the Description page of Project Settings.

#include "QuickStart.h"
#include "HealthActor.h"


// Sets default values
AHealthActor::AHealthActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	health = 100.0f;
}


void AHealthActor::reduceHealth()
{
	health -= 20;
	UE_LOG(LogTemp, Warning, TEXT("health %f"), health);
	GetHealth();
	
}

float AHealthActor::GetHealth()
{
	UE_LOG(LogTemp, Warning, TEXT("health %f"), health);
	return health;
}
// Called when the game starts or when spawned
void AHealthActor::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void AHealthActor::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

Now in my blueprint I do this for countdown

What I want to know is

now in this blue print, how can I call the reduce health to be reduced when countdown is finished,
and if I want to do it in code, what is the way to do this, because i tried to create health object in countdown this way
AHealthActor* myhealth;
myhealth->health = 100.0f;
but it crashed the system.
also if you have links that will get me going, please put them here too, because I have read all unreal programming guide, but still though I am confused, it would help to have more sources to read from :slight_smile:
thanks for your help, :slight_smile:

Alright, I have being missing around since I asked this question, and I figured the blueprint part, but I still need the c++ part, because if I create an object of health it breaks.
as for how I did it in blue print is I did this
1- I created a variable of type object reference, then I made it editable in the (exposed it) /made it public, to be edited in the details panel, then in the details panel I choose the class blue print “health” and I was able to get the values and reduce it. here is a picture of my blue print

Haha I remember allegro XD
So you want counter to be a completely different class? You can make a new object from the second class in the other class’s header like (include your timer class header as well)

UPROPERTY(EditDefaultsOnly, Category = Timer, meta = (AllowPrivateAccess = "true"))
		TSubclassOf<class AMyTimer >TimerClass;

thin in the CPP file if you wanted to attach the timer to a blueprint you made you would then do something like :

static ConstructorHelpers::FObjectFinder<UBlueprint> PlayerTimerBlueprint(TEXT("Blueprint'/Game/blueprint/Mytimer.Mytimer'"));

TimerClass = NULL;

if (PlayerTimerBlueprint.Succeeded())
{
	TimerClass = (UClass*)PlayerTimerBlueprint.Object->GeneratedClass;

}

Then you could get whatever you needed from the timer class.

*I don’t know blueprint scripting

Thanks! took me time to realize that this was the solution lol, had to go through some unreal programming tutorials then found out that this was the solution :stuck_out_tongue:
ty