playMaker

Author Topic: Send input action when in a specific state?  (Read 2248 times)

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Send input action when in a specific state?
« on: May 23, 2014, 04:12:56 PM »
This might sound a bit too easy or lame, but I can not figure out how when the FSM goes to a certain state, named let's say "activate horizontal" to make it actually function as a pressed horizontal button assuming it's already setup in the input manager.

For example, I've set a GUI button and I want when on press state to act like I've pressed some action from the input manager, like horizontal. Another button for vertical and so on.

Is there a specific action for setting up controls (output)?
« Last Edit: May 23, 2014, 04:20:12 PM by Lockon302 »

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Send input action when in a specific state?
« Reply #1 on: May 25, 2014, 12:18:24 PM »
So I did a basic version of this in 3 States. Basically you have a FSM with a GUI Layout drawing a Reapeat Button. Next you have a Run FSM action that has 2 states. Both states depend on a bool containing your repeat button state. State 1 bool = F nothing. State 2 bool = T  so translate player in whatever direction. If you use this option then you will have to snag a reference to your player so you can look up a FSM bool inside the RUN FSM action.

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: Send input action when in a specific state?
« Reply #2 on: June 04, 2014, 04:22:19 AM »
So I did a basic version of this in 3 States. Basically you have a FSM with a GUI Layout drawing a Reapeat Button. Next you have a Run FSM action that has 2 states. Both states depend on a bool containing your repeat button state. State 1 bool = F nothing. State 2 bool = T  so translate player in whatever direction. If you use this option then you will have to snag a reference to your player so you can look up a FSM bool inside the RUN FSM action.

Thank you for the answer. I don't quite get it, however. Let say I have my player run forward with "W" keyboard. I want to make it run with a gui button which simulates that "W" key. How to bind the pressed GUI button to a keyboard key is my asking? 

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Send input action when in a specific state?
« Reply #3 on: June 17, 2014, 06:54:16 PM »
Hmmm I don't get if you want the 'W' key to work and also be represented with the GUI, or you want the GUI to be the translate forward button. There would really be no reason to bind the GUI to a key if the GUI Button instigated the movement.
Whenever you use a GUI Button in Playmaker there is an option to fire an event if the button is pressed. You can also store the result in a bool. By exploiting both those results you should be able to make your character move.
« Last Edit: June 18, 2014, 02:20:13 AM by redikann »