View Single Post
04/26/14, 08:29 AM   #5
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by Fathis Ules View Post
If :SetHidden(true) is your solution but something calls again :SetHidden(false) to revert your solution then you need to replace SetHidden by your function to filter out the calls made to SetHidden with false

In the sample I show you how to replace the SetHidden function by yours so you can decide then to pass the original execution to origZO_PlayerAttributeHealthBarLeftGloss to have the result of a normal SetHidden, or to not continue the execution , that's how you can forbid any call made to SetHidden

It is not specific to Lua, it is just called function hooking and is present in all the programming language, the only requirement is overwrite the pointer of the original function by your and to store a pointer of the original function in a local variable before you replace it so you can call later the original function from your.

Lua Code:
  1. local function newSetHiddenLeft(self, hidden, ...)
  2.     if hidden == false then
  3.         --do nothing, meaning, SetHidden is disabled
  4.         return
  5.     end
  6.     originalSetHiddenLeft(self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  7. end
  8.  
  9. local function newSetHiddenRight(self, hidden, ...)
  10.     if hidden == false then
  11.         --do nothing, meaning, SetHidden is disabled
  12.         return
  13.     end
  14.     originalSetHiddenRight (self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarRightGloss.SetHidden
  15. end
  16.  
  17. local originalSetHiddenLeft = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  18. local originalSetHiddenRight = ZO_PlayerAttributeHealthBarRightGloss.SetHidden
  19.  
  20. ZO_PlayerAttributeHealthBarLeftGloss.SetHidden = newSetHiddenLeft
  21. ZO_PlayerAttributeHealthBarRightGloss.SetHidden = newSetHiddenRight
This is very impressive, A new way (for me) to tackle the problem. Its kind of like overriding a function, isnt it?

However.. Hiding the 'glossy frame' and then disabling the sethidden function, still results in the 'glossyness' being shown when first aggroing an enemy thinking theres something glossy somewhere else.. Damn it!!

I appreciate you helping me out, really! thank you!
MysLEx
  Reply With Quote