playMaker

Author Topic: How to manually set the state of an FSM from code?  (Read 2587 times)

adbourdages

  • Playmaker Newbie
  • *
  • Posts: 3
How to manually set the state of an FSM from code?
« on: May 15, 2014, 02:03:48 PM »
Hello all,

So I am looking at using PlayMaker and have implemented it in my project. I am running into a problem however, I want to manually set the state from code. There is a post on the forum about this dating from 2012, so I thought I'd start a new one.

Is it possible to do Fsm.SetState(So-and-so)?

My use case is to reset the FSM to a previously saved, hrum, state, so to speak. If it is not possible, what are the alternatives?

Thanks in advance,
Alain-Daniel

DeeDee

  • Playmaker Newbie
  • *
  • Posts: 2
Re: How to manually set the state of an FSM from code?
« Reply #1 on: October 13, 2014, 01:32:56 PM »
Hello:

   I've got the same question. There is no new about that?, Are the Global transitions the unique solution?

   Thanks.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4176
  • Official Playmaker Support
    • LinkedIn
Re: How to manually set the state of an FSM from code?
« Reply #2 on: October 13, 2014, 03:47:14 PM »
Right now all state transitions are triggered by events. Global transitions are useful for this.

However, I can see use cases in code for wanting to set the state directly (e.g., save games) so I'll try to add this to the API for the next update...

DeeDee

  • Playmaker Newbie
  • *
  • Posts: 2
Re: How to manually set the state of an FSM from code?
« Reply #3 on: October 14, 2014, 06:23:44 AM »
Hello!

    Save & load games or levels are precisaley the uses that I was planning to use them. Because of persistence in the states machines when the player changes the level and returns to the previous level.

   Thank you very much for your answer.