Thread Tools Display Modes
Prev Previous Post   Next Post Next
10/02/17, 07:51 PM   #1
elly22
Join Date: Oct 2017
Posts: 4
Question Problem with OnPlayerCombat State

Hello. I try to follow this tutorial: http://wiki.esoui.com/Writing_your_first_addon
And I create a function like that:

Lua Code:
  1. function testplugin.OnPlayerCombatState(event, inCombat)
  2.   -- The ~= operator is "not equal to" in Lua.
  3.   if inCombat ~= testplugin.inCombat then
  4.     -- The player's state has changed. Update the stored state...
  5.     testplugin.inCombat = inCombat
  6.  
  7.     -- ...and then update the control.
  8.    
  9.    testpluginIndicator:SetHidden(not inCombat)
  10.  
  11.  
  12.   end
  13. end


But something went wrong, because when I reload UI, it already show me "Fighting!" sign. But I'm not in combat state! After killing the enemy, the sign disappears. But why It exists without fight mode just after reloadui? Why inCombat variable return 1?

For example,

Lua Code:
  1. if inCombat then
  2.       d("Entering combat.")
  3.     else
  4.       d("Exiting combat.")
  5.     end

works perfectly - it shows me Entering/Exiting when it really occurs.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Problem with OnPlayerCombat State


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