Changing rooms twice in one cutscene

Started by MrAbu, Sun 06/08/2017 23:03:27

Previous topic - Next topic

MrAbu

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

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.

Crimson Wizard

#1
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).

MrAbu

Well that sucks, okay, thanks! I think I know what I have to do then

Khris

Just for reference, this should do it:

Code: ags
  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);

Cassiebsg

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. ;)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk