Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: swaz on Sun 12/08/2007 23:56:41

Title: Problem with automatic goto (Scumm Template 2.71)
Post by: swaz on Sun 12/08/2007 23:56:41
Hi all,
i got a problem with the Scumm Template 2.71:
i've created an object in a room, but when the player picks up it, the char goes to 1,1 (x,y) value of the object before picking up it, and that's not normal.
I've tried to put "character[EGO].Walk(103, 103);" in the script, but the char FIRST goes to 1,1  (x,y) value of and THEN follows my script, going to 103,103.
I've tried to edit the function about automatic walk in the global script but without success.
Suggestions? Thanks.
Title: Re: Problem with automatic goto (Scumm Template 2.71)
Post by: Khris on Mon 13/08/2007 05:14:10
Always put a direct link to the template-download in your post.
There are many different Scumm templates.
Title: Re: Problem with automatic goto (Scumm Template 2.71)
Post by: swaz on Mon 13/08/2007 12:00:16
Because the topic is pinned here, I didn't. However, the link is: http://ssh.me.uk/MI2forags271.zip
Title: Re: Problem with automatic goto (Scumm Template 2.71)
Post by: Khris on Mon 13/08/2007 14:50:58
The lines are in the function GoTo():
...
     else if (locationtype==3) {
       int object_id=GSlocid;//GetObjectAt(mouse.x,mouse.y);
       xtogo=object[object_id].X;
       ytogo=object[object_id].Y;
     }
...

But, as is stated in the readme file:

ALWAYS_GO_TO_HOTSPOTS:

At the beggining of the global script, there is a definition called ALWAYS_GO_TO_HOTSPOTS, that does the following:
If its 1, the player character will always go to whatever he clicked before performing the interaction, and if it is 0 it wont and you'll have to script every “if (Go()==1){...”.
If you think that most of the times you'll want to go to the hotspot/object/character you click on, set it to 1, and then, if there is certain thing that you don't want to go to automatically, add a second extension ‘d' to the extension to tell the player “don't go”, like ‘lamp>ld' instead of ‘lamp>l', and the player character won't go automatically to the ‘lamp'.
If you prefer to write the Go to interactions by yourself on everything, just set ALWAYS_GO_TO_HOTSPOTS to 0.


So call you objects "Name>ld", then use  if (MovePlayer(x, y)) {
    ...
  }
in the interactions.

And always read the readme ;)
Title: Re: Problem with automatic goto (Scumm Template 2.71)
Post by: swaz on Mon 13/08/2007 19:22:57
THANK YOUUUU! :D