Here is some code to release your spirit if your are dead:
Code:
if (event == "PLAYER_DEAD") then
EasyBGZoneName = GetRealZoneText();
if (EasyBGZoneName == "Alterac Valley") or (EasyBGZoneName == "Warsong Gulch") or (EasyBGZoneName == "Arathi Basin") or (EasyBGZoneName == "Eye of the Storm") then
RepopMe();
end
end
Here is some code to leave the battleground if the game is over, but it does require Chronos as a dependant:
Code:
if (event == "UPDATE_BATTLEFIELD_SCORE") then
if (GetBattlefieldInstanceExpiration() ~= 0) then
EasyBGZoneName = GetRealZoneText();
if (EasyBGZoneName == "Alterac Valley") or (EasyBGZoneName == "Warsong Gulch") or (EasyBGZoneName == "Arathi Basin") or (EasyBGZoneName == "Eye of the Storm") then
Chronos.scheduleByName("LEAVEBG", 1, EasyBG_OnEvent, "LeaveBG");
end
end
end
Register events code:
Code:
this:RegisterEvent("PLAYER_DEAD");
this:RegisterEvent("UPDATE_BATTLEFIELD_SCORE");