Forum rules - please read before posting.

How to know if a cutscene is running with PlayMaker?

Hi there,

I need to run a PlayMaker action that checks if the game is currently playing ANY cutscene.

So I thought that this method (?) could help me with that...

bool AC.StateHandler.IsInScriptedCutscene ()

But I was unable to find it by dragging the GameEngine gameobject from the Hierarchy, until I've found out that it seems to be accessible from the StateHandler component script.

So I went and added this component to the GameEngine gameobject, so I could drag and drop it to my PlayMaker FSM. But then, hundreds of errors started to appear when I run the project.

Then I tried to create an empty gameobject and put that script in there, all alone. But the same errors started to show again.

So my question is, how could I run and return that value to a PlayMaker action?

That is, if that method will help at all at finding out if the player is involved in a cutscene...

Thank you!

Comments

  • Moving components around between the GameEngine and PersistentEngine will absolutely break your game - each is where it is for a specific reason, and must not be changed.

    If you want to read ths IsInScriptedCustscene value, you could write a simple MonoBehaviour script that reads the value and returns it.  You could then place it in the scene, and reference that with PM instead.

    However, as the API documents, this function only returns true when in a cutscene initiated through a user script (see this tutorial).  To check if the user is in a cutscene of any kind, use:

    AC.KickStarter.stateHandler.gameState == AC.GameState.Cutscene

    as outlined in Section 12.7 of the Manual.  Again, if you can't refer to this through PM directly, you can just use an in-between function, i.e.:

    public bool IsInCutscene ()
    {
      return (AC.KickStarter.stateHandler.gameState == AC.GameState.Cutscene);
    }

  • edited July 2017
    Thank you Chris! That helped me a lot to understand how to access this "hidden" property and others in the future.

    However, this property is not as good as I thought for what I want to achieve, that is to basically stop some FSMs in case I'm running (almost) any kind of AC interaction.

    AC.GameState.Cutscene seems to only be true when the player is "blocked" from interacting and the little hourglass cursor is active.

    I suspect that what I need is to know if an action list is running or not. And for that, I've been searching in the API reference and found this...:

    bool AC.ActionList.AreActionsRunning()

    ...inside AC.ActionList class. But is this class referring to a particular action list? Or could I use that boolean to really know if ANY action list is running at a given time (even non-player ones, I'm afraid).

    The only workaround to this approach I could think of is to set my own 'don't mess up things now' variable in EVERY action list start action and deactivate it when finishing the whole list... :|

    Edit: I've been trying to access that bool property to no avail. How would you write code to get that property?
  • You don't need to iterate through each ActionList - AC's ActionListManager has an appropriate function:

    AC.KickStarter.actionListManager.IsGameplayBlocked ()
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.