Hello, I am quite inexperienced with C++, so please answer as simple as possible. I have the function AttachWeapon in APistol (
void APistol::AttachWeapon(ACharacterM* TargetCharacter)
{
Character = TargetCharacter;;
if (Character != nullptr)
{
// Attach the weapon to the Character
FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
GetOwner()->AttachToComponent(Character->GetCharacterMesh(), AttachmentRules, FName(TEXT("GripPoint")));
// Register so that Fire is called every time the character tries to use the item being held
Character->OnUseItem.AddDynamic(this, &APistol::Fire);
}
}
) and I want to call it in ACharacterM(
void ACharacterM::BeginPlay()
{
Super::BeginPlay();
APistol::AttachWeapon(x);
}
). However, I can’t do it because I don’t know what goes where the x is.