Thread Tools Display Modes
01/13/15, 10:23 AM   #1
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Getting npc names (is it possible?)

Is it possible to get the name of an npc that you talk to?
I am looking to grab the name of an npc offering a quest, so I can save it with the other information.
I already have my addon saving the quest name and the coordinate where I pick it up,
like this:
Lua Code:
  1. ["Quests"] =
  2.                 {
  3.                     ["Unaccounted Crew"] = "Vulkhel Guard:0.5247,0.6904/Auridon:0.6208,0.9573",
  4.                 },
but would like to add the name of the quest giver, like this:
Lua Code:
  1. ["Quests"] =
  2.                 {
  3.                     ["Unaccounted Crew"] = "Vulkhel Guard:0.5247,0.6904/Auridon:0.6208,0.9573/Captain Erronfaire",
  4.                 },
  Reply With Quote
01/13/15, 10:29 AM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
probably GetUnitName("interact")

edit:
if you're creating some kind of questing addon you might be interested in this lua file I once created
https://www.dropbox.com/s/3uml9m2tdm...uests.lua?dl=0
it's based on the esohead map

Last edited by Shinni : 01/13/15 at 10:35 AM.
  Reply With Quote
01/13/15, 10:45 AM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Shinni View Post
probably GetUnitName("interact")
Yup, that's how it is done in interact window:

http://esodata.uesp.net/100010/src/i...w.lua.html#153
  Reply With Quote
01/13/15, 10:48 AM   #4
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Shinni View Post
probably GetUnitName("interact")

edit:
if you're creating some kind of questing addon you might be interested in this lua file I once created
https://www.dropbox.com/s/3uml9m2tdm...uests.lua?dl=0
it's based on the esohead map
I'll look into that GetUnitName("interact"), thanks
I am not creating a full quest addon.
I am working adding Quest Givers to Destinations, but only the quest line triggers.
The reason for that is that I noticed people miss a LOT of quests not part of the hubs, so wanna give them a hand
I also wanna add so it only shows the quests not yet taken when I get that far ahead.
Still only at the first part of making it easier to get the data for the quests at the moment. The rest will come later
  Reply With Quote
01/13/15, 11:35 AM   #5
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
I tried using this
Lua Code:
  1. local npcName = zo_strformat(GetString(SI_INTERACT_TITLE_FORMAT), GetUnitName("interact"))
but the result is just:
--
I assume it's because it is fired when EVENT_QUEST_ADDED is triggered, and that is only fired as I accept the quest and the conversation is closed.
Or am I wrong?
  Reply With Quote
01/13/15, 12:42 PM   #6
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Lua Code:
  1. local unitname = GetUnitName("interact")

Works fine.

You must interact with the NPC while executing this code.

exemple using :

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("addon", EVENT_CHATTER_BEGIN, letstalk)

If you want to use QUEST events, you need to use EVENT_QUEST_OFFERED
  Reply With Quote
01/13/15, 01:18 PM   #7
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Ayantir View Post
Lua Code:
  1. local unitname = GetUnitName("interact")

Works fine.

You must interact with the NPC while executing this code.

exemple using :

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("addon", EVENT_CHATTER_BEGIN, letstalk)

If you want to use QUEST events, you need to use EVENT_QUEST_OFFERED
Exactly what I was looking for, thanks

Case closed!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Getting npc names (is it possible?)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off