Skip to main content

Dragon Age Toolset - Move NPC to waypoint

I've been playing around with the Dragon Age Toolset. I've spent the majority of time with it on level design. However, now that I've got a level area nicely fleshed out I've been doing a bit more with conversations and scripting in order to proceed with storyline and character interaction.

One of the issues I had was simply getting an NPC to move from one spot to another. The samples I found were incomplete or poorly written. The following is syntactically correct and works nicely.

Most of it is self-explanatory however the CommandMoveToLocation is the important bit. The second boolean argument is of note and determines whether the NPC walks or runs.

  1. void main()
  2. {
  3.     object npc = GetObjectByTag("myNPC");
  4.     object wp1 = GetObjectByTag("wp_myNPC_01");
  6.     location wpLoc = GetLocation(wp1 );
  8.     command moveCommand = CommandMoveToLocation (wpLoc , FALSE, FALSE);
  9.     AddCommand (npc, moveCommand);
  10. }