I’m not sure what i messed up on but when i go into the game test I can pick up and then drop the item, but when I try to pick it up again nothing happens. I’ve tried switching my item to static and skeletal mesh in the class setting with no change. I haven’t been able to find a fix without just starting over again. Its probably something stupid easy but this is only my third day working with unreal engine, any help would be appreciated.
Use print string to trace where it does not execute anymore.
Generally this is done with 2 separate classes, variants of the actor.
Lets say I’m doing a weapon pickup. The one on the ground would be a very simple low data class that has a static mesh component and no logic. The picked up variant is a high data, fully functioning weapon class w/skeletal mesh. For multiplayer both classes would be set to replicate.
Wep_SM_AK47 (low data variant)
Wep_SK_AK47 (high data variant)
Multiplayer Pickup
- Client interacts to pickup (Wep_SM_AK47). Successful interacts calls the server to attempt interaction (RPC).
- Server interacts successfully. Destroys Wep_SM_AK47 and spawns Wep_SK_AK47.
- Server attaches Wep_SK_AK47, then updates inventory.
Multiplayer Drop
- Client inputs drop (UI/key input), Calls server to drop (RPC [drop inventory item ID]).
- Server detaches Wep_SK_AK47, then destroys the actor, then updates inventory
- Server spawns Wep_SM_AK47 at the characters feet.
Wep_SM_AK47 is a very simple actor, therefore its resource impact is very low on both client and server. All pick up actors should be very simplistic for this reason alone.
Thank you I’ll look into trying that
Thank you and where would i place the print string in the blueprint if everything works to pick up and drop I just can’t pick it up again off the ground once dropped
Let me chip in here.
I think you’re working with template weapon from unreal here.
What I would do is:
Spawn FP_Weapon in the world and detach your current weapon component and destroy it. Right now you’re just detaching the component, but the weapon pickup is an actor (which in turns has or creates a component when picked up). Visually it seems to be the same but the component is just that, a component (skeletal mesh + firing functionality if memory serves), whereas your pickup weapon is an entire actor.
So next time you want to pickup what you have just dropped, you can’t because component doesn’t have the same functionality as original weapon actor.
I might not be doing the best in explaining this right now but I can give actual example if you like, that might help you understand it.
try to avoid using get actor(s) of class, because it will not work if you have more then one weapon of this type in the world. You should be getting a reference to that particular one, via overlap, line trace, interface.
Reply with any questions you might have, I will try and do my best to answer them.