Author Topic: Scripting NPCs with conversations....  (Read 292 times)

Legacy_datamaster

  • Jr. Member
  • **
  • Posts: 94
  • Karma: +0/-0
Scripting NPCs with conversations....
« on: May 17, 2011, 08:49:30 pm »


               I know how to spawn in creatures using scripts.  Mostly I do this to spawn in monsters to attack.
But is it possible to spawn in NPCs using scripts, and have them use a specific conversation that you specified beforehand?  This way it saves on the number of creatures on the palette.
I think I have seen people hint at this, but can't seem to find it.

------------------------
"Knowledge knows no bounds!  But hindsight might wish there had been some!"
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Scripting NPCs with conversations....
« Reply #1 on: May 17, 2011, 09:40:07 pm »


               It is possible yes. One way to do it would be to alter the default OnConversation script (such as nw_c2_default4). The trade off is that you will probably end up with a large convoluted script.

You'd have to do quite a bit of checks to make sure the right NPC uses the right conversation.
e.g. you have one npc in one area you could do:
if (GetTag(OBJECT_SELF) == "NPC1" && GetArea(OBJECT_SELF) == GetObjectByTag("Area51"))
{
   ClearAllActions(TRUE);
   BeginConversation("con res ref here");
}

But you could run into some problems. If you had 2 generic NPCs in the same area with the same tags then you'd have to add further checks like if they were closest to a particular object or something.

So this is just one way off the top of my head. Hope it helps and good luck.