Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Liliana on Tue 18/07/2006 20:21:49

Title: NPC to stay anywhere in the game
Post by: Liliana on Tue 18/07/2006 20:21:49
Hello
I'd like to ask if there's any really easy way how to make a horse I would like to have in my game to stay at the place where the rider left him, which schould be possible almost anywhere. Thank you.
Title: Re: NPC to stay anywhere in the game
Post by: Khris on Tue 18/07/2006 22:52:40
Every NPC will stay where you "left" him. Automatically.
Title: Re: NPC to stay anywhere in the game
Post by: R4L on Wed 19/07/2006 07:33:14
He means when you ride him somewhere, you can get off and he'll be there, regardless of where you go.

I can't help on this problem, as i have been working out how to use a car in my game.
Title: Re: NPC to stay anywhere in the game
Post by: KristjanMan on Wed 19/07/2006 12:14:01
Well I'm too lazy to post a code or something but i just got an idea what might work:
Let's say you use interaction on the horse then i dunno maybe make an animation how man/woman goes on horse and then change characters view and make the horse invisble or something and make it follow you and then at another location make an animation man/woman getting of the horse then make the horse visible and make it stop following the player.
As i sed i don't know if this works. But if it does then maybe someone could post a script for it
Title: Re: NPC to stay anywhere in the game
Post by: Nathan23 on Wed 19/07/2006 17:38:20
Well my sugestion is that you create a global variable that save the room where is actually your horse (or wherever you left it)

you can use this : Character.Room
for example:



   //.. part of the script

roomnumber = character[EGO].Room



When you leave the horse, use this property and when you return to the room check it the value of this variable and compare with actually the room where you are so if the horse is in another part and not in that room then you don't have to move it there.

Title: Re: NPC to stay anywhere in the game
Post by: Khris on Wed 19/07/2006 18:18:09
Nathan23: It's not necessary to store it in a global variable.
if (player.Room==cHorse.Room) would be enough.

@Liliana:
Please specify if you've actually got problems with splitting up the character into two seperate ones.
I was thinking of explaining how this can be done, but after reading your title, I figured my previous answer would be more helpful.

If you indeed want to know how such a thing is done, Kristjanman more or less answered it, although his idea needs some tweaking.
Title: Re: NPC to stay anywhere in the game
Post by: Nathan23 on Wed 19/07/2006 19:02:18
Khris: yeah... you right, is more easy.. :)

I always work with variables, but here is not necessary..  I don't know why I can't see it before