So this might be dumb but im just not getting it. If i create an enemy, and i drag several copies of that enemy out onto a level. When i kill one, it doesnt kill all the copies of the enemy.
Likewise, i have a locked door blueprint and several copies of the same BP in a level. When you approach the door, it says “this door is locked.” If you get a key, the door will open and the message wont display. The message variable is boolean so touching it with a key in your inventory turns that message var true and it doesnt display because it checks that variable to display the message on the second pin of a sequence node.
The problem is, the next locked door you go to wont display the message. If you unlock it, the next door will display it. So i am assuming this behavior means that bool var is storing somehow between the copies.
My question is simply “why?” If that were the intent of copies of a single blueprint dragged into a level, why dont all of the copies of enemies die when the health float var is “0” on one of them? Any help appreciated.
This is very useful, otherwise every door and every enemy would need their own blueprint. Now imagine you want to make a change to how the doors work, in the case of unique blueprints, you would have to edit every single one - in a big level that could be many dozens or more.
Instances also allow you to make each enemy/door slightly different but still use the same code and functionality.
In your case, disabling every door/enemy can be done by in a number of ways, for example "Get all actors of class, BP Interfaces and Event Dispatchers.
This live stream by Zac Parish is a great primer on BP actor communication.
Thanks to both of you. Each door should open with one key. If you dont have a key, the message should display that its locked. It works with every other door so i am assuming that my doors are all talking to each other somehow. Its simple, if you dont have a key, you get the message. If you do have a key, you dont get the message. It appears the instances of the doors are somehow communicating the variable to each other.
Whats funny is that it works perfectly in the editor. Package it and its broken.
I’d rewrite that chain of events, it is both difficult to parse and the execution order seems like it might be problematic. You can do the checks just one at a time so that it is more clear.
First thing, check if there is a key. If no key, show message.
If you pass that check, then remove the key and proceed.
Some other cleanup you can do - why are you searching the world for player character, and then checking for player character, and then later casting? You can just do that once and then use the same reference throughout.
Basically, this is all to say, you have way more moving pieces going on than necessary and that is the sort of thing that can easily lead to weird little bugs and waste time. So doing a bit of cleanup might be the quickest way to sniff out this problem.
If it stills works in editor but not in packaged after that cleanup, I’d double check that you aren’t using display names for any sort of ID anywhere? Off the top of my head that is the only build-specific type of issue I can think of though I dont see any evidence of that here.
That is great. Im going to take your advice and see if it makes things better. I think that the weird stuff your seeing there is due to mostly learning stuff like this from tutorials. After so many tutorials where people all do things different ways, i just kinda mush it all together. Maybe what youre suggesting here will “open a door” for me. I already kinda understand things a little different just based on your suggestion. Ill let ya know how it goes, and thank you!
Hey wanted to drop back in and thank you. I cleaned things up and followed your advice. My test build today works as intended. Thank you for your help! It is always good to see a resolution, but with unreal, its always onto the next head scratcher. Cheers!