View Single Post
07/22/18, 06:01 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,964
If you want to put a message into the chat as the weapon sheaths you can do it like this:

Lua Code:
  1. --preHook the original function
  2. ZO_PreHook("TogglePlayerWield", function()
  3.     d("TogglePlayerWield was used")
  4.     return false -- reutn false to run original function code of TogglePlayerWield afterwards!
  5. end

You can use the function IsUnitInCombat("player") to check if you ar ein combat and change the message shown in the chat accordingly.
In combat: Weapon drawn, Out of combat: weapon sheath
-> Maybe out of combat will be always false within a preHook to TogglePlayerWield as you run your code before the weapon gets sheathed and you might be in combat at this time too.

For the weapon draw stuff you could register an event for "getting into combat" I guess:
EVENT_PLAYER_COMBAT_STATE

Last edited by Baertram : 07/22/18 at 06:04 AM.
  Reply With Quote