ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Is Npc Dead (https://www.esoui.com/forums/showthread.php?t=968)

Sharlikran 04/17/14 05:03 AM

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.

Iyanga 04/17/14 05:26 AM

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.

Sharlikran 04/17/14 08:46 AM

Quote:

Originally Posted by Iyanga (Post 4717)
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.

Seerah 04/17/14 04:19 PM

I didn't think you could loot NPCs that were alive.

Sharlikran 04/17/14 07:08 PM

Quote:

Originally Posted by Seerah (Post 4775)
I didn't think you could loot NPCs that were alive.

:D 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. ;)


All times are GMT -6. The time now is 04:17 AM.

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