Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MrAbu on Sun 06/08/2017 23:03:27

Title: Changing rooms twice in one cutscene
Post by: MrAbu on Sun 06/08/2017 23:03:27
Hopefully this will be the last time I ask for assistance in awhile, is it possible to change a room twice in one cutscene? Like the game starts the cutscene, the player moves to a room, talks to someone, then moves to another room, is it possible to do that? because when I try it I keep getting an error.
Code (ags) Select

if (act1score == 3) {
    StartCutscene(eSkipESCOnly);
    player.Say("I should get ready to go.");
    player.ChangeRoom(2, 330, 328);
    dendact1.Start();
    player.ChangeRoom(14, 456, 538);
    EndCutscene;
  }

it says that I have an error at the dialog bit, since there was a NewRoom command earlier.
Title: Re: Changing rooms twice in one cutscene
Post by: Crimson Wizard on Sun 06/08/2017 23:22:12
No, you cannot, this is a limitation of AGS script.

You need to divide your script in parts, and run further parts when next room is entered, for example from particular room's After Fade-in event.

EDIT: Furthermore, IIRC dialog start will not work in the same sequence as ChangeRoom. Dialog only starts after current function ends, same for ChangeRoom. So, weird things may happen, change room and dialog start occuring at same time, or in broken order, or game will report script error (probably latter).
Title: Re: Changing rooms twice in one cutscene
Post by: MrAbu on Sun 06/08/2017 23:28:37
Well that sucks, okay, thanks! I think I know what I have to do then
Title: Re: Changing rooms twice in one cutscene
Post by: Khris on Mon 07/08/2017 00:41:33
Just for reference, this should do it:

  if (act1score == 3) {
    StartCutscene(eSkipESCOnly);
    player.Say("I should get ready to go.");
    player.ChangeRoom(2, 330, 328);
  }

  // room 2 / after fadein
  dendact1.Start();

  // in dendact1 Script, right before "stop"
  EndCutscene();
  player.ChangeRoom(14, 456, 538);
Title: Re: Changing rooms twice in one cutscene
Post by: Cassiebsg on Mon 07/08/2017 18:16:30
Another alternative, could be a "fake new room", if you don't need the room for more than just that scene, you could just import the sprite as a second BG frame for the room and change it as needed, or display it as an object/dynamic sprite... Just and idea. ;)

EDIT: And you can call fadein/fadeout in script too, if that's part of your change rooms effects. ;)