How to set up target from key press?

Hi,

I’m working on a grappling project. Currently I can place my grapple points throughout my map and when I am close enough and facing them, I can grapple to them.

I would like to change this to a system where there may be several grapple points within range but I only grapple to the one with a corresponding keyboard key. Using only letters of the alphabet.

Has anyone had experience with something like this or know of a youtube video I could learn from?

Thanks for any advice.

Doubt there’s a tut for something that specific. Consider adding more details to the post to attract creative tinkerers. For example:

  • what actually assigns the letters to grapple points? Direction? Randomness? Hardcoded? Something else? I feel knowing where this is going could help point you in the right direction.
  • is this, perhaps, more like a quick-time event dexterity puzzle, where the grapple points are given letters at random and we need to mash the corresponding key in quick succession to swing in that direction?
  • is the grapple on our left always A, and the mid is always B?

This sounds fun, I want to know more.

@Everynone Thanks for your response.

Its closer to your second option. Random grapple points with random letters would be slowly falling from above. The goal would be to move upwards through the level having only the ability to use a grapple for movement and a 1 time use dash that resets on collision with the level. I have the other elements made. Just unsure how to target a target with a letter assigned to it.

1 Like

Love the drawing and the nifty demo!


How about something along the lines of:

  • each grapple actor has a random key variable chosen from a set of keys:

  • on Any key press the Pawn overlaps what’s above it (you may have your own, better method here)
  • we step through what we’ve overlapped and compare it to the pressed key

It’s all untested pseudoscript above but it should work OK.

1 Like

The things that some of you experts here can just whip out of nowhere amaze me. Thanks. I’ll see if this gets me rolling!

1 Like

@Everynone

Still, working through this. Here is what I have currently.
Later the widget will actually say a letter instead of a red circle, but I know that each target is assigning a letter to itself.

Currently my blueprint can detect targets within range and grapple to the closest one I am facing. I would like to change that to detect all targets within range, then when I press a key assigned to a target, the blueprint will compare the key pressed to available targets it detects. If its a valid key, that target will be set as the new “best target”.

This is what it looks like now to chose best target. I was thinking I would add something that would need to red the key of the available targets. I figured each target would need to advertise its key in some way. I added a cast but its still missing many things since “who am I casting to” is probably a question?

The main component also sets its Key to compare to when I press any.
Screenshot 2022-11-12 144636