Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: barodapride 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?
-
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.
-
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?
-
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)
-
But the previous state could be one of many states, so I can't explicitly have one transition back to one state.
-
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)
-
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?
-
i would separate shooting in a different fsm.
And for the animator use some variables to set the right animation.
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.