Forum rules - please read before posting.

Non movement / input - player to say dialogue after period of time

Hi,

So I am looking to have a main player dialogue prompt if there has been no input after a while. What would be the best way to implement this please?

Comments

  • Rather than detecting input directly, it's better to check if the Player isn't moving/talking while in gameplay:

    using UnityEngine;
    using AC;
    
    public class RespondToWait : MonoBehaviour
    {
    
        public float waitTime = 10f;
        public ActionList actionList;
        private float timer;
    
        void Update ()
        {
            if (KickStarter.player.charState == CharState.Idle &&
                !KickStarter.player.isTalking &&
                KickStarter.stateHandler.IsInGameplay ())
            {
                timer += Time.deltaTime;
                if (timer >= waitTime)
                {
                    timer = 0f;
                    actionList.Interact ();
                }
            }
            else
            {
                timer = 0f;
            }
        }
    
    }
    
  • Thanks. And where do I store the script please?
  • Works a treat thanks!

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.