Me and my friends with our server came up with the idea to have a leveling npc for donation items. Our site had a donation ability to gain a level token or to start with one. It was much rather easy than to edit ExtendedItemCosts.dbc. Well on with my guide.
----------------------------------------------------------------------
I will be using the template we used for our leveling npc. This guide does not show you how to trade the item. I will make another guide for that later. And Ill add a link.
----------------------------------------------------------------------
Red = What needs to be changed.
Yellow = Information
White = Does not need to be changed/modified
function Leveler_OnTalk(pUnit, event, player)
LevelerMenu(pUnit, player)
end
These are function names. These can be changed or can stay the same, your choice.
local npcid = npcid here!
function LevelerMenu(pUnit, player)
pUnit:GossipCreateMenu(3544, player, 0)
pUnit:GossipMenuAddItem(4, "19 Twink", 100, 0)
pUnit:GossipMenuAddItem(4, "29 Twink", 101, 0)
pUnit:GossipMenuAddItem(4, "39 Twink", 102, 0)
pUnit:GossipMenuAddItem(4, "49 Twink", 103, 0)
pUnit:GossipMenuAddItem(4, "59 Twink", 104, 0)
pUnit:GossipSendMenu(player)
end
3544 = This is the menu ID this number must change on each menu. Like -1 the next menu if you put one would be 3543 and so on.
19 - 59 Twink = This is the menu name. Change it as you please.
100 - 104 = This is the submenu ID. 2 can not be the same or you will have a conflict. This number will be used later on.
This part I put here and I will brake down so you can understand.
function Leveler_OnSelect(pUnit, event, player, id, intid, code, pMisc)
if(intid == 100) then
pUnit:SendChatMessage(12, 0, "You have been granted level 19")
player:SetPlayerLevel(19)
end
if(intid == 101) then
pUnit:SendChatMessage(12, 0, "You have been granted level 29")
player:SetPlayerLevel(29)
end
if(intid == 102) then
pUnit:SendChatMessage(12, 0, "You have been granted level 39")
player:SetPlayerLevel(39)
end
if(intid == 103) then
pUnit:SendChatMessage(12, 0, "You have been granted level 49")
player:SetPlayerLevel(49)
end
if(intid == 104) then
pUnit:SendChatMessage(12, 0, "You have been granted level 59")
player:SetPlayerLevel(59)
end
100 - 104 Is the submenu id which i told you about early.
19 - 59 is the level that the player recieves when the npc is clicked.
You have been granted levvel ## is what the npc will say when the player has recieved the level.
Leveler_OnSelect is the name of the function.
end
this end is to end the function.
This is the last piece of the lua script.
RegisterUnitGossipEvent(npcid, 1, "Leveler_OnTalk")
RegisterUnitGossipEvent(npcid, 2, "Leveler_OnSelect")
These are the function names like I said earlyer. Now this last piece is it put all together.
function Leveler_OnTalk(pUnit, event, player)
LevelerMenu(pUnit, player)
end
local npcid = npcid here!
function LevelerMenu(pUnit, player)
pUnit:GossipCreateMenu(3544, player, 0)
pUnit:GossipMenuAddItem(4, "19 Twink", 100, 0)
pUnit:GossipMenuAddItem(4, "29 Twink", 101, 0)
pUnit:GossipMenuAddItem(4, "39 Twink", 102, 0)
pUnit:GossipMenuAddItem(4, "49 Twink", 103, 0)
pUnit:GossipMenuAddItem(4, "59 Twink", 104, 0)
pUnit:GossipSendMenu(player)
end
function Leveler_OnSelect(pUnit, event, player, id, intid, code, pMisc)
if(intid == 100) then
pUnit:SendChatMessage(12, 0, "You have been granted level 19")
player:SetPlayerLevel(19)
end
if(intid == 101) then
pUnit:SendChatMessage(12, 0, "You have been granted level 29")
player:SetPlayerLevel(29)
end
if(intid == 102) then
pUnit:SendChatMessage(12, 0, "You have been granted level 39")
player:SetPlayerLevel(39)
end
if(intid == 103) then
pUnit:SendChatMessage(12, 0, "You have been granted level 49")
player:SetPlayerLevel(49)
end
if(intid == 104) then
pUnit:SendChatMessage(12, 0, "You have been granted level 59")
player:SetPlayerLevel(59)
end
end
RegisterUnitGossipEvent(npcid, 1, "Leveler_OnTalk")
RegisterUnitGossipEvent(npcid, 2, "Leveler_OnSelect")
If you do not feel like making your own script then or to lazy :P send me an email at [email protected] and ill try to to send you back the script as soon as i can.