NPC Walkaround Pause

Started by Virgil, Thu 02/09/2010 16:30:10

Previous topic - Next topic

Virgil

I currently have a script to have an NPC walk around on a loop:

Code: ags

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?

Khris

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.

Virgil

Ah, I forgot about that module while doing some other scripting. Will have to see if it can be used.

SMF spam blocked by CleanTalk