Download

"Contains Item" node really means "begins with".

Hi! My first post here.

I’m recreating the “ocarina playing” mechanic of The Legend of Zelda: Ocarina of Time.

When I press either the left, right, up, or down arrow keys or “x” key, I add a string to an array, the string being “l”, “r”, “u”, “d” and “x” respectively. The song Zelda’s Lullaby (for test purposes) is “left up right” (x2) so I check if the array contains “lurlur” and all goes well, except for if I had input before the initial “l”

So if I do “left, left, up, right, left, up, right” the song won’t play. The “contains item” node expects that it be at the beginning.

Any help?

Thanks!

Contains checks whether or not that array has an element that matches what you specify. It will look through the array, let’s pretend the array looks like this:


{"XLURLUR", "LRD", "XLURU", "LURLURL"}

That array does not contain an element matching “LURLUR”. Perhaps it will better suit your needs for you to use ‘Find Substring’ on the string, and if the index != -1, it has the item. I do have a question, why are you using an array? From what it sounds like, you just need a good ol’ string by itself.

Oh I see what you’re getting at now. Thanks.

I was using array cuz I’m still a noob with UE4. :o