Forum rules - please read before posting.

Count down function that can be stopped

Hi, I am trying to achieve the effect of delaying the run of an Actionlist, while such delay can be controlled.

For example, when there is a game section that has a time limit, and after the time limit an Actionlist for game over will run. I can do that by using Engine:wait. However, when there are conversations or dialog, I wish to pause the time limit count down. I tried to modify the Engine:wait action but no luck. Is there a way to achieve such effect? Thanks

Comments

  • The new version of AC allows actionlists to run in the background. One use case for this is aging items, which I have a partial tutorial here which you may find useful.
    Aging Items

    However, to stop a timer I think you would have to rely on a global variable.
    Lets assume 60 seconds.
    Create a Global Variable called Timer with an Integer value of 60.

    Create an actionList asset that waits 1 second, then decrements the value by one. Have this run in a loop.

    Each time you want to pause it, stop the action, play whatever you need, then launch it again to start decrementing the variable.

    I haven't done this myself, so you may have to experiment, but thats probably how I would approach it.

    Kev
  • Thanks Kev. It's a smart solution. But it seems when I pause the looping actionlist, it will be considered finished and go to the next step. So I turned out using another boolean to pause/resume counting.
  • Pausing as in ActionList: Pause or resume?

    What is it that's being considered finished, the Action that was running at the time, or the whole ActionList?  v1.65 introduces the ability to re-start the Action that was running at the time of pause, when resuming it.
  • If you add a variable check to the decrementing action, ie if variable >0 then decrease by 1, else run the next action. The action will only run when the global variable reaches zero.
  • Hi Chris,

    Pausing as in ActionList: Pause or resume?
    Yes

    --------------------------------

    What is it that's being considered finished, the Action that was running at the time, or the whole ActionList?
    I turned the looping actionlist Kev suggested into an looping actionlist asset, with the parameter to set the time to count down.

    The main actions flow is like:
    Actionlist Run: looping actionlist asset -> next action when the count down parameter reaches zero.

    But however, when I pause the looping actionlist asset (the pause action is called from run parallel), it goes directly to the next action.
  • Thanks Kev,

    ie if variable >0 then decrease by 1, else run the next action.
    That's what I came up with too
  • @Rekize - Sorry, you'll have to detail this in a new thread with AC/Unity versions, as well as screenshots to illustrate the problem properly.  I'll need more info in order to recreate this.
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.