If your team is about to cap the flag, or the opposing team is about to win the game, -- Code goes here should fire. I don't have the coordinates for the horde room yet, but this should be working.
However, how can I clean up the if and else mess I've created?
Code:
local function isWSGMode()
oneX, oneY, oneT = GetBattlefieldFlagPosition(1);
twoX, twoY, twoT = GetBattlefieldFlagPosition(2);
_, _, _, scoreAlliance = GetWorldStateUIInfo(2)
_, _, _, scoreHorde = GetWorldStateUIInfo(3)
if isAlliance() then -- If we're Alliance
if (oneT == "HordeFlag") and ((oneX >= 0.46) and (oneX <= 0.51)) and ((oneY >= 0.11) and (oneY <= 0.17)) and ((twoX == 0) and (twoY == 0)) then -- And we're about to cap
-- Code goes here
else
if ((twoX >= 0.46) and (twoX <= 0.51)) and ((twoY >= 0.11) and (twoY <= 0.17)) and ((oneX == 0) and (oneY == 0)) then
-- Code goes here
end
end
if scoreHorde == "2/3" then -- And Horde is about to win
if (oneT == "AllianceFlag") and ((oneX >= 0.1) and (oneX <= 0.1)) and ((oneY >= 0.1) and (oneY <= 0.1)) and ((twoX == 0) and (twoY == 0)) then
-- Code goes here
else
if ((twoX >= 0.1) and (twoX <= 0.1)) and ((twoY >= 0.1) and (twoY <= 0.1)) and ((oneX == 0) and (oneY == 0)) then
-- Code goes here
end
end
end
else -- If we're Horde
if ((oneX >= 0.1) and (oneX <= 0.1)) and ((oneY >= 0.1) and (oneY <= 0.1)) and (twoX == 0) and (twoY == 0) then -- And we're about to cap
-- Code goes here
else
if ((twoX >= 0.1) and (twoX <= 0.1)) and ((twoY >= 0.1) and (twoY <= 0.1)) and (oneX == 0) and (oneY == 0) then
-- Code goes here
end
end
if scoreAlliance == "2/3" then -- And Alliance is about to win
if (oneT == "HordeFlag") and ((oneX >= 0.46) and (oneX <= 0.51)) and ((oneY >= 0.11) and (oneY <= 0.17)) and ((twoX == 0) and (twoY == 0)) then
-- Code goes here
else
if ((twoX >= 0.46) and (twoX <= 0.51)) and ((twoY >= 0.11) and (twoY <= 0.17)) and ((oneX == 0) and (oneY == 0)) then
-- Code goes here
end
end
end
end
end