Cannot pickup more than one item in third person bp?

Hi, I am fairly new using blueprints. So I have made a blueprint class actor (health pickup) and a widget that detects when my character is colliding with it, when I press the E key when i’m near the item my widget pops up with two buttons (button 1 takes the item) (button 2 doesn’t take the item) This works perfectly for the very first item… however if i have multiple items in my level it will only pick them up in the order I place them… it will not detect the specific one I am colliding with and will only pick them up in a certain order. I understand I need to tag them somehow so the engine knows which actor class I am colliding with… I just don’t know what I am needing to search for a tutorial or how to solve this. I have searched google and youtube for a similar problem and I have not found anything relating to a third person blueprint game as a lot of tutorials are recommending a line trace type thing which I understand isn’t ideal for third person. Any ideas?

Hello,

Would you be able to post some screens shots of your blueprint logic? Its hard to tell what isn’t working otherwise.

Thanks,

Yea, definitely doing something weird in the blueprint if it only picks up one at a time and in a specific order. Are you using overlap events? Also, what do you mean “the widget” detects when your character is colliding? A screen widget can’t overlap anything and a 3D widget isn’t usually something you want to use for overlap/collision detection of the character.

Thanks so much for your reply, literally all I want to do is walk to an item, press E to bring up a widget containing 2 buttons, No button and Yes button… when clicking the yes button it destroys the actor and ![alt text][1]adds a +1 to an integer and removes the widget (essentially picked up the item) the problem im having is the only way I can communicate with the actor class blueprint (healthpickUp) via the widget is to use the ‘‘Get All Actors of Class’’ node… this deletes all of them on my level. Ill attach my screen shots…

ThirdPerson Blueprint - https://i.imgur.com/w4Pjuas.jpg
ActorClass Blueprint - https://i.imgur.com/tXm1wJE.jpg
Widget Blueprint - https://i.imgur.com/Ief5b8T.jpg
OverView - https://i.imgur.com/h3YqyHw.jpg

ThirdPerson Blueprint - https://i.imgur.com/w4Pjuas.jpg ActorClass Blueprint - https://i.imgur.com/tXm1wJE.jpg Widget Blueprint - https://i.imgur.com/Ief5b8T.jpg OverView - https://i.imgur.com/h3YqyHw.jpg

You got me interested so I gave it a try. Had a bit of problem with destroying the item once I clicked Yes but (somehow) I managed to overcome this issue. I’m just clearing the blueprint graphs now.

I will post images shortly.

278405-charactervariable.png

I’m learning blueprints too, so I won’t say this is the best/right way of doing it. Please do correct me if you think I’m doing something wrong! :slight_smile:

You don’t want to create new widget every time you do this so instead just hide it after use and bring it up again when you need it.

Short video below, so you can see how it works for me. Is this what you wanted?

When you connect “get all actors of class” to the destroy node, it removes ALL of the actors of that class from your level. You would need to pass a specific reference to the object you are interacting with directly to your player character and store it as a variable. Then when your pick up widget needs to destroy the pick up item it uses the cast to the player character like you have and then can simply call “destroy” on the item reference variable in the player character. This will destroy an individual pickup item not “all” pick up items. If you need help with creating references check out video #25 in the link below.

I was waiting for your comment. Going to check the video right now. Wish you a great day!

Now when I destroy actor it does indeed only destroy one at a time and not all of them but it doesn’t destroy the one i’m colliding with, it is destroying them in order of them being placed into the scene… I am missing a node I think on the Get(copy) array it is only referencing object 0… You did mention in your video there is some extra script involved for doing this with multiple items. How do I tell it to destroy the actor in which I am colliding with? Do I need to use tags and if so what nodes do I use? I will screen shot again.A big thank you for your time and I have subbed, I learned a lot from that one video ill probably watch all of them.

They array outputs and sets the first actor of class you specified.

I’m guessing (because I don’t know) it gets them in order they were place in the world (when you place them in the world the 2nd and every next gets a number next to it) so you are always getting the first one you have placed in the world.
It won’t matter which one you’re overlapping in this case, it will always get and set the first one you placed in world.

I posted some info below because I wanted to try to do it myself. Take a look and if you have any questions just let me know. There is a video at the bottom showing how it functions.

Your problem is you aren’t telling the widget which item it was created for. Thus, it has no way of knowing which item to destroy if “yes” is selected. You can’t use “get all actors” in this way because you either run into the issue you had originally which is you destroy everything OR you end up destroying one at random (the 0 index of the array, which will not always be the same each time you play the game(. What you need is a way to pass a reference to the specific item you are dealing with to the widget. My suggestion, store the item as a reference in the player character. So have your player character keep a variable called “Current Item” or something. Make it an object reference of type BP_HealthPickUp. When you overlap the player, in addition to setting “is colliding” to true, set the variable for the health pickup (pulled from the player cast node) to the current item BP by using a “self” reference within the healthpickup BP. Then inside your widget when you select “yes” it will destroy the particular item you have collided with.
** I see now you have basically done this, your issue is you set that reference using the “get all actors” node in the widget. You need to set it using a self reference from within the item BP. Change that, remove the get all actors node from the widget and connect everything back up and you are golden :slight_smile:

It works! Finally… i’ve been stuck on this problem for over a week lol Props to you sir for taking your time and helping me. It now destroys the actor from the widget in which I am colliding with and adds to the integer… Ill upload the blueprint screenshots incase anyone else looks up this problem and I 100% recommend your channel. Thanks to you all

Sorry only just seen, solved it now but i’m going to replicate your way as well… more practice. Im new to blueprints as well, just when i thought i figured out how it all works a little problem comes up lol I guess I just don’t know enough yet. Thanks mate

Glad you figured it out. Just a couple things since you posted the screen shots. First, remove the set node in the widget you aren’t even using it if you notice no blue wires go into or out of it. Second have a separate cast node for your pick up item end overlap event. Don’t get in the habit of crossing wires from separate execution paths like that. You get into trouble that way especially of you were to somehow start already overlapping a pickup and then you end overlap without first firing overlap (I know it’s weird but trust me it can happen) you’ll end up with an error because the cast node wouldn’t have fired by the time you go through the end overlap. So just save yourself potential future headache and give it a separate cast node and use the output pin for the boolean variable target in the end overlap execution. Other than that great job following the instructions with no screen shots!

You are a legend. Ill get in that habit then, only been learning blueprint scripting for a couple of months… i spend 6-7 months learning unreal landscaping and level design etc. I finally bit my tongue and started learning the hard stuff lol Enjoying it though. I’ve come from dark basic pro so the programming is very different and hard to get my head around. Going to work on a game in about a years time when I know the engine completely. Going to watch the rest of your videos as well.

Haha, funny, I find the logic/programming much easier than the art :stuck_out_tongue: But I think my videos will help you get the basics down fast. Let me know if you have any issues.