ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Getting npc names (is it possible?) (https://www.esoui.com/forums/showthread.php?t=4203)

SnowmanDK 01/13/15 10:23 AM

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.                 },

Shinni 01/13/15 10:29 AM

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

Garkin 01/13/15 10:45 AM

Quote:

Originally Posted by Shinni (Post 18237)
probably GetUnitName("interact")

Yup, that's how it is done in interact window:

http://esodata.uesp.net/100010/src/i...w.lua.html#153

SnowmanDK 01/13/15 10:48 AM

Quote:

Originally Posted by Shinni (Post 18237)
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 :)

SnowmanDK 01/13/15 11:35 AM

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?

Ayantir 01/13/15 12:42 PM

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

SnowmanDK 01/13/15 01:18 PM

Quote:

Originally Posted by Ayantir (Post 18242)
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!


All times are GMT -6. The time now is 06:02 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI