Hey there, I appreciate all the guidance i can get i value your input.
I am trying to make it so that in my game when my character picks up a weapon that the weapon will initially go to the hands but then picking up another weapon will place the newly picked up weapon into the inventory aka back socket. I have 3 sockets other than the hands for the inventory of the weapons. I am using a float called StorageSlotIndication, then i increment it like so: p.s in my game weapons are called “Artifacts”
My thinking is that everytime the OnEnterInventory Function is played out StorageSlotInfication will increment it's value by 1.
but i am finding that it doesn't store the information like i want it to as seen below.
The effect i am having is that i pick up 1 weapon and it goes to my hands, the next weapon goes to my back inventory slot, But the 3rd weapon overlaps with the back inventory slot, and this is not what i want.
Please help, What changes can i make to have this effect work for me???????
I've spent nearly 3days trying to figure this out.
Should i try and make a function which has “StorageSlotIndication++;" I'm still very much learning C++ and would appreciate the help! ???
What should i do??
Artifact.cpp
void AArtifact::OnEnterInventory(ACharacterBase* NewOwner)
{
StorageSlotIndication++;
SetOwningPawn(NewOwner);
AttachMeshToPawn(GetStorageSlot());
}
This feeds back to a function in the header file .
Artifact.h
FORCEINLINE EInventorySlot GetStorageSlot()
{
if (StorageSlotIndication == 1)
return StorageSlot1;
else if (StorageSlotIndication == 2)
return StorageSlot2;
else
return StorageSlot3;
}
float StorageSlotIndication;