How to Calculate the amount in C++ of the items to update counts?

Hi, I want to know How I can do the following BP using C++?

What I am trying is:

void AMyAmmoClass::UpdateAmount(bool Add, bool Reduce, int32 Amount_In)
{
	if (Add)
	{
		Amount = Amount + Amount_In;
	}
	else if (Reduce)
	{
		Amount = Amount - Amount_In;
	}
	else
	{
		Amount = Amount_In;
	}
}

Thank You

Yes, the C++ matches your BP implementation in terms of functionality. Is that what you’re asking?

2 Likes

Yes, this is what I am asking… actually I am confused in the last part Amount = Amount_In I thought it should be Amount_In = Amount .

Thank You for assisting me in my learning progress.