Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Virgil on Thu 02/09/2010 16:30:10

Title: NPC Walkaround Pause
Post by: Virgil on Thu 02/09/2010 16:30:10
I currently have a script to have an NPC walk around on a loop:


function room_RepExec()
{
  if(cNPC.Moving == false){
    cNPC.Walk(300, 124, eNoBlock, eWalkableAreas);
  if(cNPC.x>298){ cJack.AddWaypoint(233, 120);}
  if(cNPC.x<235){ cJack.AddWaypoint(300, 120);}
}


This works good, but obviously as soon as the character reaches a waypoint he immediately walks to the next one. How can I have him pause, or even insert other things (like dialogs) at certain points during his walkaround?
Title: Re: NPC Walkaround Pause
Post by: Khris on Thu 02/09/2010 17:32:59
There's the CharacterControl module, just search for its name.
Not sure if that allows you to make them talk in the background.

If I had to script this manually, I'd use a state variable and timers. Basically, once a single task like walking somewhere or pausing is done, the variable is increased by one. In rep_ex, the variable is checked and the appropriate task is started.
Title: Re: NPC Walkaround Pause
Post by: Virgil on Thu 02/09/2010 18:03:04
Ah, I forgot about that module while doing some other scripting. Will have to see if it can be used.