scripted cutscene returns

Started by llamaman, Thu 10/05/2007 21:24:51

Previous topic - Next topic

llamaman

So, I have a cutscene that plays when I use an item on another character.  However,  I want it to work such that I can make that happen from any room, and then make the characters talk in the current room.  Currently, I just have it hardcoded to only work in one room.  I would guess I need to do something like check my global "returning from cutscene" variable, possibly in the repeatedly execute part, but I can't find an "Onroomload" function in the scripting interface.

Khris

#1
Check on_event in http://www.adventuregamestudio.co.uk/manual/TextScriptEvents.htm

EDIT:
Btw, re-reading your post, "hardcoding" a character interaction to work in only one room seems weird. Characters are handled globally, as are their interactions.
If the cutscene is happening in another room, simply use player.PreviousRoom to return to the previous room.

llamaman

I'm not sure how I'd use that at the moment.  Currently I want it such that it goes to another room, stuff happens, which I have working up to this point, but then, I want them to talk when it returns.  So, I'm guessing I'd in on_event
if(event=eEventLeaveRoom && data=cCharacter.Room())
{
if (returningfromcutscene==1)
...speech and stuff...
returningfromcutscene=0;
}
or something?  And then just set a variable for returningfromcutscene in the cutscene?

Thanks.

Khris

Unfortunately, there's no eEventRoomAfterFadein.
eEventLeaveRoom won't work because it is called right before the room change.

I can't think of an alternative to adding a RunScript to every room's "Player enters screen (after fadein)" right now.

Well, there one thing, but it's a bit dodgy. You could do this:
Code: ags
function on_event(EventType event, int data) {
  if (event==eEventRoomBeforeFadein && player.PreviousRoom==CUTSCENE_ROOM) {
    SetTimer(1, 60); // fadein time
  }
}

function repeatedly_execute {
  if (IsTimerExpired(1)) {
    ... // speech here
  }
}

SMF spam blocked by CleanTalk