Hello Everyone,
I’m currently working on a character, and I was wondering how I could get my character to equip two weapons. I’ve already created a weapon class and attached sockets to my mesh. Where I’m having trouble is getting my character to have two weapons, one in each hand. So, I’ve created two different equip functions in my main, one for the left hand and the other for the right hand. Now, in my weapon class, I have an equip function and this is where I’m checking to see if each hand as a weapon. logically, I thought if one hand is empty, then equipped a weapon, if not, then equipped to the other hand. This is the check that I wrote but it’s not working how I planned in that it only equips to the right hand.
if (Character->RightEquippedWeapon == nullptr)
{
if (RightHandSocket)
{
RightHandSocket->AttachActor(this, Character->GetMesh());
bRotate = false;
}
}
else if (Character->LeftEquippedWeapon == nullptr)
{
if (LeftHandSocket)
{
LeftHandSocket->AttachActor(this, Character->GetMesh());
bRotate = false;
}
}