Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: G on Mon 15/05/2006 15:13:38

Title: two characters, but only one works. (SOLVED)
Post by: G on Mon 15/05/2006 15:13:38
Hi there.

While developing my game, i wanted to give the player the possibility to choose between diferent characters.

So I didn't want to make things very hard, so i decided to use a Dialog to give the player that possibility.

Well, the problem is that when it apears the Dialog window ans I choose the main character, it works, but when i choose the secondo one the game cracks and telling me:

Error: NewRoom: two NewRoom/RunDialog/StopDialog requests within dialog.

The error takes place at line 565 in this part of the code.

557 function dialog_request(int parameter) {
558 if (parameter == 1){
559  character[TONI].SetAsPlayer();
560  player.ChangeRoom(4, 260, 141);
561  SetCursorMode(eModePointer);
562 }
563 if (parameter == 2){
564  character[ALV].SetAsPlayer();
565  player.ChangeRoom(4, 260, 141);
566  SetCursorMode(eModePointer);
567 }
568 }


Don't know what happens exactly. What's the difference, or how can I fix this.
Title: Re: two characters, but only one works.
Post by: Ishmael on Mon 15/05/2006 15:23:58
I'm not sure if it helps, but you could try changing the latter if to an else if...
Title: Re: two characters, but only one works.
Post by: Ashen on Mon 15/05/2006 15:27:53
Character.setAsPlayer() also moves the game to the room they are in - immediately following this with player.ChangeRoom is likely what causes the error. (NOTE: I think this is still true if the 'new' player is in the same room as the old one.) Maybe changing the order the commands are run would help, e.g.:

563 if (parameter == 2){
564  cAlv.ChangeRoom(4, 260, 141);
565  cAlv.SetAsPlayer();
566  SetCursorMode(eModePointer);
567 }



Also, what version are you using? Character.ChangeRoom / SetAsPlayer are version 2.7+, while SetCursorMode is 2.62 and lower. You should be using mouse.Mode (e.g. mouse.Mode == eModePointer;) in 2.7+.
Title: Re: two characters, but only one works.
Post by: G on Mon 15/05/2006 15:34:25
It worked, thank you Ashen.
Anyway, yhank you to Ishmael.