Hey. So I have a giant piano on the wall, and I want to be able to open a pathway after the player shoots a combination of 3 unique notes. Also, if the wrong notes are shot, the piano returns to its original state.
Can anybody help me please? Thankyou.
What have you got done so far, are you triggering an event when any note is shot?
So far, just lights that become visible when they’re hit.
I know how to trigger an event when the notes are hit, I just dont know how to make it trigger when ONLY the certain notes are hit.
I would add Component tags to all the keys, either the mesh component or the collision shape, whichever you are using.
So each component has a tag for the key it is, that could just be an index like, 0,1,2,3, or it could be C, C#, D, D#, whichever you prefer. In the example below I’ve tagged the keys with their letter names.
In the below example I am using cursor clicks to trigger it, so just replace bit that with whatever you are doing (The GetHitResultUnderCursor), so long as you can get a hit result it will work, from trace or from a collision response etc.
Using this setup you can set any sequence of any length and it will work, just make sure you have tagged everything correctly.
How do you add the component tags to the keys?
Im using the first person projectile, so what would I use the connect the nodes?
If the keys are components in a Blueprint, select a key in the component list of the blueprint. In the details panel, look for the “Tags” section, and then click the plus to add one and give it a name. Do this for each key, each one having a unique tag.
You can also add tags to actors that have been placed in your level the same way.
If you post a screenshot of where you are doing the light trigger, I can say how to connect it.
Each key has its own blueprint class that the light is in.
I would recommend that you add all the keys into one blueprint class, unless there is some reason you don’t want it that way. If they were all in one class, you could do the below:
It works better than it did, thankyou. But it seems the second branch always go to false.
That is the branch after the == node is it? In that case the tags it is finding on the mesh components aren’t matching the tags in your Sequence array. Put in some Print String nodes, and have it print out what tag it found. Also make sure you have set the array on begin play to use the values you want, mine is set to C,D,E,F,G above. So check that array, and check that your tags are all set correctly too.
It gets past it sometimes. Regardless of which i shoot, it always alternates between true and false. When it does happen to be true, it never reaches the print string either.
Appreciate all the help btw.
Can you post an image of your Blueprint?
Here’s the blueprint; also the tags, each mesh is the same for the tags.
Ah, so each mesh should have a tag. So the C mesh will be tagged with C, the C#, with C# etc. Remove those tags that you have currently also. Each mesh in your component list should only have one tag.
Like that? But with each respective tag in each?
Fantastic! It works, thankyou very much. Now, if I were to attach a point light to toggle on and off when hit and reset, where abouts would that go?
Great So, you can add the pointlights to that same blueprint as components. Then put them into an array in your construction script, and also put the meshes into an array. Make sure the order matches exactly for both.
To do this, use a MakeArray node, then drag off from the Array pin and click promote to variable.
Now I’m not sure how you want this to work - for the key to light up any time it is hit, or only if it was the right key? I presuming it’s only if it’s the right key. But the below setup should be helpful either way.
On that cast node, right click and click Convert to Pure Cast.
You could also use a Switch On String node, and plug the tag from the Get into it. Then you can individual toggle the light depending on what key was hit.
hmmm, the lights aren’t toggling and my matinee at the end of the blueprint has stopped working.
Not sure what the issue could be without seeing your blueprint