I've a problem with Attach/Detach Actor

Hi friends! I have a problem with (English language LOL) Attach/Detach Actor.

Firstly my Blueprint for you:

Part 1

Part 2

Ok, I use this BP for every single weapon. It’s very good, because it give me what I want: take/leave a weapon when I press Q near it (every weapon give me some different bullets, but that’s another story).

Unfortunately when I’ve a weapon (Weapon A) attacched to my socket and I want to take another weapon (Weapon B) because I’m near it, Weapons A doesn’t detach from the socket and my character has 2 Weapon attached.

I’ve tried without success with many variables, nodes (Cast to, Detach Actor from Actor, Delay and some Flow Control nodes) and Blueprint Interfaces. I need something for detach/destroy Weapon A before attach Weapon B when I’m near Weapon B (near = Weapon B BoxComponent), but I think I need something like “priority” when I press Q.

Please, let me know :slight_smile:

I’ve:

  • deleted “Detach from Parent” node;

  • connected “Get Player Character” to “Get Actor Transform” (replacement for “Maintain World Position” bool pin of “Detach from Parent” node);

but the result is the same :frowning:

Hi ,

Have you tried switching the destroy actor and the spawnactorPickup_C. When you destroy self it stops the rest of the function from completing.

Hi , many thanks for your answer! The problem WAS the flag on the “Consume Input” option of Press Q EventS. I’ve unflagged them and now it’s perfect!

Hi,

I am happy to hear you found a solution, I am marking this as answered for tracking purposes. Have a great day!

I wish this solution was explained more. I’m having the same problem but I don’t seen any solution. How do I reference something I have attached after the game has began? U4E seems to have no function for that.

You should be able to create an object reference whenever you attach a component. Create an actor variable called “object attached” (Or another suitable name) and when attaching the actor, cast to the player and set that variable to the attaching actor. Then, you should be able to access that variable whenever it is needed.