Forum rules - please read before posting.

ActionList that waits for any other running ActionList to complete before running

edited April 21 in Technical Q&A

I've been using this forum as a reference for a couple of years and decided to finally register. Love AC and this forum has been incredibly helpful.

I am trying to make an ActionList that waits for ANY other active ActionList to finish before then running itself. Between what's available in AC and the custom scripting I've seen, it all seems doable but I'm not finding a clear path.

I have a scene with a countdown timer gameplay element and when the timer reaches zero it runs an ActionList. But, by design, any number of other ActionLists could already be running. Rather than kill all these ActionLists, I would like the Timer ActionList to wait for any of these other ActionLists to finish running before it then runs itself.

I looked into using "Run in Parallel" but I don't think it's exactly what I'd need. Plus it only has 10 slots and the scene has dozens of potentially active ActionLists.

I'm not much of a coder but have done some custom scripting. It looks like I could potentially use
"AC.KickStarter.stateHandler.IsInCutscene ();" or "AC.KickStarter.stateHandler.IsInGameplay ();"
to determine if any other ActionList is running but I wasn't sure how to then allow any running ActionLists to essentially "wait until finish" before running the other List.

Hope this makes sense. Any help would be greatly appreciated!


  • Welcome to the community, @Ronginald.

    This is possible with a custom Action by iterating through the ActionListManager's record of active ActionLists, and comparing it with the one that the Action is from.

    This should do it:

    namespace AC
        public class ActionWaitOthers : Action
            private ActionList ownActionList;
            public override ActionCategory Category { get { return ActionCategory.ActionList; }}
            public override string Title { get { return "Wait for others"; }}
            public override string Description { get { return "This Action will only trigger its 'After running' command once all ActionLists have been run."; }}
            public override void AssignParentList (ActionList actionList)
                ownActionList = actionList;
            public override float Run ()
                if (AreOtherListsRunning ())
                    isRunning = true;
                    return defaultPauseTime;
                isRunning = false;
                return 0f;
            private bool AreOtherListsRunning ()
                foreach (ActiveList activeList in KickStarter.actionListManager.ActiveLists)
                    if (activeList.IsRunning () && activeList.actionList != ownActionList)
                        return true;
                return false;

    Save this in a file named ActionWaitOthers and install it following the guide here.

  • Oh wow! Thank you so much. This does exactly what I needed!

    And if there were any exceptions where I realized I wanted one or two specific scripts NOT to complete, I just manually Kill those before I call "Wait for Others."

    Incredible! Thanks again! My hope is to learn enough to give back to the forum some far distant day instead of just taking.

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.