wave :wave:
Well hello there again! This time i have a Lua++ (i think you need ++ but not 100% sure) teleporter npc that doesn't teleport you to the capital cities...
It teleports you to fun locations like the top of ironforge! (rumoured to be highest point in the game you can get to on retail )
Credits go to stoneharry/salamanda, universal-wow for using there layout, and finnaly the people who developed the repack i used to test the script on
Now for some screanshots!!!
Now for the script it's self!!!
Code:
local menunum = 33310
local menuicon = 4
local teleicon = 2
local menu =
{
{"Random Places",
{
{"Worst Place Ever", 13, 0, 0, 0},
{"Top of the world!", 0, -4794, -1002, 898},
{"oh no... It's Hell!", 0, -6425, -1398, 142},
{"A huge cave!", 1, -10653, 2095, -43},
{"Why am I here again?", 1, -8159, -489, 5},
{"Hot Springs... ", 1, -7192, -645, -236},
}
},
{"Boxes?!?!",
{
{"Small Box", 13, 0, 0, 0},
{"Medium Box", 13, 0, 0, -140},
{"Huge Box", 13, 0, 0, -400},
}
},
{"Do not press here.",
{
{"You were Warned", 1, -5000, 5000, 1000000},
{"I told you not to press here", 1, -5000, 5000, 1000000},
{"Touch this you die", 1, -5000, 5000, 1000000},
}
},
}
function TeleNPC_MainMenu(Unit, Player)
local i = 0
Unit:GossipCreateMenu(menunum, Player, 0)
for k,v in pairs(menu) do
i = i + 1
if type(v[2]) == "table" then
Unit:GossipMenuAddItem(menuicon, v[1], i, 0)
i = i + #(v[2])
else
Unit:GossipMenuAddItem(teleicon, v[1], i, 0)
end
end
Unit:GossipSendMenu(Player)
end
function TeleNPC_SubMenu(Unit, Player, i, Submenu)
Unit:GossipCreateMenu(menunum-i, Player, 0)
Unit:GossipMenuAddItem(7, "<--Back", 0, 0)
for k,v in pairs(Submenu) do
i = i + 1
Unit:GossipMenuAddItem(teleicon, v[1], i, 0)
end
Unit:GossipSendMenu(Player)
end
function TeleNPC_OnGossipTalk(Unit, Event, Player)
TeleNPC_MainMenu(Unit, Player)
end
function TeleNPC_OnGossipSelect(Unit, Event, Player, MenuId, Id, Code)
local i = 0
if(Id == 0) then
TeleNPC_MainMenu(Unit,Player)
else
for k,v in pairs(menu) do
i = i + 1
if (Id == i) then
if type(v[2]) == "table" then
TeleNPC_SubMenu(Unit, Player, i, v[2])
else
if Player:IsInCombat() then
Unit:SendChatMessage(12, 0, "You can't teleport while in combat!")
else
Player:Teleport(v[2], v[3], v[4], v[5])
end
Unit:GossipComplete(Player)
end
return
elseif (type(v[2]) == "table") then
for j,w in pairs(v[2]) do
i = i + 1
if (Id == i) then
if Player:IsInCombat() then
Unit:SendChatMessage(12, 0, "You can't teleport while in combat!")
else
Player:Teleport(w[2], w[3], w[4], w[5])
end
Unit:GossipComplete(Player)
return
end
end
end
end
end
end
RegisterUnitGossipEvent(50, 1, "TeleNPC_OnGossipTalk")
RegisterUnitGossipEvent(50, 2, "TeleNPC_OnGossipSelect")
And the sql for those people who want it! If you want to make your own npc then use the id 50 or change it in the Lua script. When ingame go to where you want the teleporter npc and type ".npc spawn 50"
Code:
insert into `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `mountdisplayid`, `equipmodel1`, `equipinfo1`, `equipslot1`, `equipmodel2`, `equipinfo2`, `equipslot2`, `equipmodel3`, `equipinfo3`, `equipslot3`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `death_state`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`) values('50','72','72','35','100','100','0','3','1','1500','0','666','3662','0','0','0','0','0','0','0','0','0','0','0','0','0','360000','0','0','0','0','0','0','0','1','0','0','1','0','0','0','2.5','8','14','0','0','0','0','0','0');
insert into `creature_names` (`entry`, `name`, `subname`, `info_str`, `Flags1`, `type`, `family`, `rank`, `unk4`, `spelldataid`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `civilian`, `leader`) values('50','Salamanda\'s Hell Boy','','','0','7','0','1','0',NULL,'10992','0','0','0','1','1','0',NULL);
Goodbye!!! Feedback is much appreciated including how i can improve!