Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: fire7side on Thu 04/09/2025 04:42:58

Title: wait until a character walks to a position before changing rooms.
Post by: fire7side on Thu 04/09/2025 04:42:58
I've tried this:
~~~
  player.Walk(45, 270);
  Wait(50);
 player.ChangeRoom(5);

It works depending on the distance the player has to walk.  Is there some way of waiting until he reaches the position?
Title: Re: wait until a character walks to a position before changing rooms.
Post by: Gilbert on Thu 04/09/2025 06:17:19
Just set the character walking command to blocking, like:
player.Walk(45, 270, eBlock);
See:
https://adventuregamestudio.github.io/ags-manual/Character.html#characterwalk (https://adventuregamestudio.github.io/ags-manual/Character.html#characterwalk)
Title: Re: wait until a character walks to a position before changing rooms.
Post by: Khris on Thu 04/09/2025 07:32:37
If you don't want to block the game you can try my module:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-gotthere-0-5/
Title: Re: wait until a character walks to a position before changing rooms.
Post by: Danvzare on Thu 04/09/2025 13:03:22
There's also my module in case you run into any issues with Khris's:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-cancellablewalk-1-0/ (https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-cancellablewalk-1-0/)
Title: Re: wait until a character walks to a position before changing rooms.
Post by: fire7side on Fri 05/09/2025 00:35:02
Thanks, you guys.  The block worked fine but I'll check out the modules if there is a problem.
Title: Re: wait until a character walks to a position before changing rooms.
Post by: Khris on Fri 05/09/2025 11:49:51
Using a blocking walk will work fine in technical terms; allowing the player to abort the action that takes control away from them is just good game design.