Dialog's NPC different rooms.

Started by Candle, Sun 06/11/2005 01:09:48

Previous topic - Next topic

Candle

How would I have a NPC use different Dialog's depending on what room he is in?

strazer

#1
In what situation do you need this?

In script, you could do for example
Code: ags

  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:

Code: ags

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

Candle

Thank you , this should work for me just fine.
Code: ags
 // 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);

SMF spam blocked by CleanTalk