Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: limeyman1992 on Mon 28/06/2010 13:48:01

Title: NPC move [Solved]
Post by: limeyman1992 on Mon 28/06/2010 13:48:01
After a non-player character exchanges dialog with the player, I want him to leave the room. Please could someone tell me the script needed and where it needs to be posted?
Title: Re: NPC move
Post by: barefoot on Mon 28/06/2010 14:35:09
Hi

Simply add this to your Room script after the talking:



cEgo.ChangeRoom(30,100,240);


Change cEgo to the NPC name. Move him to Room 30 at 100x and 240y coordinates or wherever room and coordinates you want..

If you are using a Dialog Option then you must indent the text after the Option that applies(that is a space before adding above script)

-barefoot-
Title: Re: NPC move
Post by: Khris on Mon 28/06/2010 16:47:12
Placing this in the room script won't work since a dialog isn't run until the very end of a function and therefore the NPC will leave the room before the dialog starts.
But, as barefoot mentions, you can use standard scripting inside dialog scripts if you put a blank space before the command.