I am in need of a little help. weapon pickup problem

I wanted the weapon to be picked up and one in the hand to be deposited in the same location… I feel I am on the verge of success but… it works ok sometimes … other times not well at all. I am using child blueprints for the weapons… I will place some images in a moment that will help explain the issue.

This is the pickup blueprint… they are all exactly the same. copy/past.
then i took a photo of exactly all that is needed from the characters event graph.
and a backed away photo of the swap function… now for a few closeups of that function.

Not gonna lie dude, I cannot follow this, granted it is super late but I feel that whatever you are doing with all these blueprint nodes is way over complicating a very simple procedure. You also have some really weird weapon switching going on with a tick event and a “do once” node…?? That I can assure you is a terrible way to run whatever logic you are trying to run. I suggest you scrap this entire set-up and start over. What you want is something like this:

  1. On overlap of new weapon, check if this weapon is the same as current weapon
  2. If same do nothing
  3. If different then detach from parent or socket or whatever your weapon is attached to or destroy child
  4. Set world location of old weapon to new weapon location or spawn old weapon at new weapon location
  5. Attach to parent or socket for new weapon, or destroy new weapon
  6. Spawn new weapon at socket or specified location on player (if you chose to destroy the overlapped new weapon)

so instead of looking at what you have been doing in your blueprint ill give u a little concept of how you should be doing this. hopefully this will be detailed enough:

1-) You need a Interface Blueprint. Name it whatever but just for reference im gonna name the first one “GetInfo” and the second “SendMessage” and make the Gun Blueprint to use it. the interface must be set in the class setting of the gun blueprints (or u can just set it in the Parent Blueprint and the childs will inherit it so u wont have to do it manually in every single gun.)

2-) your interface does not really need a function. unless you plan on doing a inventory which i dont think you are.

3-) in your character blueprint set up a basic line trace with channel function that traces the item in front of the character.

4-) in your parent gun bp or just the normal gun bp in the class setting set the bp to implement the interface we just created.

5-) with the line trace function you just created split the Hit result and then check if the hit actor implements the interface we created. if it does we just spawn actor in the hands of our character at the socket location and the actor we spawn will be coming from the hit actor. (you need to create this socket in your character’s Mesh bp settings. ill tell you how if dont know.). next you want to spawn the item in your hand at the location you just picked up the gun from. for this you must know the item in your hand somehow. and then after you spawn the item you picked up in your hand spawn the item you Already had in your hand at the impact location.

hope this helps.

you might actually need to put a function in the interface for executing this actually. the function will be called if the item we hit implements the interface in which case we will “Call” the interface function and then use the hit actor pin as the target and then in the parent bp or gun bp use the Event Type of that interface function to call another function. which will make the character execute the above stuff.

the way the call and event type of the interface functions works is:
you can the interface function and that executes the event type of the function. so basically you can use the call type the interface which we can then use to execute something in some other bp or in the same bp.

its a little confusing…

awww… your awesome… I would never have thought of doing it like that… should I convert… I played with it last night and discovered the problem with the method I was doing… I was killing the same blueprint that I was attaching to the socket… I doubled the blueprints and now it works flawlessly … two prints… one that gets attached and houses all the info for shooting and one that can be destroyed…after contact with the player… then I set the one that was in the players hand to spawn in the same spot ten seconds later… (this allows me the ability to adjust each position perfectly in the hand without effecting how the pickup looks)…. thanks for your help…*****. I will remember… I believe a blueprint hit with line trace can be accessed as well…

well u discovered it urself so just close the thread :slight_smile: