Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: steptoe on Sun 29/07/2012 19:50:28

Title: SetRestartPoint not running cutscene
Post by: steptoe on Sun 29/07/2012 19:50:28
Hi

Search is down or very slow from my end.

I am using SetRestartPoint so if player Replays from Credits it goes to room other than Splash.

The Restart point cannot be set while a script is running so I have it after Room Fades in but before cutscene starts. Although the Restart works it does not run cutscene.

Code (AGS) Select

function room_AfterFadeIn()
{
  SetRestartPoint ();
 
  // CUTSCENE STARTS


Am I missing something?

cheers



Title: Re: SetRestartPoint not running cutscene
Post by: Khris on Sun 29/07/2012 19:55:14
You've already answered your own question: "The Restart point cannot be set while a script is running". In other words, the command isn't executed immediately but put in the queue, then the cutscene is run, then the function (script) finishes and the queued command is executed.
Just move the command to room_Load().
Title: Re: SetRestartPoint not running cutscene
Post by: steptoe on Sun 29/07/2012 20:08:44
Thanks Khris

I used SetRestartPoint on room_Load but the cutscene still fails to run.

Could it be that the Player need to be in room? Player starts in room 20 when game starts and when replaying restarts in room 1.

Here is room_AfterFadeIn:

Code (AGS) Select
function room_AfterFadeIn()
{

// CUTSCENE STARTS

DisplayAt(40, 200, 600,"After an evening at the Grand Theater you are waiting for your [chauffered car to arrive when suddenly...");

// CAR MOVES AND STOPS

aCARSTOPS.Play();

ocar.SetView(12, 0);
ocar.Animate(0, 4, eRepeat, eNoBlock);
ocar.Move(302,  216, 4, eBlock, eAnywhere);
ocar.SetView(12, 1);

cRichy.Transparency=0;
cRichy.Walk(358, 183, eBlock, eAnywhere);
cRichy.Say("I have a gun! Get into that alley before [I blow you all away!!");
cClaudia.Walk(434, 130, eNoBlock, eWalkableAreas);
cFrankj.Walk(434, 130, eNoBlock, eWalkableAreas);
cFrankm.Walk(434, 130, eBlock);
cRichy.Say("Keep the car hot Trevor whilst [I turn these filthy rich guys over!");
cRichy.Walk(434, 130, eBlock);

cRichy.Say("You rich folk give me all your[jewellery and money!!");
cFrankj.Say("We are not giving you anything!! [Go before I shout for the cops!!");
cClaudia.Say("I think we should do as he asks[darling, he has a gun!!");
cRichy.Say("That's right lady. Now, hand over [the pretty pretty and make it quick!!");
cFrankj.Say("Do not give him anything Martha!!");
cRichy.Say("I said hand over your valuables [or i'm gonna let you have it!!");
cFrankj.Say("You won't get away with this!!");
cRichy.Say("Shut your face old man!!");

aGUNSHOTS.Play();

Wait(210);
object[2].Visible=true;
object[3].Visible=true;
object[6].Visible=true;

DisplayAt(80, 210, 400, "Shots rings out and your parents lay dead and you receive a leg wound!!!!");

  // GUNFIRE

cRichy.Walk(358, 186, eBlock, eAnywhere);
cRichy.Transparency=100;

SetBackgroundFrame(1);

cFrankj.Say("Put your foot down before the [cops get here!!");
//cEgo.SayAt(380, 149, 260, "Mr Endle will be proud [of you!");
aCARSTOPS.Play();
ocar.SetView(12, 0);
ocar.Animate(0, 4, eRepeat, eNoBlock);
ocar.Move(680,  210, 4, eBlock, eAnywhere);
ocar.SetView(12, 1);

object[4].Visible=true;
object[4].SetView(15);
object[4].Animate(0, -1, eOnce, eBlock);
object[4].SetView(15, 1);
Wait(200);
object[4].Visible=false;

cFrankj.ChangeRoom(2);
}


any ideas as to why?

cheers
Title: Re: SetRestartPoint not running cutscene
Post by: Khris on Sun 29/07/2012 21:01:09
The player is always in the room that's currently displayed.

Hmm, try putting a Wait(1); after SetRestartPoint(); in room_Load.

I've also noticed that this cutscene can't be skipped, you might want to look into the StartCutscene() command.

If it still doesn't work, try this:
Code (ags) Select
// in room_AfterFadeIn()
  SetTimer(1, 3);
  SetRestartPoint();

// in room_RepExec
  if (IsTimerExpired(1)) {
    // cutscene code
  }
Title: Re: SetRestartPoint not running cutscene
Post by: steptoe on Mon 30/07/2012 06:35:45
Hi Khris

Used Timer and RepExec as you mentioned and it works. Many thanks.

Also, used StartCutscene /  EndCutscene. I should have thought about that!

Thanks again

Edit: It seems to not work if loading a game after cutscene (if saved further on) and restarts from splash scene.

For the time being I have removed restore point and kept cutscene skip.

I will read/search more about subject.


steptoe