Call a function with a value in a timer

Hello I am currently working with a timer in c++.I would like a function to get a value and use a timer to call another function with that same value a few seconds later.But it is possible to send value to a function with a timer and I do not see how I could do it properly.


Here is what I wanted to do at the beginning but this is a mistake and return a error.

void ATimeFighterWeapon::OnStartFire(int FirstSelectedActionID)
{
	FireActionsCurrentlyInExecution[FirstSelectedActionID] = true; //Set action in execution to true
	GetWorldTimerManager().SetTimer(CountdownTimerHandle, this, &ATimeFighterWeapon::OnCompleteFire(FirstSelectedActionID), 2.2f, false);
}

void ATimeFighterWeapon::OnCompleteFire(int SecondSelectedActionID)
{
	FireActionsCurrentlyInExecution[SecondSelectedActionID] = false; //Set action in execution to false
}

Do you have suggestions ? Thank you for your answers.

Hi,

I think timer delegates might help you.

Thanks ! :smiley: