View Single Post
10-31-10, 11:21 AM   #26
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by Dargen View Post
One thing to remember is that you can't change the unit attribute if you are in combat when you get into or out of the vehicle.
Doh. Completely forgot about the secure restrictions.... Is it possible to change the unit attribute with secure code or should I just make a double and show/hide with a secure on-state handler (or whatever they're called)


Edit: Tried to test this in combat but not sure if I left as I was dismounted, any way to shorten this?

Code:
local sechan = CreateFrame("Frame", nil, nil, "SecureHandlerStateTemplate")
sechan:SetAttribute("_onstate-aurastate", [[
local buffs = self:GetFrameRef("auraframe1")
local debuffs = self:GetFrameRef("auraframe2")
if newstate == "invehicle" then
    buffs:SetAttribute("unit", "vehicle")
    debuffs:SetAttribute("unit", "vehicle")
elseif newstate == "notinvehicle" then
    buffs:SetAttribute("unit", "player")
    debuffs:SetAttribute("unit", "player")
end
]])

sechan:SetFrameRef("auraframe1", buffs)
sechan:SetFrameRef("auraframe2", debuffs)
RegisterStateDriver(sechan, "aurastate", "[vehicleui] invehicle; notinvehicle")
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 10-31-10 at 02:46 PM.
  Reply With Quote