UINTERFACE(MinimalAPI)
class UBattleInterface : public UInterface
{
GENERATED_BODY()
};
class BOSSFIGHTTEST_API IBattleInterface
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void BattleAttack(IBattleInterface* attacker, IBattleInterface* depender, int32 damage);
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void BattleTakeDamage(int32 damage);
};
MyPlayerState.h :
UCLASS()
class BOSSFIGHTTEST_API AMyPlayerState : public APlayerState, public IBattleInterface
{
GENERATED_BODY()
public:
AMyPlayerState() { HP = 100; };
public :
UPROPERTY(BlueprintReadWrite)
int32 HP;
void BattleAttack_Implementation(IBattleInterface* attacker, IBattleInterface* depender, int32 damage) override;
void BattleTakeDamage_Implementation(int32 damage) override;
};
It says āoverrideā did not override any base class methods.
Perhaps the parameters of the āBattleAttackā method are the cause.
The error only appears in āBattleAttackā and not in āBattleTakekDamgageā
If I delete āBattleAttackā or change its parameters, everything is fine.
I think the issue may be with the BattleAttack implementation. Unreal Engine doesnāt allow interface functions to have interface pointers (IBattleInterface* attacker) as a parameter. Maybe using a UObject pointer would be a better option here?
Iām not terribly versed in c++ enough to tell you literally anything honestly unless its super basic almost hello world type stuff
But looking at this documentation the overrides in the example Trap.h seems to be setup differently
probably something along the lines of what @SylarAtomic said while i was thinking this up
you figure it out please let us know things like this help me to slowly learn it for when i take the deep dive
When I searched for āLyraStarterGameā, I could find BlueprintNativeEvent functions and a function using āTScriptInterfaceā parameter, but I couldnāt find a function that uses both.
My expectation from using the interface is to create some kind of combat system between different classes: monsters, NPCs, players, etc.