two characters, but only one works. (SOLVED)

Started by G, Mon 15/05/2006 15:13:38

Previous topic - Next topic

G

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.

Ishmael

I'm not sure if it helps, but you could try changing the latter if to an else if...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Ashen

#2
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.:
Code: ags

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+.
I know what you're thinking ... Don't think that.

G

It worked, thank you Ashen.
Anyway, yhank you to Ishmael.

SMF spam blocked by CleanTalk