Keeping Track of Tagged Objects Within A Trigger Volume

Hey all,

This is a bit of a big question. Mostly just looking for advice. I am trying to create a system in which players can pick up and put down objects inside of a trigger box that belongs to their team. Each team will gain points for their score in the UI based on the objects within their team’s trigger box. Points will be reduced if those objects leave that trigger box.

My current thinking is that this can be achieved by creating tags for all of the BP “Objects” that can be picked up. Those tags must then somehow be assigned a certain number of points. From there I know that in order for it to detect the objects I need to make use of OnActorBeginOverlap (and its counterpart OnActorEndOverlap) with the trigger box and then somehow feed the objects into an array… not really sure how to do that part. From there it needs to count the objects in the array and change the UI text to match the counted number.

This doesn’t seem that complicated but I’m not really familiar with blueprints and I can’t find any tutorials that are really in line with this. Am I even on the right track?

i made a little example of how you could achieve this with minimal work :slight_smile:

ok here is the demo

here are the steps in a few screenshots :smiley:

ok this will be on your character with the interface which comes later… where you see the DropItems Array, you could sort items for distance for example if they overlap,… depends on your needs :slight_smile:

this is the DropItem base class… i made it so you can make different branches but allways have the base as a reference… value would be the points of the item…

and this is a child of the base item… empty for now

the interface for the item calls… (both have the same structure)

this is the DropZone for your DropItem…

and last the widget i used on all, the DropItems and the DropZone

hope this helps you :slight_smile:

cheers :vulcan_salute:

1 Like

Wow, thank you this is an incredibly detailed answer. I will take a look and give it a whirl after work, then I will mark it as a solution. Thank you so much!

1 Like

no problem :slight_smile: hope it helps you on your way :vulcan_salute:

p.s. the arrow component where i attach the object too might be better to switch to a socket… there you have rotations of your character if you want that :slight_smile:

1 Like

I think this has been helpful for getting started, but I am running into some problems.
I don’t really understand how you did some of this.

How did you use the functions created in BPI DropItem as events in the third-person controller? I can’t seem to get it to do that.

How are you referencing “Points” in the goal zone’s update stats?

The only use of the word points I could find was when you append the value to “points” and to be honest, I’m not sure what that does, but it does not seem to make it so you can reference “Points” anywhere.

Lastly, what do you mean by using the WID_DropItem widget on everything? The screenshots all show a widget on the dropItem and the goal zone, are those supposed to be the WID_DropItem somehow?

Update I figured out the widget thing. It’s just replacing the class component within the blueprint.


“Points” is just a Variable (int) in the BP_GoalZone… just create it and plug it in (can have an other name too, does not matter) this is the holder for the points which get send via interface… (ahh sorry, it is a Local Variable inside UpdateStats, thats why it is not shown on the main bp, my bad :confused: ) the string append is just for the Widget Text… you can type anything here, i just used points but it can be score too (just for points in zone + any text after) :slight_smile:

DropItem and DropZone use both the same Widget (WID_DropItem) just because it is just a plain text widget and it can be adjusted for their needs…

i can make a few more screenshots if you like :slight_smile:

can upload you the BPs as .rar if you like, the character you need to setup then alone, or you may have issues with two mannequins ?

will be online tonight, if you need anything i am here :+1:

cheers :vulcan_salute:

1 Like

Okay awesome, yeah I figured out that was the use of the append “points” I even added in a little space before the word to make sure it looked right in-game.

I just made a variable for points in update stats, so that’s taken care of.

The thing I’m still struggling with is the events in my third person controller.

You seem to have made events using the functions from BPI_DropItem…

…but I don’t seem to have that option?

I can only make it a message, which doesn’t seem useful here.

yes the character has the interface too… (first picture) add the interface and compile it… then you can go to interfaces and there should be the functions, right click them and use implement event :slight_smile:

I seriously had to scan through that picture 5 times before I realized the difference, but I have the interfaces now. Thanks a million. I can pick the pot up now, but it’s being carried about 50 meters away from my character haha.

Oh you know what I think I probably know why.

that can be the arrow component inside your character or the pivot of the pot inside it´s actor… had to adjust this too :smiley:
did you use snap to target ?

back in 30mins ~ need some pizza from the gas station :smiley:

1 Like

Enjoy your pizza!

I was not snapping to target, I am now.

Good news, when the drop item child goes into the goal the score goes up! (I am supposed to be using the child, right?)

Bad news:

my camera is now going inside of the drop item?.. and my movement/physics are getting messed up. Something to do with collision/rigidbody maybe?

Also removing the item from the goal is not subtracting the score so I messed that up somewhere.

the camera inside can be that you drop the item to close to the character…
and i see in the picture you just add the item… you need the if not contains item or it will add it several times :slight_smile:

here are the bp´s… character is not included but everything else :slight_smile: (standard ue4 manny)
CollectorGame.rar (52.1 KB)

just drop it in via explorer and for safety do a right click on the folder and pick “Fix Up Redirectors”

hope this helps you :slight_smile: the array needs the NOT contains item or it will fails to remove it… but you can check the bp´s and delete them later or keep em… i had no issue copying the files in a new project…

Still trying to figure this out believe it or not. I don’t see what you say you see in the pictures. As far as I can tell all of the blueprints are exactly the same. It still just doesn’t update correctly on the widget text. My blueprints are removing the item from the “items in area” array just fine, it’s just not updating the points correctly, and for the life of me, I can’t figure out why. I made the items in the area array and points variables public to check. So it seems to me the issue must lie with the way it’s updating stats…
-but that is also exactly the same.



If you’re saying it’s an issue with the event graph on the dropzone, I don’t see how that can be the case either because I’ve tried it the same as yours (I added a print string for debugging).



I even tried putting in a contains for the removal.

No luck.

P.S. the files you supplied don’t seem to play well with my project, or even a new project imported. They break and spit errors, but I was still able to look at their structure, and the structure is exactly the same. So I don’t know what’s happening.

i think the issue with the points is that it is a local variable… so it should reset each time you count points… you could make it local or set it to zero before the ForEach Loop in UpdateStats :slight_smile:

hope this helps you :vulcan_salute:

1 Like

I went with the zeroing-it-out method. Thank you so much for all of your help, I hadn’t intended for this to be a month-long problem. I have marked your original response as the resolution.

1 Like

no problem :slight_smile: glad it worked out for you :+1:

cheers :vulcan_salute: