hi everyone, ags newbie here.
i tried reading the manual and browsing the forum but i couldn't found a solution to my problem, so i figured i'd ask directly.
what i'd like to do is "change room" while a dialogue is running. not at the beginning or at the end of a dialogue option, but in between.
the "room" is actually just a single picture. it's like a cutscene, but no animations or anything, just the pic.
i tried writing something like this in the dialogue script:
@2
Characterone: blah blah blah
Charactertwo: blah blah
player.Changeroom(9); <-- that's the "cutscene" room
Wait(35);
player.Changeroom(4, 400, 400); <-- that's the previous room, the player is supposed to go back to where he was during the first part of the dialogue
Characterone: blah blah
unfortunately, that doesn't seem to work.
should i write a function in the global script or in the room script instead? i'm totally clueless right now. any help will be greatly appreciated!
Hello.
Unfortunately AGS does not support changing rooms in the middle of a script function, only in the end.
So, the only solution is to split the script in parts (or dialogs - in this case).
1. Play the dialog part #1.
2. Change to "cutscene" room 9.
3. After finishing cutscene in room 9, change back to room 4.
3. Upon entering room 4, start dialog part #2.
4. and so on.
Since you revisit same rooms several times under different circumstances, you need to introduce a condition, that would tell you when you need to start a dialog and when not.
For example, you could create a global variable called "int InCutscene;" (or rather use more descriptive name, since you game may have many cutscenes).
In the first dialog you set it up:
@2
Characterone: blah blah blah
Charactertwo: blah blah
InCutscene = 1; <--- set variable
player.Changeroom(9); <-- that's the "cutscene" room
stop <---- end the dialog
In the room's 9 "After fade-in" event do:
// room 9
function room_AfterFadeIn()
{
if (InCutscene == 1)
{
// play cutscene
InCutscene = 2; // update variable
player.Changeroom(4, 400, 400); <-- that's the previous room, the player is supposed to go back to where he was during the first part of the dialogue
}
}
And in the room's 4 "After fade-in" event you launch the following part of the dialog:
// room 4
function room_AfterFadeIn()
{
if (InCutscene == 2)
{
dDialogPart2.Start(); // launch second part of dialog
}
else
{
// something else
}
}
What about simply changing the room's background frame or putting an object in the size of the screen in front of everything? Wouldn't that suffice too? (Me trying to think practical...)
Quote from: Kumpel on Mon 12/02/2018 10:22:29
What about simply changing the room's background frame or putting an object in the size of the screen in front of everything? Wouldn't that suffice too? (Me trying to think practical...)
Depending on how cutscene room looks like, that could work in simplier cases, I guess. The solution I mentioned above is the for the general case when you cannot simply reconfigure current room: you may also have to add/remove objects, change walkable areas and so on, also cutscene may take place in the rooms where you normally play the game.
Quote from: Crimson Wizard on Sun 11/02/2018 23:40:31
Hello.
Unfortunately AGS does not support changing rooms in the middle of a script function, only in the end.
So, the only solution is to split the script in parts (or dialogs - in this case).
1. Play the dialog part #1.
2. Change to "cutscene" room 9.
3. After finishing cutscene in room 9, change back to room 4.
3. Upon entering room 4, start dialog part #2.
4. and so on.
Since you revisit same rooms several times under different circumstances, you need to introduce a condition, that would tell you when you need to start a dialog and when not.
For example, you could create a global variable called "int InCutscene;" (or rather use more descriptive name, since you game may have many cutscenes).
In the first dialog you set it up:
@2
Characterone: blah blah blah
Charactertwo: blah blah
InCutscene = 1; <--- set variable
player.Changeroom(9); <-- that's the "cutscene" room
stop <---- end the dialog
In the room's 9 "After fade-in" event do:
// room 9
function room_AfterFadeIn()
{
if (InCutscene == 1)
{
// play cutscene
InCutscene = 2; // update variable
player.Changeroom(4, 400, 400); <-- that's the previous room, the player is supposed to go back to where he was during the first part of the dialogue
}
}
And in the room's 4 "After fade-in" event you launch the following part of the dialog:
// room 4
function room_AfterFadeIn()
{
if (InCutscene == 2)
{
dDialogPart2.Start(); // launch second part of dialog
}
else
{
// something else
}
}
it worked! thank you so much!
an int type variable works just fine, but it needs three values in order for the script to not repeat the second part of the dialogue everytime the character enters the room. a friend of mine suggested a boolean type variable, which makes it even simpler in my case.
room 9:
function room_AfterFadeIn()
{
Wait(40);
// play cutscene
InCutscene = true;
player.ChangeRoom(4, 484, 400, eDirectionRight);
}
room 4:
function room_AfterFadeIn()
{
if (InCutscene)
{
dDialog4.Start(); // launch second part of dialog
dDialog1.Start(); // launch second part of dialog
InCutscene = false;
}
}
dialog1:
Character: blah blah.
player.ChangeRoom(9);
option-off 2
stop
and of course, the final part of the dialogue goes in a new ddialog. that's it!
thank you so much for your help!
Quote from: Kumpel on Mon 12/02/2018 10:22:29
What about simply changing the room's background frame or putting an object in the size of the screen in front of everything? Wouldn't that suffice too? (Me trying to think practical...)
this one also seems like a smart solution that could've worked in my case. i'll try it out!