Getting an error C4002 for DOREPLIFETIME macro

I was following Property Replication tutorial and when I compiled it all I get this error

 error C4002: too many actual parameters for macro 'DOREPLIFETIME'

I am making sword fighting game and my problem is if CombatMode and MeleeAttack boolean is set true it should change character pose to other clients thought network but it’s just stays in default Pose

In this code I made the CombatMode and MeleeAttack bools in character .h and in .cpp functions trigger on key pressing and switch bool value and they work well on client itself

Thanks for help

My .h

#include "GameFramework/Character.h"
#include "FpCharacter.generated.h"

UCLASS()
class FP_DUEL_API AFpCharacter : public ACharacter
{
	GENERATED_BODY()

public:

	//sets combat mode on
	UFUNCTION(BlueprintCallable, Category = Functions)
		void C_ModeToggle();

	//combatmode boolean
	UPROPERTY (BlueprintReadOnly, Replicated)
		bool CombatMode;

	//sets attack on
	UFUNCTION()
		void OnAttack();

	//sets attakc off
	UFUNCTION()
		void OnAttackStop();

	//sets attack on boolean
	UPROPERTY(BlueprintReadOnly, Replicated)
		bool MeleeAttack;
}

.cpp

#include "FP_Duel.h"
#include "FpCharacter.h"
#include "SwordKatana.h"
#include "engine.h"
#include "Net/UnrealNetwork.h"

AFpCharacter::AFpCharacter(const FObjectInitializer & ObjectInitializer)
	: Super(ObjectInitializer)
{
		bReplicates = true;
}
void AFpCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);

	// Replicate to everyone
	DOREPLIFETIME(AFpCharacter, CombatMode, MeleeAttack);
}
void AFpCharacter::C_ModeToggle()
{
	if (CombatMode)
	{
		CombatMode = false, TEXT("combat mode off");
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("combat mode off"));
	}
	else
	{
		CombatMode = true,
			GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("combat mode on"));
	}
}
void AFpCharacter::OnAttack()
{
	if (CombatMode)
	{
	MeleeAttack = true;
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("melee attack"));
	}
}
void AFpCharacter::OnAttackStop()
{
	MeleeAttack = false;
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("melee attack off"));
}
bool AFpCharacter::MyServerFunc_Validate()
{
	return true;
}

Hey Sven97,

The DOREPLIFETIME macro only takes two arguments, the class and the variable. If you want to replicate more than one variable, use two DOREPLIFETIME macros. As an example:

DOREPLIFETIME(AFpCharacter,  MeleeAttack);
DOREPLIFETIME(AFpCharacter, CombatMode );

Thank you!
feeling like an idiot now :slight_smile: