How to have a different action for each time the user presses a key?

Hi there,

I would like my player to be teleported to a location each time he presses the VIVE trigger.

So, it would be:

  1. Press trigger → location 1
  2. Press trigger → location 2 and so on

Later on, I would like to allow the user to go back and forth too if possible. (maybe using the numbStick on the VIVE controllers?)

Here is a snap of what I am using at the moment, which uses the numLock keys for each location:

Any help is welcome

Cheers!

below is a basic example of what your attempting to do. basically you have a list of locations (target locations Var) in an array. then when the button is pressed we either increment the index or decrement depending on where we want to go, the index is then used to get the location to teleport to. i also made the locations loop for this example so if your at the last location and press next again you will end up back at the first.

you could of course use actors or transforms for the array as well.

@ThompsonN13, you barely beat me to it!

Well anyway, here are a couple more screenshots which pretty much show the same exact idea, except I only incremented in the positive direction. They’re definitely redundant, but hey, I already made 'em!

The first image uses a Switch On Int approach (not preferred) while the second uses an array of locations (much better).

I doubt these screenshots really illustrate anything new, but I figure it can’t hurt to share 'em.

Thanks a lot, ThompsonN13 and the_batch!

Great stuff

haha yea that happens to me all the time.