Thread Tools Display Modes
03/17/14, 06:29 AM   #1
Uesp
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 15
GetUnitRace() for NPCs

I tried using the following to log information on NPCs inside a EVENT_RETICLE_TARGET_CHANGED function:
Code:
local level = GetUnitLevel(unitTag)
local gender = GetUnitGender(unitTag)
local difficulty = GetUnitDifficulty(unitTag)
local class = GetUnitClass(unitTag)           --Doesn't work
local race = GetUnitRace(unitTag)            --Doesn't work
The first 3 functions work fine but the Class/Race functions return an empty string. I assume they work fine on PCs but was wondering why not working on NPCs? I would expect NPCs to have a set race. As far as I can tell there are no other "get race" type functions in the API.

Any ideas or pointing out something I've missed would be great.
  Reply With Quote
03/18/14, 04:46 PM   #2
inDef
Join Date: Mar 2014
Posts: 16
Originally Posted by Uesp View Post
I tried using the following to log information on NPCs inside a EVENT_RETICLE_TARGET_CHANGED function:
Code:
local level = GetUnitLevel(unitTag)
local gender = GetUnitGender(unitTag)
local difficulty = GetUnitDifficulty(unitTag)
local class = GetUnitClass(unitTag)           --Doesn't work
local race = GetUnitRace(unitTag)            --Doesn't work
The first 3 functions work fine but the Class/Race functions return an empty string. I assume they work fine on PCs but was wondering why not working on NPCs? I would expect NPCs to have a set race. As far as I can tell there are no other "get race" type functions in the API.

Any ideas or pointing out something I've missed would be great.
This is 100% speculation but I'd bet that:

1. NPC's don't have a race, they are just skinned a certain way. As a super generic example, imagine that any particular instance of class "NPC" does not have any sort of "race" definition...it just has a skin assigned to it. I'd imagine NPC's don't have passives...and it doesn't appear there are any racial damage buffs in the game (i.e. do x% increased damage to Breton) for which would make a racial definition important.

Note: Daedra and undead are not a class, they are an attribute. I mention this because there are "do x% increased damage to Daedra/Undead" mods.

2. NPC's don't have a class, they just have a pool of abilities they can use.

Again, complete speculation but if true would explain your results.
  Reply With Quote
03/19/14, 05:18 AM   #3
Uesp
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 15
Good points...I was hoping it would be like Skyrim/Oblivion where all NPCs had the same complement of attributes and statistics. Its not a big deal anyways...it would have just helped for some logging of NPC data.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » GetUnitRace() for NPCs


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