Lua Code:
local binding = "SPACE";
local target = "Collector Unta";
local UnitExists, UnitName, SetOverrideBinding, ClearOverrideBindings, SetOverrideBindingClick, IsMounted, InCombatLockdown = UnitExists, UnitName, SetOverrideBinding, ClearOverrideBindings, SetOverrideBindingClick, IsMounted, InCombatLockdown;
local button = CreateFrame("Button", "PhagesCuddleUntaButton", UIParent, "SecureActionButtonTemplate");
button:RegisterForClicks("AnyUp", "AnyDown");
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", "/cast [nomounted] Mighty Caravan Brutosaur\n/targetexact "..target);
button:SetScript("PostClick", function(self)
if (not InCombatLockdown() and UnitExists("target") and UnitName("target") == target) then
SetOverrideBinding(self, true, binding, "INTERACTTARGET");
end
end);
button.Reset = function(self)
ClearOverrideBindings(self);
SetOverrideBindingClick(self, false, binding, self:GetName());
end
button:RegisterEvent("PLAYER_ENTERING_WORLD");
button:RegisterEvent("PLAYER_TARGET_CHANGED");
button:RegisterEvent("PLAYER_MOUNT_DISPLAY_CHANGED");
button:SetScript("OnEvent", function(self, event)
if (not InCombatLockdown() and (event == "PLAYER_ENTERING_WORLD" or (event == "PLAYER_TARGET_CHANGED" and (not UnitExists("target") or UnitName("target") ~= target)) or event == "PLAYER_MOUNT_DISPLAY_CHANGED" and not IsMounted())) then
self:Reset();
end
end);
Simple logic: If Unta is the target it interacts with her, otherwise it mounts up (if not mounted) and also tries to target Unta.
Seems to work fine on the PTR (can't test on live because my subscription just expired and token prices are ridiculous :p), only issue is that it will try to mount up again if you press the key again exactly before the mount cast finished (propably dependant on spell-queuing settings, you'll have to try it yourself if it's annoying).