Jump to content

Home

Closest NPC Dialog script?


supreme kotor

Recommended Posts

Hey guys Supreme Kotor here :)

 

I would first like to apologize for how my previous mods ended and for my leaving of the community, I gave up on modding. A few days ago I realized my mistake and would like to return to modding.

 

Now for my question, I was wondering what would be the code for a script that starts a dialog with the closest NPC? If this isn't possible I understand why, but I know that you can get NPC's, placables, and etc... Through code like this:

Show spoiler
(hidden content - requires Javascript to show)
object oPc=GetFirstPC();
object oRand=GetNearestObject(OBJECT_TYPE_ALL,oPc,1);

So I feel as if what I am asking should be just an adaption of this code.

 

Thanks- Supreme Kotor

Link to comment
Share on other sites

It should look a little like this:

 

void main()
{

  object oPC = GetFirstPC();
  object oNearest = GetNearestObject(OBJECT_TYPE_CREATURE, oPC);

     AssignCommand(oNearest, ActionStartConversation(oPC));

}

 

I haven't tested this at all but it should work. Also, I made the object a creature as I'm assuming you only want to talk with NPCs, not placeables or anything of that sort.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...