x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.22
Tags:
more ▼

asked May 28 '19 at 11:15 AM in Blueprint Scripting

avatar image

daylun
1 1

avatar image Arlyn May 28 '19 at 12:47 PM

Hello,

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

Thanks,

avatar image Nebula Games Inc May 28 '19 at 02:22 PM

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.

avatar image daylun May 30 '19 at 01:09 AM

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..

avatar image daylun May 30 '19 at 01:12 AM
avatar image daylun May 30 '19 at 01:40 AM
avatar image Nebula Games Inc May 30 '19 at 01:33 PM

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.

https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy

avatar image DonBusso May 30 '19 at 01:40 PM

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

avatar image daylun May 30 '19 at 03:34 PM

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. alt text

halfsolved.png (513.7 kB)
avatar image DonBusso May 30 '19 at 03:49 PM

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.

avatar image daylun May 30 '19 at 06:21 PM

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

avatar image Nebula Games Inc May 30 '19 at 03:53 PM

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 :)

avatar image daylun May 30 '19 at 06:20 PM

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

alt text

alt text

solved.png (511.6 kB)
solved2.png (395.9 kB)
avatar image Nebula Games Inc May 30 '19 at 07:03 PM

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!

avatar image daylun May 30 '19 at 09:14 PM

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.

avatar image Nebula Games Inc May 30 '19 at 11:11 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

alt text alt text alt text alt text alt text

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! :)

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?

https://www.youtube.com/watch?v=ESB1cfs-Oks

more ▼

answered May 30 '19 at 08:55 AM

avatar image

DonBusso
502 3 5 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question