playMaker

Author Topic: resetting fsms to default values  (Read 375 times)

Chicky

  • Playmaker Newbie
  • *
  • Posts: 4
resetting fsms to default values
« on: November 23, 2023, 11:18:09 AM »
hey, I'm currently handling my saving and loading with a third party plugin. No issues there, anything I need to be saved is stored in global variables and being saved appropriately.

Something I have noticed, when the player dies and I load a save file that takes place in the same scene that the player died, global variables are indeed loaded correctly but a lot of the aspects of the player prefab/FSMs remain in the state they were in prior to death. The scene isn't resetting.

How do I force playmaker to reset all FSMs to their default values, the same values they have when loading a new scene for the first time?

Important things are saved/loaded correctly, but I want everything else in the scene to reset to the state it was in when the player first visited that scene, similar to when you quit the .exe and start it again.

Hope that makes sense!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7621
    • jinxtergames
Re: resetting fsms to default values
« Reply #1 on: November 24, 2023, 08:11:57 AM »
Hi.
The fsms that you want to 'Reset' you can place a Global transition (call it Global/Reset for example)
Then in that state set the default values and transition to you start state.

if you don't want to set the default values manually, you can get/set the default value on start.

just like normal scripts, there no "Auto Reset"
(A way with normal scripts is using scriptable object instances to create a new instance to reset)

Chicky

  • Playmaker Newbie
  • *
  • Posts: 4
Re: resetting fsms to default values
« Reply #2 on: November 27, 2023, 03:23:32 PM »
Thanks djaydino.