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
ok here is the demo
here are the steps in a few screenshots
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
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
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!
no problem hope it helps you on your way
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
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 ) 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)
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
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
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
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
did you use snap to target ?
back in 30mins ~ need some pizza from the gas station
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?)
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
here are the bp´s… character is not included but everything else (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 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…