Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: demophobie on Sun 07/10/2007 13:36:27

Title: Character.Walk
Post by: demophobie on Sun 07/10/2007 13:36:27
Hi!

I have a problem using Character.Walk.
What i want is (Lucas-Style), that my character automatically walks to where i clicked. And when he arrived his destination, then he for example says something.

I tried the following:

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button == eMouseLeft)
    {
    character[MARTY].Walk(mouse.x, mouse.y, eBlock);
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
    mouse.Mode = 0;
    }
}

That works, but in the time he walks i'm unable to give him/her a new command.
There is a option with "eNoBlock" - i thought that would help me - but when i use eNoBlock he doesnt walk anymore.

What did i wrong?

Thanks for your help :-)
Title: Re: Character.Walk
Post by: Ashen on Sun 07/10/2007 14:06:03
If I'm understanding your problem correctly, check out Bernie's NoBlock module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26945.0). It allows you to have 'queued' interactions that don't happen until the character finished walking, but can be cancelled while they're walking - just like the classic games. There's no native way to do that in AGS, unfortunately - if the module isn't quite what you want, at least you might be able to pick up a bit of code from it.
Title: Re: Character.Walk
Post by: demophobie on Sun 07/10/2007 14:49:41
hey!

Thanks a lot! Thats what i was looking for.

Now all i have to do is to understand how this works. my english is not the best  ;D
Title: Re: Character.Walk
Post by: demophobie on Sun 07/10/2007 15:07:54
Hm i tried:

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button == eMouseLeft)
    {
    if (mouse.Mode == 0)
               {
          ProcessClick(mouse.x, mouse.y, mouse.Mode);
          mouse.Mode = 0;
          }
    else  {
          NoBlock.Do(mouse.Mode, eLocationHotspot, NoBlock.GetHotXY(mouse.x, mouse.y));
          }
    }
}

But it doesn't work - did i misunderstood something?
Title: Re: Character.Walk
Post by: demophobie on Sun 07/10/2007 19:22:19
it doesnt work - its still blocking  ??? ???