PDA

View Full Version : [LuaHypArc] PvP System - Faction Boss's



Myerz
30-10-09, 12:16 PM
--[[
__ __ __ ______
/\ \ /\ \/\ \ /\ _ \
\ \ \ __ __ __ \ \ \_\ \ __ __ _____\ \ \_\ \ _____ ___
\ \ \ __/\ \/\ \ /'__`\ \ \ _ \/\ \/\ \/\ '__`\ \ __ \/\`'__\/'___\
\ \ \_\ \ \ \_\ \/\ \_\.\_\ \ \ \ \ \ \_\ \ \ \_\ \ \ \/\ \ \ \//\ \__/
\ \____/\ \____/\ \__/ \_\\ \_\ \_\/`____ \ \ __/\ \_\ \_\ \_\\ \____\
\/___/ \/___/ \/__/\/_/ \/_/\/_/`/___// \ \ \/ \/_/\/_/\/_/ \/____/
/\___/\ \_\
\/__/ \/_/ .zapto.org

Author: Myerz
]]--

--[ DEFINE_VARIABLES ]--
local MSG_LANGUAGE_UNIVERSAL = 14
local ON_COMBAT_MSG = "Who dares challenge the king!?"
local IFKing = nil
local TBKing = nil
local BUFFS = {48161, 48073, 48469, 53307, 20217, 48936, 48932, 15366}

--[ TB_KING_ID ]--
local tb_id = put id here

--[ IF_KING_ID ]--
local if_id = put id here

--[ ITEM_ID && AMOUNT ]--
local itm_id = 121214
local amount = 1

--[[

REGISTER_ON_DEFINE

]]--

--[ DEFINE_IF_KING ]--
function IF_Define(Unit, Event)
IFKing = Unit
end

--[ DEFINE_TB_KING ]--
function TB_Define(Unit, Event)
TBKing = Unit
end

--[[

REGISTER_UNIT_COMBAT

]]--

--[ KING_IRON_FORGE ]--
function KingIronforge_OnCombat(Unit, Event)
Unit:SendChatMessage(MSG_LANGUAGE_UNIVERSAL, 0, " "..ON_COMBAT_MSG" ")
end

function KingIronforge_OnDeath(Unit, Event)
logcol(12)
print("[King of Ironforge]: King has been killed")
logcol(5)
Unit:RemoveEvents()

--[ REGISTER_BROADCAST ]--
if (player:GetPlayerRace() == 1) or (player:GetPlayerRace() == 3) or (player:GetPlayerRace() == 4) or (player:GetPlayerRace() == 7) and (player:GetPlayerRace() == 11) then
--[ ON_KILL_BOSS ]--
local rndmplyr = IFKing:GetRandomPlayer(0)
local x, y, z, o = rndmplyr:GetX(), rndmplyr:GetY(), rndmplyr:GetZ(), rndmplyr:GetO()
IFKing:SpawnCreature(5595, x, y, z, o, 21, 0)
IFKing:SpawnCreature(5595, x+5, y, z+3, o, 21, 0)
--[ RNGPLAYER_ITEM_ADD ]--
local rngplyr = IFKing:GetInRangePlayers()
for i = 1, #rngplyr do
rngplyr[i]:AddItem(itm_id, amount)
--[ PLRS_BUFF ]--
local plyrsrng = IFKing:GetInRangePlayers()
for k, v in pairs(BUFFS)
and
for k, v in pairs(plyrsrng) do
plyrsrng[i]:CastSpell(BUFFS[v])
--[ PLRS_MSG ]--
local rgplrs = GetPlayersInWorld()
for k, v in pairs(plrs) do
plrs[i]:SendBroadCastMessage(MSG_LANGUAGE_UNIVERSAL, 0, "The horde have taken over Ironforge")

else -- killed by a command or spell

if (player:GetPlayerRace() == 2) or (player:GetPlayerRace() == 5) or (player:GetPlayerRace() == 6) or (player:GetPlayerRace() == 8) and (player:GetPlayerRace() == 10) then
Unit:SendBroadCastMessage(MSG_LANGUAGE_UNIVERSAL, 0, "The alliance have betrayed their own king!")
end
end
end
end
end
end

--[ KING_THUNDER_BLUFF ]--
function KingThunderBluff_OnCombat(Unit, Event)
Unit:SendChatMessage(MSG_LANGUAGE_UNIVERSAL, 0, " "..ON_COMBAT_MSG" ")
end

function KingThunderBluff_OnDeath(Unit, Event)
logcol(13)
print("[King of Ironforge]: King has been killed")
logcol(7)
Unit:RemoveEvents()

--[ REGISTER_BROADCAST ]--
if (player:GetPlayerRace() == 1) or (player:GetPlayerRace() == 3) or (player:GetPlayerRace() == 4) or (player:GetPlayerRace() == 7) and (player:GetPlayerRace() == 11) then
--[ ON_KILL_BOSS ]--
local rndmplyr = Unit:GetRandomPlayer(0)
local x, y, z, o = rndmplyr:GetX(), rndmplyr:GetY(), rndmplyr:GetZ(), rndmplyr:GetO()
TBKing:SpawnCreature(14720, x, y, z, o, 21, 0)
TBKing:SpawnCreature(14720, x+5, y, z+3, o, 21, 0)
--[ RNGPLAYER_ITEM_ADD ]--
local rngplyr = TBKing:GetInRangePlayers()
for i = 1, #rngplyr do
rngplyr[i]:AddItem(itm_id, amount)
--[ PLRS_BUFF ]--
local plyrsrng = TBKing:GetInRangePlayers()
for k, v in pairs(BUFFS)
and
for k, v in pairs(plyrsrng) do
plyrsrng[i]:CastSpell(BUFFS[v])
--[ PLRS_MSG ]--
local plrs = GetPlayersInWorld()
for k, v in pairs(plrs) do
plrs[i]:SendBroadCastMessage(MSG_LANGUAGE_UNIVERSAL, 0, "The alliance have taken over Thunderbluff")


else -- killed by a command or spell

if (player:GetPlayerRace() == 2) or (player:GetPlayerRace() == 5) or (player:GetPlayerRace() == 6) or (player:GetPlayerRace() == 8) and (player:GetPlayerRace() == 10) then
Unit:SendBroadCastMessage(MSG_LANGUAGE_UNIVERSAL, 0, "The horde have betrayed their own king!")
end
end
end
end
end
end

--[ LOCALS ]--
local bosstimer = math.random (180000, 360000)

--[ BOSS_PVP_CHECK ]--
function BossCheck(event, pPlayer)
--[ CHECK_TBKing ]--
if (TBKing = nil) then
TBKing:Despawn(0, 3000)
else
local plrs = GetPlayersInWorld()
for k, v in pairs(plrs) do
plrs[i]:SendBroadCastMessage(MSG_LANGUAGE_UNIVERSAL, 0, "King of Thunderbluff is still waiting for a challenge")

--[ CHECK_IFKing ]--
if (IFKing = nil) then
IFKing:Despawn(0, 3000)
else
local plrs = GetPlayersInWorld()
for k, v in pairs(plrs) do
plrs[i]:SendBroadCastMessage(MSG_LANGUAGE_UNIVERSAL, 0, "King of Ironforge is still waiting for a challenge")
end
end
end end
end



--[[

REGISTER_UNIT_EVENT

]]--

if (GetLuaEngine() ~= "LuaHypArc") then
print("[IF-TB]: Did not load script - LuaHypArc not installed.")
print("[IF-TB]: Please visit http://luahyparc.zapto.org/ for more information.")

else
--[ REGISTER_TIMED_EVENT ]--
RegisterTimedEvent("BossCheck", bosstimer, 0)

--[ REGISTER_UNIT_EVENT ]--
RegisterUnitEvent(tb_id, 1, "KingThunderBluff_OnCombat")
RegisterUnitEvent(tb_id, 4, "KingThunderBluff_OnDeath")
RegisterUnitEvent(if_id, 1, "KingIronforge_OnCombat")
RegisterUnitEvent(if_id, 4, "KingIronforge_OnDeath")
end

Wolferine
21-12-09, 06:36 AM
IFKing = Unit - IFKing = nil

Doesn't that crashes?

Paradox
21-12-09, 08:53 AM
IFKing = Unit - IFKing = nil Doesn't that crashes?


It used to, but Hypersniper fixed that error in the core, I don't know how, but he did.