best way to detect combat status as an event?
Hey guys. I'm trying to find the best way to determine if the player is in combat, and run a function based on that status.
Right now I'm using the event PLAYER_REGEN_ENABLED, but it only fires when the player has agro. This wouldn't work for, say, dps or a healer entering combat, but not being attacked themselves. Elsewhere I'm using UnitAffectingCombat("player") as a condition for an if statement, but it's not a great solution either as it's buried in an OnEnter hook, so it only checks when the mouse hovers on that frame. Thanks, Tony |
also looking for an event solution for when the user's health is under 100%. I have an IF version for that already, but again, it only fires on frame OnEnter. I need it to fire as soon as they're under 100%....
|
For combat, use the function InCombatLockdown().
For health, use the UNIT_HEALTH event. |
Or "UNIT_HEALTH_FREQUENT" to get a more immediate response.
|
Quote:
|
Quote:
If your problem is with the timing of when these events fire, it's just how the game considers when the player is in combat. There are only a handful of things that put you in combat when someone else engages a mob. The most common ways are either hitting the mob with an attack or ability; or healing/buffing someone already on their threat list. |
Quote:
Thanks all for pointers, I will be trying them after work, which is where I must now go... UNIT_WORK. |
All times are GMT -6. The time now is 07:02 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI