I’ve been practicing unreal again and I used to know how to do this but right now I can’t remember and it’s bugging me. I made a treasure chest blueprint which does what it should (works fine) and created a child blueprint. I drag the blueprint into the viewport a few times and for each of them I configure their rewards.
The issue? I can only open one at a time and it’s the last one I put down.
I set the variables to private, I even tried making all variables instance editable. Nothing.
Neither have collision overlapping each other, heck I even tried putting them very far from each other and have the issue. Any ideas?
You’re probably complicating something more than you need to. This should be a very simple thing to build!
Are you trying to make references to these chests in some other blueprint? Level blueprint, or something? If so, those references might be confused.
Try just building a single chest, with a reward, and an opening effect/animation. And a bool for whether it’s already opened.
Then, add an overlap detection test, and make it detect pawns. When begin overlap, check if not yet opened, then cast to player pawn, if it works, play the animation and give the reward to the player and set the “opened” flag.
You should be able to drag many of these into the world, and they should each work when you walk into the area.
You should also be able to “create child blueprint” class, and re-configure that child with different effects/rewards, and place instances of that, too.
Now, once that works, you might want to change the overlap actor to instead register itself as an “interactable” for the player, and have the player display “press E to Do The Thing” when it has an interactable. Also, un-register the chest as interactable when overlap ends. Or whatever interaction mechanism you actually prefer, rather than just “bump into chest.”
It’s very simple and no other blueprints are connecting to it. It’s simply a blueprint with a collision detection and does RNG from an item list that you give it. The result could be like item 5, 6, 2 and 10GP.
There’s the widget blueprint which displays the info as it should but the triggers are all in the chest bp. Once you do accept your chest goods, it disables event ticks for the chest and bools it out just in case. If you leave the area and come back without accepting chest goods, it won’t re-generate the RNG. That’s as complex as it gets lol.
BUT, I’m not using an interface. I forgot those exist. It’s quite possible that I can’t open different chests because of that. I’ll give it a shot when I have time but unreal can be tricky like that. I will have to read about interfaces again, i remember them being useful but don’t remember why it would make a difference interacting between different chests. Thanks!