playMaker

Author Topic: How do I go back into an FSM and continue from a given state?  (Read 2853 times)

Slater

  • Full Member
  • ***
  • Posts: 123
    • View Profile
How do I go back into an FSM and continue from a given state?
« on: August 19, 2012, 06:10:41 PM »
So I have an FSM set up that prints GUI Text like subtitles to my children's book. I've done it so that each new state prints one sentence and have a wait attached that is timed together with the narrators voice for that same one line the narrator speaks for in seconds. After the GUI text and Wait it finishes and moves to next state and prints next sentence in the same fashion.

After a few sentences it goes to a state where it changes the camera orthographic size and zooms in on the scene. In that state it also activates another game object called clothes. Here you are able to choose clothes and dress the character. When finished you press a button and the camera orthographic size goes back to original state(zooms out) and here I would like it to "activate/go back into" the subtitle fsm and continue on next sentence, say sentence 5.

Any ideas on how I go about doing this? On how to go back into an FSM and start from a given state?
« Last Edit: August 19, 2012, 06:12:24 PM by Slater »

Slater

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Re: How do I go back into an FSM and continue from a given state?
« Reply #1 on: August 19, 2012, 06:48:14 PM »
Ehhmm... I got it sorted. Guess I was just not thinking enough on it. I fixed it by having a continue button pop up, and in the subtitles fsm have it wait for a touch on that continue button to have it continue :).

Slater

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Re: How do I go back into an FSM and continue from a given state?
« Reply #2 on: August 19, 2012, 07:08:58 PM »
By the way. Do you have any suggestion on how to do this subtitle thing better? Maybe I should have done some Array thingy instead and used the resources folder? Not sure on how to do that and especially not sure how to make it read sections from it in different times. Suggestions, or should I stick to what I am doing? It feels a bit clumsy.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15210
  • Official Playmaker Support
    • View Profile
Re: How do I go back into an FSM and continue from a given state?
« Reply #3 on: August 20, 2012, 12:28:40 AM »
Hi,

 you can go for arrays and a more flexible approach, but you will spend time building the framework, compare to spend time building the final app. so this is always a difficult choice. Basically, if you think you will have to do this again for another book, or actually several other books, you might then think about building a framework that use arrays, resources and descriptiong of the book in xml or something, and then have a "reader", but as I said, it's much more work than hardcoding things. I always tend to avoid hardcoding things tho... but it sometimes make sense from a production point of view where you can deliver faster if the specs are rock solid ( else, if the client changes a small feature, you are in for a complete rewrite if everything is hardcoded)

bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Re: How do I go back into an FSM and continue from a given state?
« Reply #4 on: August 20, 2012, 06:02:08 AM »
Thank you for your reply.

I am my own client and the project specs are rock solid for this book, but our hope is that it will sell well and then we will create a lot more of them and it would be nice to have a way to create them in an easier fashion. Since I am all new to programming I am a bit worried that I wont sort the array thingy out. Maybe I should stick with the hardcoding right now and then work on a better version later on for coming books?

It would be great if there was a video tutorial for arraymaker and also with arraymaker and text.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2487
  • Yup.
    • View Profile
    • Cleverous
Re: How do I go back into an FSM and continue from a given state?
« Reply #5 on: August 20, 2012, 06:46:19 AM »
You could create a global interrupt for the story text/narration/whatever by including an empty "Idle" state in each FSM you want to halt and put a Global Event (pauseStory) on it, then broadcast that pauseStory so the story just jumps to the idle state. Then at the end of that clothes scene just Global Event to the next appropriate dialog. Then you can reuse the Idle/pause event.

Thats one way to do it, anyhow. I did something similar for a Shop system that interrupted the player controls when the store menu pops up, then returns the controls to the player when he closes the shop.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15210
  • Official Playmaker Support
    • View Profile
Re: How do I go back into an FSM and continue from a given state?
« Reply #6 on: August 20, 2012, 11:58:11 AM »
Hi,

 yes, I am very much aware of the lack of video tutorials for arrayMaker, I simply lack of energy and free time to do that ( I have so many more pending things that this is kind of lagging behind).

 I anyway want to make a new version fo arrayMaker that would feature a lot more and hit the asset store with this, which would be a commitment to provide high quality documentation.

bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Re: How do I go back into an FSM and continue from a given state?
« Reply #7 on: August 20, 2012, 03:25:36 PM »
Thanks Jean. Sorry if I pushed your stress level. I just want to say that I really appreciate you being so helpful here and taking your time to answer so many questions.
I come from no programming experience and just watched when my friend when he did a few javascripts in Unity about a month ago and mostly helped him out trying to google solutions on when he got stuck. Through that I picked up some basics in programming and at a point I stubbled across playmaker and after watching a lot of tutorials one night and reading a bit about it, I (we) decided to buy it. My friend havent had as much time to look at playmaker as I have and so I for some reason got a hang of how it works. I have to say that having someone like you on the forums answering and helping out this much, has really helped me feel a bit more at ease, taking on the project and now Im actually doing more or less all of it. The video tutorials has been very helpful to understand things as well and I have watched most of them several times.

Cheers.