My intention is to start a cutscene after a dialogue ends. However,the dialogue changes rooms before it ends. I tried using "CallRoomScript" within the dialogue, but nothing happens after the room switch. Possibly because it doesn't work between rooms.
[Dialogue script]
cNichint: Understood.
if(player.Room == 29)CallRoomScript(1);
player.ChangeRoom(29, 394, 362);
stop
[room script]
function on_call(int var)
{
if(var==1){
Wait(160);
cRichard.Say("Right. I'll take my leave then.");
cRichard.Say("Release him Sheriff.");
cRichard.Walk(799, 575);
cAbraham.Walk(396, 320);
}
}
Is there a way to activate a function when you enter a second time?
Your walks should be eBlock as far as I can see else the script will automatically run player change room before you have the walks.
You could make a variable to indicate first, second, third, fouth etc time you enter the same room.
You do have First Load already evented in Room events panel. After that you can use variables.
Hope this helps.
This:
if(player.Room == 29)CallRoomScript(1);
is called before the room change; player.Room is obviously never 29 at that point.
You cannot write this and expect AGS to "remember it" for later; it'll only work if the condition is true at the very nanosecond this line is processed.
You can do this:
// room script
bool second_time;
// in after fadein
if (second_time) {
// 2nd entry code
second_time = false;
}
// enters first time
// 1st entry code
second_time = true;
That script worked like a charm. Thanks.