This is what I'm currently using but haven't tested it with a vehicle yet:
Code:
local comboPoints = ComboFrame
comboPoints:SetParent(PlayerFrame)
comboPoints:UnregisterAllEvents()
for index = 1, MAX_COMBO_POINTS do
local point = _G['ComboPoint' .. index]
point.highlight = _G['ComboPoint' .. index .. 'Highlight']
point.mode = 'IN'
point.timeToFade = COMBOFRAME_HIGHLIGHT_FADE_IN
point.finishedFunc = ComboPointShineFadeIn
point.finishedArg1 = _G['ComboPoint' .. index .. 'Shine']
comboPoints[index] = point
end
comboPoints[5]:SetSize(comboPoints[1]:GetSize())
local comboPointsShown, comboPointsUnit = 0, 'player'
comboPoints:SetScript('OnEvent', function(self, event)
if event == 'UNIT_ENTERED_VEHICLE' then
if comboPointsUnit == 'vehicle' then return end
comboPointsUnit = 'vehicle'
elseif event == 'UNIT_EXITED_VEHICLE' then
if comboPointsUnit == 'player' then return end
comboPointsUnit = 'player'
end
local numComboPoints = UnitPower(comboPointsUnit, 4)
if numComboPoints > 0 then
if comboPointsShown == 0 then
comboPoints:Show()
UIFrameFadeIn(comboPoints, COMBOFRAME_FADE_IN)
end
for index = comboPointsShown + 1, numComboPoints do
UIFrameFade(comboPoints[index].highlight, comboPoints[index])
end
for index = numComboPoints + 1, MAX_COMBO_POINTS do
comboPoints[index].highlight:SetAlpha(0)
comboPoints[index].finishedArg1:SetAlpha(0)
end
else
comboPoints[1].highlight:SetAlpha(0)
comboPoints[1].finishedArg1:SetAlpha(0)
comboPoints:Hide()
end
comboPointsShown = numComboPoints
end)
comboPoints:RegisterEvent('PLAYER_ENTERING_WORLD')
comboPoints:RegisterUnitEvent('UNIT_COMBO_POINTS', 'player', 'vehicle')
comboPoints:RegisterUnitEvent('UNIT_ENTERED_VEHICLE', 'player')
comboPoints:RegisterUnitEvent('UNIT_EXITED_VEHICLE', 'player')
local function Reanchor(start, stop, point, relFrame, relPoint)
local prevFrame = relFrame
for index = start, stop, start < stop and 1 or -1 do
local frame = _G['ComboPoint' .. index]
frame:ClearAllPoints()
frame:SetPoint(point, prevFrame, relPoint)
prevFrame = frame
end
end
comboPoints[3]:ClearAllPoints()
comboPoints[3]:SetPoint('TOP', PlayerFrameManaBar, 'BOTTOM', 0, -2)
Reanchor(2, 1, 'RIGHT', comboPoints[3], 'LEFT')
Reanchor(4, 5, 'LEFT', comboPoints[3], 'RIGHT')