Having a character leave *after* the dialogue is finished.

Started by madopolis, Mon 11/12/2017 23:47:19

Previous topic - Next topic

madopolis

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


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!
*working on my first*

Khris

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.)

madopolis

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

@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

*working on my first*

SMF spam blocked by CleanTalk