Code:
--- Definitions --------------------------------------------------------------------------------------------------
local NPC_STARTER = 400001
local NPC_ENDER = 400000
local EVENT_GUY = nil
local Count = 0
local PlayerA = nil
local PlayerB = nil
local zEvent = 10
local zzEvent = 25
local mapid, x, y, z = 0, -2375, -4213, 129
local SCALE = 2
local PLR_SPEED = 22
local two_map, two_x, two_y, two_z = 0, -1819, -3792, 179
local KNOCKBACK_SPELL = 49398
--- The Event Starter ---------------------------------------------------------------------------------------------
function zzz_Random_Event_OnGossip(pUnit, event, player)
pUnit:GossipCreateMenu(1515151, player, 0)
pUnit:GossipMenuAddItem(0, "Add me to the queue for the event.", 4, 0)
pUnit:GossipMenuAddItem(0, "Nevermind.", 3, 0)
pUnit:GossipSendMenu(player)
end
function zzz_Random_Event_Submenus(pUnit, event, player, id, intid, code)
if(intid == 4) then
--Count = Count + 1
--if Count == 1 then
if PlayerA ~= nil and PlayerB ~= nil then
player:SendBroadcastMessage("|cFFFF0000The Event is in progress - Please try again in a few minutes.")
player:SendAreaTriggerMessage("|cFFFF0000The Event is in progress - Please try again in a few minutes.")
end
if PlayerA == nil and player ~= PlayerB then
PlayerA = player
PlayerA:LearnSpell(KNOCKBACK_SPELL)
PlayerA:SendBroadcastMessage("|cFFFF0000You are now in the queue to start the event!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000You are now in the queue to start the event!")
player:GossipComplete()
else
--if Count == 2 then
if player ~= PlayerA then
PlayerB = player
--Count = 0
PlayerB:LearnSpell(KNOCKBACK_SPELL)
PlayerB:SendBroadcastMessage("|cFFFF0000You are now in the queue to start the event!")
PlayerB:SendAreaTriggerMessage("|cFFFF0000You are now in the queue to start the event!")
player:GossipComplete()
else
--Count = 1
PlayerA:SendBroadcastMessage("|cFFFF0000You are already in the queue!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000You are already in the queue!")
end
end
player:GossipComplete()
--end
end
if(intid == 3) then
player:GossipComplete()
end
end
RegisterUnitGossipEvent(NPC_STARTER, 1, "zzz_Random_Event_OnGossip")
RegisterUnitGossipEvent(NPC_STARTER, 2, "zzz_Random_Event_Submenus")
--- The Event ---------------------------------------------------------------------------------------------------
function zzz_Random_Event_Controller(pUnit, Event)
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHEzzzggz", 1000, 1)
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
function zzz_CHECK_PLAYERS_TEHEzzzggz(pUnit, Event)
EVENT_GUY = pUnit
end
RegisterUnitEvent(NPC_STARTER, 18, "zzz_Random_Event_Controller")
function zzz_CHECK_PLAYERS_TEHE(pUnit, Event)
if PlayerA ~= nil then
if PlayerB ~= nil then
if PlayerA == PlayerB then
PlayerA = nil
PlayerB = nil
else
pUnit:RemoveEvents()
PlayerA:SendBroadcastMessage("|cFFFF0000You're about to be teleported!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000You're about to be teleported!")
PlayerB:SendBroadcastMessage("|cFFFF0000You're about to be teleported!")
PlayerB:SendAreaTriggerMessage("|cFFFF0000You're about to be teleported!")
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHEzz_Count", 1000, 0)
end
end
end
end
function zzz_CHECK_PLAYERS_TEHEzz_Count(pUnit, Event)
--if zEvent == 0 then
--zEvent = 10
--else
zEvent = zEvent - 1
if PlayerA ~= nil then
if PlayerB ~= nil then
if zEvent == -1 then
zEvent = 10
pUnit:RemoveEvents()
PlayerA:Teleport(mapid, x, y, z)
PlayerB:Teleport(mapid, x, y, z)
PlayerA:SetScale(SCALE)
PlayerB:SetScale(SCALE)
PlayerA:SetPlayerSpeed(PLR_SPEED)
PlayerB:SetPlayerSpeed(PLR_SPEED)
pUnit:RegisterEvent("olawd_evnet_has_started_woot", 1000, 1)
else
PlayerA:SendBroadcastMessage("|cFFFF0000You will be teleported in "..zEvent.." seconds!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000You will be teleported "..zEvent.." seconds!")
PlayerB:SendBroadcastMessage("|cFFFF0000You will be teleported "..zEvent.." seconds!")
PlayerB:SendAreaTriggerMessage("|cFFFF0000You will be teleported "..zEvent.." seconds!")
end
else
pUnit:RemoveEvents()
PlayerB = nil
PlayerA:SendBroadcastMessage("|cFFFF0000The other player has left the event!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000The other player has left the event!")
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
else
if PlayerB ~= nil then
PlayerB:SendBroadcastMessage("|cFFFF0000The other player has left the event!")
PlayerB:SendAreaTriggerMessage("|cFFFF0000The other player has left the event!")
end
pUnit:RemoveEvents()
PlayerA = nil
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
--end
end
function olawd_evnet_has_started_woot(pUnit, Event)
pUnit:RemoveEvents() -- Just to make sure...
PlayerA:SetPlayerLock(1)
PlayerB:SetPlayerLock(1)
pUnit:RegisterEvent("Root_At_Start_So_Players_Can_Get_READY", 1000, 0)
end
function Root_At_Start_So_Players_Can_Get_READY(pUnit, Event)
zzEvent = zzEvent - 1
if PlayerA ~= nil then
if PlayerB ~= nil then
if zzEvent == -1 then
zzEvent = 25
pUnit:RemoveEvents()
PlayerA:SetPlayerLock(0)
PlayerB:SetPlayerLock(0)
pUnit:RegisterEvent("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz_CHECK_PLAYERS_TEHE", 10000, 0)
else
if zzEvent == 19 then
PlayerA:SendBroadcastMessage("|cFFFF0000If you meet a player of the same faction you need to duel your opponent to start the event. If you meet one of the opposite faction you're ready to go.")
PlayerB:SendBroadcastMessage("|cFFFF0000If you meet a player of the same faction you need to duel your opponent to start the event. If you meet one of the opposite faction you're ready to go.")
end
if zzEvent == 9 then
PlayerA:SendBroadcastMessage("|cFFFF0000If you wish to leave the event, talk to Dunkan Lefty and leave. He is stationed at the bottom and at the top. By leaving, you reset the event and you will be teleported back. You may then requeue to join again.")
PlayerB:SendBroadcastMessage("|cFFFF0000If you wish to leave the event, talk to Dunkan Lefty and leave. He is stationed at the bottom and at the top. By leaving, you reset the event and you will be teleported back. You may then requeue to join again.")
end
--PlayerA:SendBroadcastMessage("|cFFFF0000Please place the knockback spell on your action bar and do not use any other ability. The event will start in "..zzEvent.." seconds!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000Please place the knockback spell on your action bar and do not use any other ability. The event will start in "..zzEvent.." seconds!")
--PlayerB:SendBroadcastMessage("|cFFFF0000Please place the knockback spell on your action bar and do not use any other ability. The event will start in "..zzEvent.." seconds!")
PlayerB:SendAreaTriggerMessage("|cFFFF0000Please place the knockback spell on your action bar and do not use any other ability. The event will start in "..zzEvent.." seconds!")
end
else
pUnit:RemoveEvents()
PlayerB = nil
PlayerA:SendBroadcastMessage("|cFFFF0000The other player has left the event!")
PlayerA:SendAreaTriggerMessage("|cFFFF0000The other player has left the event!")
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
else
if PlayerB ~= nil then
PlayerB:SendBroadcastMessage("|cFFFF0000The other player has left the event!")
PlayerB:SendAreaTriggerMessage("|cFFFF0000The other player has left the event!")
end
pUnit:RemoveEvents()
PlayerA = nil
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
end
function zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz_CHECK_PLAYERS_TEHE(pUnit, Event)
if PlayerA == nil then
pUnit:RemoveEvents()
Count = 0
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
if PlayerB ~= nil then
PlayerB:Teleport(two_map, two_x, two_y, two_z)
PlayerB = nil
end
else
if PlayerB == nil then
pUnit:RemoveEvents()
Count = 0
pUnit:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
if PlayerA ~= nil then
PlayerA:Teleport(two_map, two_x, two_y, two_z)
PlayerA = nil
end
end
end
end
--- The Event Starter ---------------------------------------------------------------------------------------------
function zzzz_Random_Event_OnGossip(pUnit, event, player)
pUnit:GossipCreateMenu(1515152, player, 0)
pUnit:GossipMenuAddItem(0, "Let me leave this event.", 5, 0)
pUnit:GossipMenuAddItem(0, "Nevermind.", 3, 0)
pUnit:GossipSendMenu(player)
end
function zzzz_Random_Event_Submenus(pUnit, event, player, id, intid, code)
if(intid == 5) then
--[[--Count = 0
print("'Let me leave this event' pressed.")
if player == PlayerA then
print("PlayerA is the person using the guy")
if PlayerB ~= nil then
print("PlayerB is not nil")
if EVENT_GUY ~= nil then
print("Teleporting player B out!")
PlayerB:UnlearnSpell(KNOCKBACK_SPELL)
PlayerB:SetScale(1)
PlayerB:SetPlayerSpeed(7)
PlayerB:Teleport(two_map, two_x, two_y, two_z)
PlayerB = nil
local name = PlayerB:GetName()
end
end
print("Teleporting player A out!")
PlayerA:UnlearnSpell(KNOCKBACK_SPELL)
PlayerA:SetScale(1)
PlayerA:SetPlayerSpeed(7)
PlayerA:Teleport(two_map, two_x, two_y, two_z)
if EVENT_GUY ~= nil then
if name ~= nil then
EVENT_GUY:SendChatMessage(14,0,"The event has just been won by "..name.."!")
end
end
PlayerA = nil
PlayerB = nil
EVENT_GUY:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
else
print("Player is not PlayerA")
if player == PlayerB then
print("Player is PlayerB")
if PlayerA ~= nil then
PlayerA:UnlearnSpell(KNOCKBACK_SPELL)
PlayerA:SetScale(1)
PlayerA:SetPlayerSpeed(7)
PlayerA:Teleport(two_map, two_x, two_y, two_z)
if EVENT_GUY ~= nil then
local name = PlayerA:GetName()
EVENT_GUY:SendChatMessage(14,0,"The event has just been won by "..name.."!")
end
print("Teleporting player B out!")
PlayerB:UnlearnSpell(KNOCKBACK_SPELL)
PlayerB:SetScale(1)
PlayerB:SetPlayerSpeed(7)
PlayerB:Teleport(two_map, two_x, two_y, two_z)
PlayerA = nil
PlayerB = nil
if EVENT_GUY ~= nil then
EVENT_GUY:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
else
print("Teleporting player B out!")
PlayerB:UnlearnSpell(KNOCKBACK_SPELL)
PlayerB:SetScale(1)
PlayerB:SetPlayerSpeed(7)
PlayerB:Teleport(two_map, two_x, two_y, two_z)
PlayerA = nil
PlayerB = nil
if EVENT_GUY ~= nil then
EVENT_GUY:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
end
end
end
print("gossip complete")
player:GossipComplete()]]
if PlayerA ~= nil then
PlayerA:UnlearnSpell(KNOCKBACK_SPELL)
PlayerA:SetScale(1)
PlayerA:SetPlayerSpeed(7)
PlayerA:Teleport(two_map, two_x, two_y, two_z)
if PlayerA == player then
if EVENT_GUY ~= nil and PlayerB ~= nil then
local name = PlayerB:GetName()
EVENT_GUY:SendChatMessage(42,0,"The event has just been won by "..name.."!")
end
end
end
if PlayerB ~= nil then
if PlayerB == player then
if EVENT_GUY ~= nil and PlayerA ~= nil then
local name = PlayerA:GetName()
EVENT_GUY:SendChatMessage(42,0,"The event has just been won by "..name.."!")
end
end
end
PlayerB:UnlearnSpell(KNOCKBACK_SPELL)
PlayerB:SetScale(1)
PlayerB:SetPlayerSpeed(7)
PlayerB:Teleport(two_map, two_x, two_y, two_z)
PlayerB = nil
PlayerA = nil
if EVENT_GUY ~= nil then
EVENT_GUY:RegisterEvent("zzz_CHECK_PLAYERS_TEHE", 5000, 0)
end
player:GossipComplete()
end
if(intid == 3) then
player:GossipComplete()
end
end
RegisterUnitGossipEvent(NPC_ENDER, 1, "zzzz_Random_Event_OnGossip")
RegisterUnitGossipEvent(NPC_ENDER, 2, "zzzz_Random_Event_Submenus")
--- The Spell System -----------------------------------------------------------------------------------------------
--[[function KNOCKBACK_spell_CAST(effectIndex, Spell)
local Caster = Spell:GetCaster()
if Caster == PlayerA or PlayerB then
Spell:Cast(1) -- FullCastSpell
else
local plr = Spell:GetCaster()
if plr ~= nil then
plr:SendBroadcastMessage("You are not in the event!")
plr:SendAreaTriggerMessage("You are not in the event!")
end
Spell:Cancel() -- Were not in the event
end
end
RegisterDummySpell(KNOCKBACK_SPELL, "KNOCKBACK_spell_CAST")]] -- Not needed
--------------------------------------------------------------------------------------------------------------------
But it's a terrible, terrible script with no collision. Which means you can only have 1 at once.