Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: haikugames on July 12, 2017, 12:32:46 AM

Title: get state name for next state
Post by: haikugames on July 12, 2017, 12:32:46 AM
I am working on a system to save and load Playmaker states. I have written a custom playmaker action called "Save Current FSM State" that just tells the Save Manager to save. This saves the FSM variables and state name (using Easy Save 2). On FINISHED, I move on to whatever else the fsm was supposed to do.

When loading, I restore the fsm state by calling fsm.SetState(stateName)

The issue is when I load the state, I immediately save again. This is because I have saved the state name as the "Save" state, and loading sets the state to it, calling a save again. This messes up my system for various reasons.

Is there any way to either 1) get the name of the state after the state where I call "Save Current FSM State"?  or 2) know that I am loading a state that will call the custom "Save Current FSM State" action and skip it?
Title: Re: get state name for next state
Post by: djaydino on July 12, 2017, 11:44:37 AM
Hi,
Maybe use a 'bool test' and turn on action sequence (right click in the state window and select 'Action Sequence')

Then place the 'bool test' above the "Save Current FSM State" action.
when loading set to true and if it reaches the state you can send a event and it will skip everything below the action.