Forum rules - please read before posting.

Script - Check no action lists are running

edited October 2021 in Technical Q&A

Hello,

Is there a way in script of checking if no action lists are running? Thanks!

Comments

  • You can query if a particular ActionList is running, but it's not so simple to to a check for any/all - since you can have background, paused lists etc.

    What's the intent here? To determine if the game is in a cutscene?

  • edited October 2021

    No. It's to determine when changing an input device, which could happen at any moment, if it's safe for the player to say a comment ("Oh, we're using a keyboard! I used to have stuffed keyboard when I was a baby. Good 'ol Mr Keys..." (I shouldn't type before my morning coffee) but I don't want that to happen if an action list is already running in the scene as it might clash / interrupt player dialogue.

  • You can determine if any dialogue is playing with IsAnySpeechPlaying:

    if (AC.KickStarter.dialog.IsAnySpeechPlaying (true)) { }
    

    To also check if you're currently in gameplay:

    if (AC.KickStarter.stateHandler.IsInGameplay ()) { }
    
  • edited October 2021

    Hmmm those checks might be enough. Maybe. Perhaps. There's still a risk an action list is running and the player is about to say something, and a load of input related dialogue pops up just before. Not sure what would happen then. I imagine they might overlap.

    Alternatively, is it possible to have player dialogue occur when the game is paused?

  • Try this:

    private bool AreActionsRunning ()
    {
        foreach (ActiveList activeList in KickStarter.actionListManager.ActiveLists)
        {
            if (activeList.IsRunning ())
            {
                return true;
            }
        }
    
        foreach (ActiveList activeList in KickStarter.actionListAssetManager.ActiveLists)
        {
            if (activeList.IsRunning ())
            {
                return true;
            }
        }
    
        return false;
    }
    
  • I'll give it a go today. Thank you kind sir.

  • Seems to work like a charm.

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.