How to let the player move during a wait function?

Started by doctorhibert, Tue 08/11/2016 19:39:47

Previous topic - Next topic

doctorhibert

So I'm trying to have some dialog, then a few seconds for the player to move around, then more dialogue. But if I use the .Wait function the player can't move. Is there a way to move while waiting?

Snarky

That's what a blocking animation is:

Code: ags
player.Walk(155, 122, eBlock); // Or whatever coordinates you want to walk to

Crimson Wizard

doctorhibert, do you mean scripted movement, or letting player control character for certain period of time?
Snarky's solution will work for the first case.

Snarky

Oh right, I didn't consider the other interpretation, which is more likely what doctorhibert meant. For that, the most straightforward solution is probably to use a Timer.


Code: ags
function someEvent()
{
  // ...
  player.Say("Blah blah");
  cOtherCharacter.Say("Blah blah");
  SetTimer(1,800);  // Give the player 20 seconds to move around 
}

// Do the rest of the dialog, after moving around
function moreDialog()
{
  player.Say("Blah blah");
  cOtherCharacter.Say("Blah blah");
}

function repeatedly_execute()
{
  if(IsTimerExpired(1)) // The player has had 20 seconds to move around
  {
    moreDialog();
  }
  // ...
}


SMF spam blocked by CleanTalk