Cannot assign a custom character as an instigator because it is not a pawn?

Hello!

I have been trying my hand at C++ with Ue4 and having surprisingly good results, barring a couple hiccups. I’ve been reading through the Shootergame source (although some of it appears to be pretty outdated in terms of how things are done now) and it’s been helping me understand a lot of things!

Recently, however, I’ve run into an error:
I have a custom character (called STcharacter) that is a subclass of Character. I have a custom actor, STweapon, that is a subclass of Actor. When attempting to set my ‘instigator’ for STweapon, it tells me:

ERROR: A value of type "ASTcharacter*" cannot be assigned to an entity of type "APawn*"

Why is this? Since my character derives from Pawn, shouldn’t I be able to do this? Am I missing something obvious? What really baffles me is that I can see that in shootergame’s ShooterWeapon.cpp the same thing is done, where instigator is set to point to a AShooterCharacter.

how did you solved this problem ?

in the start of the code in STWeapon.cpp you have to write under #include “STWeapon.h” #include “ASTCharacter.h” .

STWeapon.cpp

#include "STWeapon.h"
#include "STCharacter.h"

void ASTWeapon::SetOwningPawn(ASTCharacter * NewOwner)
{
	if (MyPawn != NewOwner) {
		Instigator = NewOwner;
		MyPawn = NewOwner;
		
		// net owner for RPC calls
		SetOwner(NewOwner);
	}
}