Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: DBoyWheeler on Tue 20/02/2018 13:48:08

Title: My MAGS game is crashing near the end.
Post by: DBoyWheeler on Tue 20/02/2018 13:48:08
Okay, I've been trying to get the game to finish up... but the things that were not causing me trouble before are now the things causing me trouble.

In the past, I tried to get the player character to pick up each object before, and it worked fine in the other rooms, but now it won't.  So I tried to make it a cutscene.

Here's the code:
Code (ags) Select

function room_Load()
{
  cParrot.Scaling = 48;
  cParrot.FaceLocation(0, cParrot.y, eNoBlock);
  player.FaceLocation(480, player.y, eNoBlock);
  if((GotBakingSoda)&&(!UsedBakingSoda)){oBakingSoda.Visible = true;}
  if((GotOldScotch)&&(!UsedOldScotch)){oOldScotch.Visible = true;}
  if((GotOldFoamBeads)&&(!UsedOldFoamBeads)){oOldFoamBeads.Visible = true;}
 
  //Since the objects were being ornery, I had to do this.
 
  if(GotAllThreeItems == true)
  {
    player.Walk(387, 295, eBlock, eWalkableAreas);
    player.FaceCharacter(cParrot, eBlock);
    player.Say("Everything is here, Herr Parrot.");
    cParrot.Say("All right.  Start with putting the baking soda in the crack.");
    player.FaceObject(oBakingSoda, eBlock);
    player.Say("Ja.");
    UsedBakingSoda = true;
    if(oBakingSoda.Visible == true){oBakingSoda.Visible = false;}
    player.Walk(302, 256, eBlock, eWalkableAreas);
    Wait(40);
    player.Walk(428, 295, eBlock, eWalkableAreas);
    player.FaceObject(oOldFoamBeads);
    cParrot.Say("Good.  Now let's put in the Old Foam Beads so the reaction won't spill out.");
    player.Say("Right.");
    UsedOldFoamBeads = true;
    if(oOldFoamBeads.Visible == true){oOldFoamBeads.Visible = false;}
    player.Walk(302, 256, eBlock, eWalkableAreas);
    Wait(40);
    player.Walk(402, 295, eBlock, eWalkableAreas);
    player.FaceObject(oOldScotch, eBlock);
    cParrot.Say("Now to use the Old Scotch and get the reaction going.");
    player.Say("Got it!");
    UsedOldScotch = true;
    if(oOldScotch.Visible == true){oOldScotch.Visible = false;}
    player.Walk(302, 256, eBlock, eWalkableAreas);
    Wait(40);
    //Sound here.
    SecretDoorOpen = true;
    if(oSecretDoor.Visible == false){oSecretDoor.Visible = true;}
    player.Say("The secret door is now open!");
    cParrot.Say("We did it!");
    cParrot.ChangeRoom(12, 289, 106);
    player.ChangeRoom(12, 300, 344);
  }
}


But after getting all three items, when I try to enter the room, the game just shows black in the window and the dang thing just freezes up!  Does AGS have a bug somewhere?

[Edit] Nevermind.  I found out what I did wrong--I had to put it in "after load".