Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: madopolis on Mon 11/12/2017 23:47:19

Title: Having a character leave *after* the dialogue is finished.
Post by: madopolis on Mon 11/12/2017 23:47:19
So, I would like for the npc to leave the room after a certain dialogue option is selected. I really wish the dialogue scripts allowed for regular ags scripts as well. Anyways, right now the npc disappears as soon as the dialogue is run, leaving the player talking to an empty room. Here is my script:

Code (ags) Select


function cMarleen_Talk()
{
  if (player.HasInventory (iSkull))
{
  dDialog3.Start (eBlock);
  cMarleen.Walk (716,  388, eBlock);
  cMarleen.ChangeRoom(7);
}
else dDialog1.Start ();
}


Sooo of course ags does not like that I put the eBlock in with the dialogue start, so I also tried with the walking command, but the character still changes rooms before the player can finish the dialogue.

I'm sure there's a simple solution and I'm just not thinking about it correctly/ misunderstood something within the tutorial/manual (I'm using 3.4.0). Help would be appreciated!
Title: Re: Having a character leave *after* the dialogue is finished.
Post by: Khris on Tue 12/12/2017 01:10:26
Quote from: madopolis on Mon 11/12/2017 23:47:19I really wish the dialogue scripts allowed for regular ags scripts as well.

But they do :-D
Just indent them by at least one space.


(Dialog.Start() is not run until after the function finishes, that's why your attempts failed.)
Title: Re: Having a character leave *after* the dialogue is finished.
Post by: madopolis on Fri 15/12/2017 02:46:22
Thank you! I feel like such a dingus! :(
Here's how I fixed it for anyone else who might be having the same problem..
This is within the dialogue tab.

Code (ags) Select

@5
cMarleen:Really? I bet she's going to pop the question! Ooh!
cMarleen:Watch the shop for me! Here's the key to the kitchen!
  player.AddInventory (iShopkey);
  cMarleen.Walk (757,445,eBlock);
  cMarleen.ChangeRoom (7);
stop