playMaker

Author Topic: Save Playmaker FSM into XML  (Read 1721 times)

Phuzz

  • Full Member
  • ***
  • Posts: 101
    • Bzilla Games
Save Playmaker FSM into XML
« on: January 08, 2015, 06:33:17 AM »
Hello,

I recently added XML level loading into my project from this tutorial [http://www.teambrookvale.com/tutorial-xml-level-unity/] and it is running pretty well.

However, In my Breakout project, which consists of many levels, some prefabs have a slight change to the FSM, most behaviour is the same but I changed a bit of the "instance" fsm and not the prefab.

I need to save the playmaker FSM into the XML file, through  adding the FSM component to the deserializedlevelsaver class shown in the tutorial so it can be loaded to the prefab. [See attached Image]

I am weak in scripting so I cannot figure this out after trying, even though I know its easy, Any help would be much appreciated, thank you
Bzilla Games "Education with a Tickle!"
Qbucket Games "Voxel Games"

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Save Playmaker FSM into XML
« Reply #1 on: January 08, 2015, 07:41:09 AM »
Hi,

ok. you won't be able to change anything else but fsm variables, are you ok with this?

 typically, you can access fsm variables this way:

SETTER:

fsm.Variables.FindFsmString("My Fsm String").Value = LevelXml.items.myFsmString;

GETTER:
LevelXml.items.myFsmFloat = fsm.Variables.FindFsmFloat("My Fsm Float").Value;


That's the basic accessors to get fsm variables.

 NOW. I never worked with that serializer, but I think you are going to need to edit the framework quite a bit to allow custom variables because it doesn't seem to serialize anything else than the prefab and it's transform...

You should contact the author and ask for this: is it able to save arbitrary values? if yes, then you are good to go, else you are in trouble.

In all cases, modifying the system should be feasible ( I have myself wrote this very xml serializer for a client this year, combine with xmlMaker :) ), get in touch with me if the author is willing to provide some kind of support for xml, I will be willing to help on that front. I think xml is the perfect data storage for the average PlayMaker user, it's plain english, utterly powerful when combined with xpath and works everywhere... so way better than databases in many cases.

Bye,

 Jean