Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Jack Sheehan on Fri 22/02/2008 23:53:03

Title: Object disappears before walking to it. (Solved in 3.09878 seconds)
Post by: Jack Sheehan on Fri 22/02/2008 23:53:03
This is really irritating me because it's so simple and it was easy to do in 2.72. When I set a simple object interaction, he walks towards it and picks it up, but it disappears before he reaches it.

The code is:
function oBlock_Interact()
{
cEric.Walk (217, 154);
oBlock.Visible=false ;
}

How can I make it disappear after he stops walking? Cheers.
Title: Re: Object disappears before walking to it.
Post by: OneDollar on Sat 23/02/2008 00:07:57
By making the walk function blocking, which means the program waits until the walk has finished before executing the rest of the commands (like the block disappearing). Just replace your walk line with cEric.Walk(217, 154, eBlock);

There are two optional parameters you can add to the walk command (as the script guide thing will tell you), the first using eBlock or eNoBlock to indicate if the command should be blocking, and the second using eAnywhere or eWalkableAreas to indicate whether the character should follow the walkable areas or not when walking.
Title: Re: Object disappears before walking to it.
Post by: Jack Sheehan on Sat 23/02/2008 00:27:30
Thats perfect, thanks a million. I may not be good at scripting, but I'm getting there. Thanks again.