playMaker

Author Topic: Hold key! (Get Key Down and Up doesn't work for me)  (Read 5404 times)

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Hold key! (Get Key Down and Up doesn't work for me)
« on: September 06, 2016, 10:20:02 AM »
Hey guys, I'm trying to make a character controller with Play Maker but there is no action for "Key Holding". I know there is Get Key Down and Get Key Up but that makes my chart too complex. Is there any better way for this purpose?

I need when I Press a Key it switch to other state and after release it switch back automatically to previous state!

thanks.
« Last Edit: September 06, 2016, 10:28:19 AM by Silicon Power »

tchrisbaker

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #1 on: September 06, 2016, 11:14:25 AM »
Hey guys, I'm trying to make a character controller with Play Maker but there is no action for "Key Holding". I know there is Get Key Down and Get Key Up but that makes my chart too complex. Is there any better way for this purpose?

I need when I Press a Key it switch to other state and after release it switch back automatically to previous state!

thanks.

I don't think there is a holding down event. You can just use Get Key Down and then in the state that goes to have a Get Key Up to go back. It would just be 2 states really.

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #2 on: September 07, 2016, 06:17:26 AM »
"Key is holding" action is really needed, for example I press down W and it goes to other state but after getting back to that state again, I should release and press W again to active that loop again!
But if there was a "Key is hold" that would solve my problem. 
« Last Edit: September 07, 2016, 06:20:33 AM by Silicon Power »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #3 on: September 07, 2016, 12:53:24 PM »
Use Get Key and set a Bool, then Bool Test everyframe.

Maxi

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #4 on: September 07, 2016, 01:16:41 PM »
I still dont quite understand what the problem is;
If you make 2 states:
1.Get key W down go to state 2
2.Your Action + Get key W Up return to state 1
you have a perfect loop

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #5 on: September 07, 2016, 03:11:40 PM »
Use Get Key and set a Bool, then Bool Test everyframe.

Correct, it's working now, thank you.

Quote
I still dont quite understand what the problem is;
If you make 2 states:
1.Get key W down go to state 2
2.Your Action + Get key W Up return to state 1
you have a perfect loop

If it go back to that state again you should release key and hold it again to work.


createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #6 on: September 23, 2016, 01:43:09 PM »
I had this same question, but I wanted to search the forums before asking, and I found this post.

Here is the thing... PLEASE consider making an action for "Is key down."

Yes, I see I can make a work around with bools, constantly checking.  HOWEVER, I'm on day 3 on a complicated (at least complicated for me) character controller.  There are lots of moving parts, and this lack of function is making things much more complex, and difficult to troubleshoot... in fact I'm still not done... although I'm sure I'll get it eventually.  :)

On searching the forum posts, I see through the years, many people asking for this basic function... and the workaround always comes up... and that is fine for a simple FSM... but as things get more and more complex, the lack of this feature makes it more and more difficult to create and then debug.

Thank you for considering!!  :)

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #7 on: September 24, 2016, 02:55:12 PM »
I wouldn't call it a workaround, its just a logic sequence like any other.

Here's an action though

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #8 on: October 02, 2016, 04:02:04 PM »
Beautiful!!  Thank you!!

ransomink

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Hold key! (Get Key Down and Up doesn't work for me)
« Reply #9 on: October 02, 2016, 06:17:54 PM »
Great answers. Don't forget to mark this as [SOLVED].