Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Sun 06/11/2005 01:09:48

Title: Dialog's NPC different rooms.
Post by: Candle on Sun 06/11/2005 01:09:48
How would I have a NPC use different Dialog's depending on what room he is in?
Title: Re: Dialog's NPC different rooms.
Post by: strazer on Sun 06/11/2005 01:23:20
In what situation do you need this?

In script, you could do for example

  if (cGuy.Room == 3) cGuy.Say("This");
  else if (cGuy.Room = 4) cGuy.Say("That");


In dialog script, use the above code with the run-script dialog script command and dialog_request (look it up in the manual or search the forum).
You could also make two versions of a dialog option with different text and enable the right one/disable the wrong one before you start the dialog, depending on which room the NPC is in:


  // script for interaction: Talk to GUY

  if (cGuy.Room == 3) {
    SetDialogOption(1, 3, eOptionOn);
    SetDialogOption(1, 4, eOptionOff);
  }
  else if (cGuy.Room == 4) {
    SetDialogOption(1, 3, eOptionOff);
    SetDialogOption(1, 4, eOptionOn);
  }
  RunDialog(1);


You could also run different dialogs altogether, of course.
Title: Re: Dialog's NPC different rooms.
Post by: Candle on Sun 06/11/2005 01:29:42
Thank you , this should work for me just fine.
// script for interaction: Talk to GUY

  if (cGuy.Room == 3) {
    SetDialogOption(1, 3, eOptionOn);
    SetDialogOption(1, 4, eOptionOff);
  }
  else if (cGuy.Room == 4) {
    SetDialogOption(1, 3, eOptionOff);
    SetDialogOption(1, 4, eOptionOn);
  }
  RunDialog(1);