Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Aaddiction on May 23, 2014, 04:12:56 PM

Title: Send input action when in a specific state?
Post by: Aaddiction 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)?
Title: Re: Send input action when in a specific state?
Post by: redikann 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.
Title: Re: Send input action when in a specific state?
Post by: Aaddiction 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? 
Title: Re: Send input action when in a specific state?
Post by: redikann 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.