Hello, i managed to get a basic interactable door working. However my next step would to create a lock and key system that works with multiple doors. I would prefer if i can use a child blueprint of the interactable door. Not really sure where to even start so if anyone can guide me or show me how i can do this that would be great.
Here is the basic blueprint for my interactable door:
Another option would be to use codes. Your key has a code, and you assign the same code to any door you want the key to work with. 4-8 digits would be enough, you could even procedurally generate doors with codes then take them and apply the code to a key, using tags as mentioned above, you could use color codes, strings, text, possibilities are endless.
Alright i think gameplayTags are the way to go, but that guide didn’t really get me to understand basically anything other than creating the gameplayTags. I think i understand that the player needs a gameplayTag container and i have the key on pick up add a gameplayTag then just destroy actor. BUT i can’t figure out how to get the container from the character onto the key blueprint.
So im looking to have a house where a few select doors are locked and require specific keys. IE - Attic door will require the attic key. Looking to have around 5-6 different keys, and this will be multiplayer.
I can definitely attempt and see if it works. However i’m still extremely new to unreal so if i may ask, how exactly would i go about setting something like this up? I don’t really know how to make a “keyring” ect.
I don’t really know how to make a “keyring” ect.
Create a new variable, give it a desired name (here, “keyring” - makes sense to me but it makes less sense if you’re making a sci-fi game) and make the container type a set:
Sets offer some truly efficient look-up algorithms and other unique operations. Think of a neatly catalogued container where you need to spend no time finding stuff.
I suggested a Set here as it can contain unique items only. Were you to pick up 10 identical keys, you’d still have 1 key only, without worrying about anything dupes. A set will have no duplicates.
Ok i managed to recreate what you showed me above. Is this going into the door blueprint or the key? Also would i change the get tag reference integer to match the tag i want to use?
Ok i managed to recreate what you showed me above. Is this going into the door blueprint or the key?
the player has a Keyring Set (Array + add Unique would also work), which they add keys to:
As above, the keyring should be in the player BP, they control the pickups. The door actor should have a tag.
Also would i change the get tag reference integer to match the tag i want to use?
We assume the door has 1 tag only so we read the 1st (index 0) tag. If the door is tagged with more tags, another system is needed. But you did not mention that the door needs anything else bar accepting a key.
You create 1 blueprint - it’s a template for objects you will instantiate by dragging this blueprint into the level. Each instance can be selected in the world and given a tag:
This way you have many door instances driven by the blueprint but they have slightly different data associated with them - here, a tag that defines what they can be opened with.