Player Frame resets to TOPLEFT when entering a vehicle. I want the player frame to be able to make it stay in the custom position.
Code:
-------------------------------------------------------
-- Player Frame
-------------------------------------------------------
local function Player_Update()
PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint(a1, af1, a1, x1, y1)
PlayerFrame:SetScale(scaleOut)
--PlayerFrame.SetPoint = function()end -- Not allow playerframe to move while in vehicle, also wont allow combat moving
end
local f = CreateFrame("Frame", nil, UIParent)
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
--[[
f:RegisterEvent("PLAYER_GAINS_VEHICLE_DATA")
f:RegisterEvent("PLAYER_LOSES_VEHICLE_DATA")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:RegisterEvent("UNIT_ENTERING_VEHICLE")
f:RegisterEvent("UNIT_ENTERED_VEHICLE")
f:RegisterEvent("UNIT_EXITING_VEHICLE")
f:RegisterEvent("UNIT_EXITED_VEHICLE")
--]]
f:SetScript("OnEvent", Player_Update)
-------------------------------------------------------
-- Target Frame
-------------------------------------------------------
local function Target_Update()
TargetFrame:ClearAllPoints()
TargetFrame:SetPoint(a3, af3, a3, x3, y3)
TargetFrame:SetScale(scaleOut)
--TargetFrame:SetAlpha(0.65) -- Opacity of the Frame
end
local f = CreateFrame("Frame", nil, UIParent)
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:SetScript("OnEvent", Target_Update)
Everything commented out I have tried but none of them stop the player frame from resetting.
Code:
PlayerFrame.SetPoint = function()end
Does work but I also have my player and target frames scale larger when I enter and leave combat. With that enable they no longer can be updated at all.
Combat move code if needed:
Code:
local function Player_InCombat_Update()
UIParent:SetAlpha(UIalphaIN)
PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint(a2, af2, a2, x2, y2)
PlayerFrame:SetScale(scaleIn)
TargetFrame:ClearAllPoints()
TargetFrame:SetPoint(a4, af4, a4, x4, y4)
TargetFrame:SetScale(scaleIn)
end
local f = CreateFrame("Frame", nil, UIParent)
f:RegisterEvent("PLAYER_REGEN_DISABLED")
f:SetScript("OnEvent", Player_InCombat_Update)
Variable info:
Code:
---------------------------------------------
-- COMBAT FADING and SCALING
---------------------------------------------
-- Combat Fading
UIalphaIN = 0.65 -- Opacity of ALL frames IN of Combat
UIalphaOUT = 1.00 -- Opacity of ALL frames OUT of Combat
-- Combat Scaling
scaleOut = 1.00 -- Scale of Player/Target Frames OUT of combat
scaleIn = 1.25 -- Scale of Player/Target Frames IN combat // Set to same as scaleOut to NOT have scaling change
-- Focus Frame Scales
fScale = 1.15 -- Scale of the Focus Frame
---------------------------------------------
-- UNITFRAMES
---------------------------------------------
-- Player Frame Placement OUT of Combat
a1 = "TOPLEFT" -- Anchor Point of Frame
af1 = ActionButton1 -- Anchor Frame
x1 = -175 -- x axis movement
y1 = 200 -- y axis movement
-- Player Frame Placement IN of Combat
a2 = "CENTER" -- Anchor Point of Frame
af2 = UIParent -- Anchor Frame
x2 = -315 -- x axis movement
y2 = 0 -- y axis movement
-- Target Frame Placement OUT of Combat
a3 = "TOPRIGHT" -- Anchor Point of Frame
af3 = ActionButton12-- Anchor Frame
x3 = 175 -- x axis movement
y3 = 200 -- y axis movement
-- Target Frame Placement IN of Combat
a4 = "CENTER" -- Anchor Point of Frame
af4 = UIParent -- Anchor Frame
x4 = 315 -- x axis movement
y4 = 0 -- y axis movement
-- Focus Frame Placement
a5 = "TOPRIGHT" -- Anchor Point of Frame
af5 = TargetFrame -- Anchor Frame
x5 = 175 -- x axis movement
y5 = 100 -- y axis movement
Once I attack anything in a vehicle the frames move to the correct locations. Just the initial enter/leave vehicle has the frames reset to default positions.
Pictures