Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Vargard on Tue 18/08/2020 17:09:16

Title: Problem with .Say and .Move in my little script
Post by: Vargard on Tue 18/08/2020 17:09:16
Hello ! So I've been having this problem with this little script (and Ive been looking around but nothing):

I interact with a box and I write this:

player.Say("let's see");
player.Move(180, 940);
player.AddInventory(iGun);

So: He says "Let's see", then he moves to the box, then he gets the gun.

That's normal.

Now, I just add another player.Say in the script, like this:

player.Say("let's see");
player.Move(180, 940);
player.AddInventory(iGun);
player.Say("Cool!");

And now, he says "Let's see", then he says "Cool", he does have the gun but he doesn't move to the box anymore

Any ideas what's happening here?

Thanks!

Vargard
Title: Re: Problem with .Say and .Move in my little script
Post by: Cassiebsg on Tue 18/08/2020 17:54:19
yes, player.Move was more options than just x, y. You need to add eBlock to it.

Quote from: AGS Manual
Character.Move(int x, int y, optional BlockingStyle,
                             optional WalkWhere);
Starts the character moving from its current location to (X,Y), but does not play the character's walking animation.

The parameters to this command are identical to the Character.Walk command -- see that page for more details. The only difference is that Walk plays the walking animation whereas Move does not.

In the vast majority of cases, you will use Character.Walk instead.

Example:

cEgo.Move(155, 122, eBlock);
will make the character move to 155,122 without playing his walking animation. The script will not continue until the character has reached his destination.



So your line should look like this: player.Move(180, 940, eBlock;)
Title: Re: Problem with .Say and .Move in my little script
Post by: Vargard on Tue 18/08/2020 18:35:14
Ah!
All right!
Thank you so much for the reply !!

:smiley:
Title: Re: Problem with .Say and .Move in my little script
Post by: ToeKnee on Wed 19/08/2020 05:59:24
Quoteplayer.Move(180, 940, eBlock;)
I also wouldn't use Move if I was you... If you use the Walk command you get the following important benefits;
Eg:
Code (ags) Select
cEgo.Walk(XPosOfDestination, YPosOfDestination, eBlock, eWalkableAreas);
cEgo.FaceDirection(eDirectionRight);
Title: Re: Problem with .Say and .Move in my little script
Post by: Khris on Wed 19/08/2020 09:57:47
The only difference, according to the manual, is that .Move() doesn't play the walking animation. The other stuff like using walkable areas (or not) and scaling is identical.
Since Vargard doesn't mention the "missing" walking animation at all, using .Move() should suit them perfectly fine.
Title: Re: Problem with .Say and .Move in my little script
Post by: Rik Vargard on Thu 27/08/2020 18:25:14
Thanks so much for the replies guys, it helped me a lot!