playMaker

Author Topic: Little confused about go to previous state action  (Read 2064 times)

barodapride

  • Playmaker Newbie
  • *
  • Posts: 4
Little confused about go to previous state action
« on: May 12, 2017, 01:15:15 AM »
I'm a little confused how to use this as an action. Shouldn't it be an event instead? How can I make the state wait for a certain event before going to the previous state?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Little confused about go to previous state action
« Reply #1 on: May 12, 2017, 01:36:09 AM »
Hi,
You can right-click in the state window and select 'Action sequence'

and add a wait before the previous state action

if sequence is active it will trigger the next action in the list only when the current action is finished.

So this wont work if you need to use 'every frame' on some actions, then you better use a send event action.

barodapride

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Little confused about go to previous state action
« Reply #2 on: May 13, 2017, 01:36:01 PM »
Ok I understand that, what if I want to remain in the state until some event happens, then return to the previous state. Do I have to make a custom action?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Little confused about go to previous state action
« Reply #3 on: May 13, 2017, 04:04:19 PM »
Hi,
No, there are several actions that you can use, depending on your needs.
But with most of them you should not use the "go to previous state" action

Just make a transition and point it to the previous state.

some action that can be used are :

Bool Changed
Float Changed
Int Changed
Bool test (turn on every frame)

barodapride

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Little confused about go to previous state action
« Reply #4 on: May 13, 2017, 07:41:31 PM »
But the previous state could be one of many states, so I can't explicitly have one transition back to one state.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Little confused about go to previous state action
« Reply #5 on: May 14, 2017, 04:29:33 PM »
So you have several states pointing to 1 state and you want to get back to the state it came from.

Maybe in those states you could have a "Set Int Value" on each state and set to 1,2,3... on each state
Then on the next state have a way to transition to a next state when something happens.
on that next state you can use a int switch and send a event to the appropriate state

Another way you could do is, have a global transition on each state and name them the same as the state.
Then use "Get Previous State Name" and save in a string variable.
then when some event happens use "Send Event By Name" and the string variable.

Maybe there a more simple ways, but then i will need to see what you are trying to achieve (video or some pictures)

barodapride

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Little confused about go to previous state action
« Reply #6 on: May 14, 2017, 07:00:01 PM »
I see, not the most ideal solutions.

I've been working more with PlayMaker and getting more accustomed to it. I am more familiar with coding so I've been using custom actions mostly. I guess as a simple example, let's say you have a FSM with 3 states: standing, jumping, shooting. You can get to the shooting state from either the standing or jumping states and when it's finished, you'd want to return back to either the jumping or standing state.

PS, why do I have to answer 5 questions every time I want to post something here?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Little confused about go to previous state action
« Reply #7 on: May 15, 2017, 04:33:35 PM »
i would separate shooting in a different fsm.
And for the animator use some variables to set the right animation.

Quote
PS, why do I have to answer 5 questions every time I want to post something here?

I think Alex (the maker of Playmaker) has added this to block spam post.
Recently we got a lot of spam.
I think after a certain amount of post this will go away, but i am not sure.
I will ask him.