Forum rules - please read before posting.

how to detect when player stops moving

I want to create an idle random animation after some time after player has not moved. There are quite a lot of character movement handling in AC. I was wondering if there would be a hook for player movement status or similar to use.

Comments

  • The OnCharacterSetPath and OnCharacterEndPath custom events are fired when a character begins and ends pathfinding, but you can also brute-force a check by reading:

    if (AC.KickStarter.player.charState == AC.CharState.Idle) { }
    
  • Is there a AC variable or an event to watch to see when the random idle counter should not be on?

  • What do you mean by "random idle counter"? Are you referring to a custom script?

  • Yes, I'm using that method above to detect when player is on idle.

    I have it like this:

        if (!idleAnimRunning) {
            if (AC.KickStarter.player.charState == AC.CharState.Idle && AC.KickStarter.) { 
                idleTime += Time.deltaTime;
                if (idleTime > idleAnimMinimun) {
                    idleAnimMinimun = Random.Range(7.0f, 10.0f);
                    idleTime = 0; // todo anims here
                }
            } else {
                idleTime = 0;
            }
        }
    
  • But I need some kind of a Gameplay-mode detection to go with it.

  • You can check if you're currently in gameplay by reading:

    AC.KickStarter.stateHandler.IsInGameplay ()
    
  • I think that brute force approach is making a mess, and need to do another script with delegates. Is there delegates for player stop and starts moving? I may need to set one for the inventory?

  • See my first reply regarding the OnCharacterSetPath and OnCharacterEndPath events - these are called when characters begin and end pathfinding.

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.