[Lua Guide] Level NPC menu

User Tag List

Results 1 to 5 of 5
  1. #1
    DarkFever's Avatar Contributor
    Reputation
    84
    Join Date
    Aug 2007
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua Guide] Level NPC

    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.


    [Lua Guide] Level NPC
  2. #2
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice guide could prove to really help +Rep x3

    Lua Gnerator - Generates lua to perform this

    No Virus Scan - you don't trust me then its your loss
    Last edited by mager1794; 08-20-2009 at 12:10 PM.
    Lunar Gaming - Reaching For The Stars

  3. #3
    Glorianglorre's Avatar Active Member
    Reputation
    40
    Join Date
    Feb 2009
    Posts
    340
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice guide dude! +Rep!

  4. #4
    DarkFever's Avatar Contributor
    Reputation
    84
    Join Date
    Aug 2007
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you i'm ill be making more lua guides soon! If anyone has an idea for me ill work on it. Just let me know.


  5. #5
    hiperhiv's Avatar Private
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice thanx alot !!!!

Similar Threads

  1. [Lua Guide] Morpher NPC
    By DarkFever in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 09-10-2009, 03:27 PM
  2. [Lua Guide] Teleport NPC
    By DarkFever in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 09-04-2009, 11:42 AM
  3. Error with a level npc.lua
    By _DEFiANT in forum WoW EMU Questions & Requests
    Replies: 10
    Last Post: 09-09-2008, 05:47 PM
  4. Priest guide - levels 20-60
    By Daxo in forum World of Warcraft Guides
    Replies: 8
    Last Post: 09-23-2007, 12:01 AM
  5. [Guide] Leveling Horde 1-60
    By Matt in forum World of Warcraft Guides
    Replies: 21
    Last Post: 02-03-2007, 03:51 AM
All times are GMT -5. The time now is 03:22 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search