Forum rules - please read before posting.

NPC current walk to marker

Is it possible to get an NPC's current walk to marker in script? So if the action "Character: Move to point" has been called, is the Marker To Reach stored anywhere I can access via code? Ta!

Comments

  • edited May 2

    Not the Marker exactly, as the Marker's position can sometimes vary a little from the NPC's true destination.

    There are a couple of ways to get the position, however.

    1) At any time, the character's GetTargetPosition function can be read.
    2) At the moment the character's movement command begins, the OnCharacterSetPath event will fire. Example usage:

    void OnEnable () { EventManager.OnCharacterSetPath += OnCharacterSetPath; }
    void OnDisable () { EventManager.OnCharacterSetPath -= OnCharacterSetPath; }
    
    void OnCharacterSetPath (Char character, Paths path)
    {
        Debug.Log ("Character " + character + " moving to " + path.Destination);
    }
    
  • Ah, that should do the job. Thanks Chris!

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.