playMaker

Author Topic: block events until wait has finished  (Read 1304 times)

rtraufeller

  • Playmaker Newbie
  • *
  • Posts: 3
block events until wait has finished
« on: June 04, 2019, 05:48:01 AM »
well,

i am blinding the camera with sphere fading to black and then back to transparent again.

And i need any actions to wait until this has finished, because sometimes i click on things to early and it hasnt finished. i could disable all buttons maybe. but block events from listening would be cleaner.


any ideas?

cheers,
Ronny

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: block events until wait has finished
« Reply #1 on: June 04, 2019, 07:50:23 AM »
No sorry there is no 'block' nor 'pause', unless you make it yourself.

For example, there is no simple function to pause a game, so you also can't pause individual components: unless you make that system.

What you will need to do is not block events but actually send an event. Make a state called Idle or what ever, then give it a global transition with a name like Freeze or etc. In your other FSM (which things need to wait for), you do a Send Event to the global transition Freeze (in the FSM which is meant to be blocked from acting). It will then be trapped in idle (so a state not checking input, etc) until you send a new event (from the FSM holding things up) to yet another global transition called something like Unfreeze. The Unfreeze global transition may point to the same state your FSM starts in, or where it's loop back to point is, etc.

What gets more complicated is when you want to save the position you are unfreezing to. You see, as I said, there is no pause. You are breaking your process to go to a dead end state. So just to get more fiddly, what you will need is set some bools for key positions in your FSM. So when it gets to a key point (that you would like to unfreeze to) you set the bool on to know you are at there, and I guess turn all the other bools off to know you aren't at those other places. When you unfreeze, you go to a state where it checks the bools and figures out where it should route you to based on your last 'save point' established by the bools.
« Last Edit: June 04, 2019, 07:55:26 AM by daniellogin »

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: block events until wait has finished
« Reply #2 on: June 04, 2019, 05:27:10 PM »
Quote
For example, there is no simple function to pause a game, so you also can't pause individual components: unless you make that system.

You can pause the game with the Scale Time action (and then set to 0). Everything, including wait timers, is slowed down or halted, unless set to use real time.

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: block events until wait has finished
« Reply #3 on: June 05, 2019, 12:25:08 AM »
Quote
For example, there is no simple function to pause a game, so you also can't pause individual components: unless you make that system.

You can pause the game with the Scale Time action (and then set to 0). Everything, including wait timers, is slowed down or halted, unless set to use real time.
So if you have an action getting a button input and sending an event to another state; that will also be paused by Scale Time?

Sounds like if that's true, it's also applied to every single thing though rather than specifying what things? So for example can't be used for pausing the game while in a menu, since the menu itself will be paused... right?

Actually come to think of it, how would that work in practice? You press a button and Scale Time halts all actions.... then how do you unpause it if FSM's aren't responding anymore?
« Last Edit: June 05, 2019, 12:27:03 AM by daniellogin »