Help with non working unit check
I don't really know how to explain this, but I am trying to fix an addon that allows either all units or a specified list of units. The all units part is working fine however when specific units are selected nothing is output to the game. There is no error it just does nothing.
From the addon Code:
local function UnitisAllowed(unit) Code:
if eventType == "SPELL_AURA_APPLIED" and addon.BUFF_SPELLS[spellname] and isEnemy(destFlags) and (addon.CONFIG.allunits or UnitisAllowed(destName)) then Code:
addon.CONFIG = { |
What immediately strikes me is that you're using destName in the UnitIsUnit check. I don't think that'll work unless dest is a group member.
You could try doing UnitisAllowed(destGUID)) instead, and then doing something like this instead: Code:
local function UnitisAllowed(guid) |
Thanks, I had actually already changed UnitisAllowed(destGUID) after reading through some of the wowprogramming.com documents. I'll try it out and see if it works. Thank you again.
|
Sadly I still haven't been able to get this working. If anyone has any ideas they would be greatly appreciated.
|
UnitIsUnit only works on UnitIDs. Like UnitIsUnit("target", "focustarget"). Using guids will not work and using player names will only work if they are in your party or raid.
You should just compare their GUIDs directly instead (string compare). |
I'm sorry if these are dumb questions, I'm really trying. I'm not overly familiar with lua or any other programming language for that matter and I think I may be in over my head here.
Following (I hope) your advise I've gone to Code:
local function UnitisAllowed(unit) Code:
if eventType == "SPELL_AURA_APPLIED" and addon.BUFF_SPELLS[spellname] and isEnemy(destFlags) and (addon.CONFIG.allunits or UnitisAllowed(destID)) then |
Still unable to solve this. Any and all input is appreciated.
|
There's an obvious error in the last snippet of code you posted.
The function is passed a 'unit' parameter but in the code you're checking against 'UnitID'. Apart from that, we need more code. Which addon is it, can you post a pastey of the full code? |
Here is the pastey
http://pastebin.com/Ez2MTqrE I think that code was leftover from the first bit before I started trying to fix the check. I had replaced unit with guid. |
Combat log events don't use the general 'UnitID' like "target" and "focus" things like that. Instead it uses 'UnitGUID' which is a specific string of numbers that is unique to that unit.
What you would ultimately have to do is determine the UnitGUID of all the parameters in your table there, and attempt to match them with the combat log UnitGUID. Something like this: Code:
local function isallowedunit(guid) |
Thank you suicidalkatt! I'll try that as soon as the servers come back up.
|
All times are GMT -6. The time now is 06:34 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI