How to change the main character in a certian room?

Started by shaungaryevans, Sat 27/06/2009 15:39:27

Previous topic - Next topic

shaungaryevans

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?

GuyAwesome

Well, Character.SetAsPlayer 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
Code: ags

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?

SMF spam blocked by CleanTalk