Originally Posted by SDPhantom
On a side note, you can use @player and @vehicle to specify the target of the condition rather than the old target= syntax. This option was implemented as a more intuitive way to define the target of a condition since people were trying to use the old syntax for checking if your target was a specified unit.
|
My current handler works fine i only have a small issue.
When the player have a pet summoned and have a pet frame, then i switch the pet frame to the player frame when the UNIT_ENTERED_VEHICLE gets triggeted with a vehicle ui.
However sometimes from UNIT_ENTERING_VEHICLE to UNIT_ENTERED_VEHICLE and from UNIT_EXITING_VEHICLE to UNIT_EXITED_VEHICLE, the pet frame instead of showing the player or the pet shows the vehicle frame for a second for no reason. I'm not sure how to dodge that securely.
I wrote a workaround to unregisted and reregister the pet frame between this events, but thats not gonna work in combat:
Lua Code:
function PlayerPet:UNIT_ENTERING_VEHICLE(unit, showVehicleUI, arg3, vehicleType, vehicleID, arg6, vehicleGUID, arg8, arg9)
if showVehicleUI then
if not InCombatLockdown() then
UnregisterUnitWatch(self.frame)
self.frame:Hide()
end
self.frame.unit = "player"
self:UpdateDisplay()
end
end
function PlayerPet:UNIT_ENTERED_VEHICLE(unit, showVehicleUI, arg3, vehicleType, vehicleID, arg6, vehicleGUID, arg8, arg9)
if showVehicleUI then
if not InCombatLockdown() then
RegisterUnitWatch(self.frame)
end
self.frame.unit = "player"
self:UpdateDisplay()
end
end
function PlayerPet:UNIT_EXITING_VEHICLE()
if self.frame.unit ~= "pet" then
if not InCombatLockdown() then
UnregisterUnitWatch(self.frame)
self.frame:Hide()
end
self.frame.unit = "pet"
self:UpdateDisplay()
end
end
function PlayerPet:UNIT_EXITED_VEHICLE()
--if self.frame.unit ~= "pet" then
--self.frame:Show()
if not InCombatLockdown() then
RegisterUnitWatch(self.frame)
end
--self.frame.unit = "pet"
self:UpdateDisplay()
--end
end