Thread Tools Display Modes
04/17/14, 05:03 AM   #1
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 642
Is Npc Dead

How do I figure out if the NPC I am looting is dead or not. I found UNIT_REACTION_DEAD on the globals page but no idea how to access it. I also found IsUnitDead(string unitTag) Returns: bool isDead. However, it's that darn ' unitTag ' and I have no idea what to put. I found 19 posts with the words UntiTag, and they mention things like "player", "reticleover", "interact", and so on. I tried "playertarget" and "target" but I can't get IsUnitDead() to return true when I'm looting an Npc.

Esohead uses the level of the NPC when it's living and you mouse over the Npc, to determine that it's an Npc. What I am trying to do is determine whether or not I am looting an Npc. The Npc level is 0 when they are dead. I can get the Npc level to display when they are alive, but I want to loot the Npc and not have it's contents record in HarvestMap.

Last edited by Sharlikran : 04/17/14 at 08:35 AM.
  Reply With Quote
04/17/14, 05:26 AM   #2
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
I suspect that unitTag is the unitName, just that unitTag _also_ accepts symbolic string names for certain cases, like the general "player" string.

My first try would be:
GetUnitReaction(GetUnitNameHighlightedByReticle())

My second try to filter it through GetRawUnitName():
GetUnitReaction(GetRawUnitName(GetUnitNameHighlightedByReticle()))

If this doesn't work, well, at least we can then negate the assumption.
  Reply With Quote
04/17/14, 08:46 AM   #3
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 642
Originally Posted by Iyanga View Post
I suspect that unitTag is the unitName, just that unitTag _also_ accepts symbolic string names for certain cases, like the general "player" string.

My first try would be:
GetUnitReaction(GetUnitNameHighlightedByReticle())

My second try to filter it through GetRawUnitName():
GetUnitReaction(GetRawUnitName(GetUnitNameHighlightedByReticle()))

If this doesn't work, well, at least we can then negate the assumption.
I had wondered how to access UNIT_REACTION_DEAD. I searched the API page, and I just didn't see what to use. Which is why I thought IsUnitDead(unittag) was correct. Then you post GetUnitReaction(unittag) and I was like, what? I didn't see that. GetUnitReaction(UNIT_REACTION_DEAD) works perfectly.
  Reply With Quote
04/17/14, 04:19 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
I didn't think you could loot NPCs that were alive.
  Reply With Quote
04/17/14, 07:08 PM   #5
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 642
Originally Posted by Seerah View Post
I didn't think you could loot NPCs that were alive.
Well naturally. However, in the game everything is a container if you think about it. So the NPC is a container. If you loot it then if it has hide on it that is recorded as a Clothing resource. Esohead uses the reticleover property and the NPC level to make sure it's added to Esohead as an NPC. However, when it's dead it does not have a level so it's treated as a chest, or barrel, or like I say, a container.

Therefore the need to make sure I am detecting a property of an npc. An NPC can be dead while a flower isn't. More or less.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Is Npc Dead


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