Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: YotamElal on Mon 09/05/2005 13:48:28

Title: character doesn't walk to hotspot
Post by: YotamElal on Mon 09/05/2005 13:48:28
character doesn't walk to hotspot until I walk somewhere neer (about half a room) the hotspot.

The room is a scrolling room (1024x480) double my normal size which is 640x480.

Please help this is an very bad bug!!
Title: Re: character doesn't walk to hotspot
Post by: strazer on Mon 09/05/2005 18:53:35
In the future, please try to explain in more detail what functions you use, where you use them and under what circumstances the problem occurs.
It's hard to help you sometimes since you tend to describe your problems with a single short sentence, not providing any details of what the problem is or what you want to happen exactly.

Anyway, here's a guess:
Keep in mind mouse coordinates are screen coordinates, so if you do for example:

  player.Walk(mouse.x, mouse.y);

this won't work properly in scrolling rooms since the Walk function expects room coordinates.
So you have to take the current viewport position into account:

  player.Walk(GetViewportX() + mouse.x, GetViewportY() + mouse.y);

Edit
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Tue 10/05/2005 08:05:15
function: MoveCharacterToHotspot(EGO, 2);
where: look at character & allso interact with hotspot.
circumstances: scrolling room

Hotspot 2 has a walkable-point.
Only when I walk close to it (about half a screen) it works.

I put the "MoveCharacterToHotspot(EGO, 2);" code in the look at character.
so when I look at him nothing happens but when I walk a little closer it works!

It's as if it doesn't see tha walkable-point when it's not in the screen or somthing.

BTW when I try to interact with the hotspot, the interaction works but the
"MoveCharacterToHotspot(EGO, 2);" doesn't. 
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Tue 10/05/2005 08:25:24
More Info

the hotspot is about 100 x away from the left edge of the room.
the charcter only moves the the walk-point of the hotspot, when the left edge of the room is visible in the screen. (when I get close enough and the screen stops scrolling & I can see the left edge of the room)


only then it works@?@#!@$%^!^/???

plzhelp



& BTW I gues u dont have a clue about my fadeoutmusic problem?
Title: Re: character doesn't walk to hotspot
Post by: Gilbert on Tue 10/05/2005 08:43:15
If the file is not very large, can you zip up that room file in question, upload it, so we can examine on the problem?

One wild guess is (which is not really that probable), "look at character" is not a room specific event, so the scripts are in the global script, whereas hotspot are local to rooms (though it SHOULD work).

EDIT:
Just tested, using Walk to Hotspot works for "looking at char" in both offscreen or in-screen hotspots.
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Tue 10/05/2005 09:27:50
1) room4.rar is 234kb
2) where can I u/l it?
3) I allso tryed it with "interact with hotspot".
4) It doesn't matter if the hotspot is in or out of the screen.
    It works only when the left edge of the screen is visible & the room
    cannot scroll anymore.

Title: Re: character doesn't walk to hotspot
Post by: Gilbert on Tue 10/05/2005 09:39:50
I think you may try this (http://www.2dadventure.com/ags/upload/upload.html) for some small AGS related uploads.

It can also be some of the game's general settings and/or stuff in global script which affected your game, but I think we can look at the room first.
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Tue 10/05/2005 13:42:19
I uploaded both the room and the global script.
both files start with "YE -"   and  are .rar
Title: Re: character doesn't walk to hotspot
Post by: TerranRich on Tue 10/05/2005 13:49:10
URLs?
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Tue 10/05/2005 14:16:20
http://www.2dadventure.com/ags/Zooloo.zip
Title: Re: character doesn't walk to hotspot
Post by: Gilbert on Wed 11/05/2005 03:04:04
It works without any problem just using the room (had to comment out stuff to make it to work in default template), so I guess the problem is in the global script, my guess is, the if/else nests, etc. in on_mouse_click() did not provide a ProcessClick() action for (cursy==1) (your script is very complicated at the moment, seems that there're lots of variable combinations to be checked before doing an action, it's possible that when the character is far from that hotspot it somehow didn't trigger any of the combinitions in the script so no action was taken.)
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Wed 11/05/2005 03:25:07
No that is not possible, cuz when I use Interact (cursy=2) on the hotspot it arrie ou all the things except for MoveCharacterToHotspot(EGO, 2).
Not only that butI tried in anothe scrollng oom and there was no problem.
cursy=1 is lookat and I have n problem with lookat & i allso have noproblem with interact, only with moveto in this specific scrolling room.
Not only that but for debugging I put MoveCharacterToHotspot(EGO, 2); when you look at the charcter & the moveto only works when the leftedge of the screen is visible.

Try the trampolin hotspot(2)... allso the hook but u need an item for that.

If you cant solve the problem, I can upload the whole game (without music & speech.


PLZ PLZ HELP,
The game is 98% finished,
& this is one of the only things left. (this and the musicFadeout problem that no one knows how to solve)
Title: Re: character doesn't walk to hotspot
Post by: Gilbert on Wed 11/05/2005 03:36:07
Just add a line like Display("blah!"); in that look at character interaction, before the moveto... line and check if the action had really been carried out.
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Wed 11/05/2005 08:04:06
I already wrote like 3 times that the actions get carried out allso in the lookatcharacter and also in the interact with trampolin hotspot.
the actions get carried out except for MovecharacterTohotpsot().
Title: Re: character doesn't walk to hotspot
Post by: Gilbert on Wed 11/05/2005 09:28:24
Can't make out the problem (as it never failed on me), however, another wild guess was because of the thin walkable "route" on the right of the Trampolin area.
It may be possible that the path-finder could not find a proper route to the hotspot when the character's too far from it, try thickening that line a bit by 2 or 3 pixel width and see if that still happens.
Title: Re: character doesn't walk to hotspot
Post by: YotamElal on Wed 11/05/2005 14:55:55
THANK YOU THANK YOU

YOU DID IT!

IT's FIXED!


I thikined the walkable area and now it works fine :o)