Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shaungaryevans on Sat 27/06/2009 15:39:27

Title: How to change the main character in a certian room?
Post by: shaungaryevans on Sat 27/06/2009 15:39:27
Hi,

This probably a easy problem to solve but how to change the main character in a certian room? I have got Ego as the main character for most of the game but I want a another character called, "trainer" to be the main character in a certain room called the 'training room'

Any suggestions on how to do this please?
Title: Re: How to change the main character in a certian room?
Post by: GuyAwesome on Sat 27/06/2009 15:52:28
Well, Character.SetAsPlayer (http://www.adventuregamestudio.co.uk/manual/Character.SetAsPlayer.htm) is the function to change the player character, so assuming you want the usual player character to be in the room as well, something like

cTrainer.SetAsPlayer(); // Or whatever the actual ScriptName - not RealName - of the character is

In the 'enters room' function would do it, then change back to the orignal (e.g. cEgo.SetAslayer();) before leaving it, would do it. If you don't want the usual player in the room, just use cTrainer.SetAsPlayer(); without changing rooms (it'll go the them automatically), and change back when you're done.

Or is there some other circumstance that means it's not as simple a question as it appears?