I was following survival sample game tutorial about Sprinting and sharing it to all clients. And I am trying to use same method for my character but trying to put combat mode on
I use parent character to define all inputs and put the combat mode on and then im using Base character to set it on to other clients.
The problem is that this
virtual void SetCombatMode(bool NewCombatMode) override
{
}
should override this
virtual void SetCombatMode(bool NewCombatMode);
but when trying to compile it says this error
error C3668: 'AFpCharacter::SetCombatMode': method with override specifier 'override' did not override any base class methods
here is my both characters classes
parent character .h
#include "BaseFpCharacter.h"
#include "FpCharacter.generated.h"
void C_ModeToggle();
virtual void SetCombatMode(bool NewCombatMode) override
{
}
parent character .cpp
#include "FP_Duel.h"
#include "FpCharacter.h"
#include "engine.h"
#include "BaseFpCharacter.h"
void AFpCharacter::C_ModeToggle()
{
SetCombatMode(true);
}
and Base character .h
#include "project.h"
#include "Net/UnrealNetwork.h"
#include "BaseFpCharacter.generated.h"
public:
UFUNCTION(BlueprintCallable, Category = "Movement")
virtual bool IsCombatMode() const;
virtual void SetCombatMode(bool NewCombatMode);
UPROPERTY(Transient, Replicated)
bool bWantsCombatMode;
protected:
UFUNCTION(Reliable, Server, WithValidation)
void ServerCombatMode(bool NewCombatMode);
void ServerCombatMode_Implementation(bool NewCombatMode);
bool ServerCombatMode_Validate(bool NewCombatMode);
virtual void Tick(float DeltaSeconds) override;
base character .cpp
#include "BaseFpCharacter.h"
#include "DuelGameMode.h"
void ABaseFpCharacter::SetCombatMode(bool NewCombatMode)
{
bWantsCombatMode = NewCombatMode;
if (Role < ROLE_Authority)
{
ServerCombatMode(NewCombatMode);
}
}
void ABaseFpCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (bWantsCombatMode && !IsCombatMode())
{
SetCombatMode(true);
}
}
Thanks for help