Forum rules - please read before posting.

Recreating a Wait action in a custom action

Hi
I have a custom action that plays an animation on the player, along with some other stuff. All is working fine. However I want to present a float field that causes every action after my custom action to Wait, just like the Engine:Wait action built in to AC.

I've tried changing the return value but that seems to affect the time before which my custom action runs. Is there a way to put a delay AFTER my custom action has run but before the next one runs?

Olly

Comments

  • edited October 2023

    Use this pattern in the Action's Run function to have it perform its intended purpose before waiting:

    public override float Run ()
    {
        if (!isRunning)
        {
            // Add code here to make Action do what it should
    
            isRunning = true;
            return myWaitTime;
        }
    
        isRunning = false;
        return 0f;
    }
    
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.