Hey guys,
I made a simple gossip script that when you select the Enter Arena option in the gossip menu it teleports you to the arena.
But, i want the script to first check if there is an npc entry id at a certain point or area or even is spawned, and if that npc is spawned then it teleports you. If the npc is NOT spawned, it will send a message: "I'm sorry, there are already players inside." I know its possible, i just forgot the commands and cant find em anymore. Anyone knows the "if" lua command or knows how to do it?
Help is greatly appreciated.
Code:
local Teleporter_ID = 104144.
function Register_OnTalk(Unit, Event, Player)
Unit:GossipCreateMenu(100, player, 0)
Unit:GossipMenuAddItem(0, "Enter Arena.", 1, 0)
Unit:GossipMenuAddItem(0, "Nevermind. 2, 0)
Unit:GossipSendMenu(player)
end
function Register_OnSelect(Unit, Event, player, id, intid, code, pMisc)
if (intid == 1) then
player:SendBroadcastMessage("Have fun.")
player:Teleport(0, -10884.901367, 1514.177002, 91.469772)
Unit:GossipComplete()
end
if (intid == 2) then
Unit:GossipComplete()
end
end
RegisterUnitGossipEvent(Teleporter_ID, 1, "Register_OnTalk")
RegisterUnitGossipEvent(Teleporter_ID, 2, "Register_OnSelect")
EDIT: I'm using an arcemu 2.4.3 server. Hope someone can help