Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Revonx on Wed 05/11/2008 20:01:43

Title: Move player character to a still moving NPC
Post by: Revonx on Wed 05/11/2008 20:01:43
How to Move player character to a still moving NPC?

Probably a simple answer, couldn't find anything out about it though. I've been using a changing variable everytime an NPC walks onto a region and moving the player character accordingly. However, there must be a simpler way to do this out there. Also, is there a default distance or can you reset the actual pixel difference between the playable character and an NPC, when performing such tasks as looking, talking or using an inventory item on a still moving NPC.
Title: Re: Move player character to a still moving NPC
Post by: Trent R on Wed 05/11/2008 20:23:45
Are you talking about the FollowCharacter (http://www.americangirlscouts.org/agswiki/Character_functions_and_properties#Character.FollowCharacter) command?


~Trent
Title: Re: Move player character to a still moving NPC
Post by: Khris on Wed 05/11/2008 21:45:47
No he isn't.

It depends, is the NPC supposed to stop if the player character is e.g. going to talk to the NPC?
You could send the player to the NPC's coordinates (e.g. cNpc.x-20, cNpc.y).
Title: Re: Move player character to a still moving NPC
Post by: Revonx on Wed 05/11/2008 22:10:13
Quote from: KhrisMUC on Wed 05/11/2008 21:45:47
No he isn't.

It depends, is the NPC supposed to stop if the player character is e.g. going to talk to the NPC?
You could send the player to the NPC's coordinates (e.g. cNpc.x-20, cNpc.y).

The NPC stops anyway, any cursor click (other than walk to) on the NPC pauses any animation that it was doing. What I had in mind was a kind of 'walk to point' for characters such as there is for hotspots. This code that you have above, how would it be formulated into a 'character[EGO].Walk' command, or something similar. I didn't find anything in the guide, I hope I'm making some degree of sense. ;D.
Title: Re: Move player character to a still moving NPC
Post by: Khris on Thu 06/11/2008 11:24:44
Are you kidding?
character[EGO].Walk(cNpc.x-20, cNpc.y, eBlock);
or shorter
player.Walk(cNpc.x-20, cNpc.y, eBlock);