Error with a level npc.lua menu

User Tag List

Results 1 to 11 of 11
  1. #1
    _DEFiANT's Avatar Member
    Reputation
    44
    Join Date
    Aug 2008
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error with a level npc.lua

    I am trying to write a level npc and I have gotten a few errors, and managed to fix a few of them. But since this is my first time dealing with a level npc, I found an error that I am not sure what to do. (NOTE: A level NPC is an NPC that you talk to, gives you a list of levels, and you can select one of those levels to become that level)

    I get the following error...
    Code:
                  scripts\level_npc.lua:33: attempt to call method 'SetPlayerLevel' <a nil value>
    I'm still in the learning process of LUA. But I am guessing that is an incorrect function name?

    Either way. Here is the script..

    Code:
    local npcid = 70011
    
    function NPC_main_menu(unit, player)
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Level 19", 1, 0)
    unit:GossipMenuAddItem(3, "Level 29", 2, 0)
    unit:GossipMenuAddItem(3, "Level 39", 3, 0)
    unit:GossipMenuAddItem(3, "Level 49", 4, 0)
    unit:GossipMenuAddItem(3, "Level 59", 5, 0)
    unit:GossipMenuAddItem(3, "Level 60", 6, 0)
    unit:GossipMenuAddItem(3, "Level 69", 7, 0)
    unit:GossipMenuAddItem(3, "Level 70", 8, 0)
    unit:GossipSendMenu(player)
    end
    
    function NPC_on_gossip_talk(Unit, event, player)
        NPC_main_menu(Unit, player)
    end 
    
    function NPC_on_gossip_select(pUnit, event, player, id, intid, code, pMisc)
     if(intid == 1) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(19)
     player:GossipComplete()
     end
     if(intid == 2) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(29)
     player:GossipComplete()
     end
     if(intid == 3) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(39)
     player:GossipComplete()
     end
     if(intid == 4) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(49)
     player:GossipComplete()
     end
     if(intid == 5) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(59)
     player:GossipComplete()
     end
     if(intid == 6) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(60)
     player:GossipComplete()
     end
     if(intid == 7) then 
     pUnit:SendChatMessage(12, 0, "Enjoy!")
     player:SetPlayerLevel(70)
     player:GossipComplete()
     end
    end
    
    RegisterUnitGossipEvent(70011, 1, "NPC_on_gossip_talk") 
    RegisterUnitGossipEvent(70011, 2, "NPC_on_gossip_select")
    1 lucky LUA expert who can figure out how to fix this gets the +rep cookie (I'm serious. I actually took the time to make a picture of a cookie that says +rep)

    Need help? add me on MSN - [email protected]
    Have questions? email me - [email protected]

    Error with a level npc.lua
  2. #2
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think its because you got 2 ends. Im not a pro at LUA

    if(intid == 7) then
    pUnit:SendChatMessage(12, 0, "Enjoy!")
    player:SetPlayerLevel(70)
    player:GossipComplete()
    end
    end

    RegisterUnitGossipEvent(70011, 1, "NPC_on_gossip_talk")
    RegisterUnitGossipEvent(70011, 2, "NPC_on_gossip_select")



  3. #3
    _DEFiANT's Avatar Member
    Reputation
    44
    Join Date
    Aug 2008
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by RyeRye View Post
    I think its because you got 2 ends. Im not a pro at LUA
    Nope. I know there is supposed to be 2 ends at the end of everything. That's not even part of the error

    the error is saying something is wrong with the function 'SetPlayerLevel'

    Need help? add me on MSN - [email protected]
    Have questions? email me - [email protected]

  4. #4
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I suck at LUA, Sorry, I tried to help



  5. #5
    _DEFiANT's Avatar Member
    Reputation
    44
    Join Date
    Aug 2008
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by RyeRye View Post
    Well, I suck at LUA, Sorry, I tried to help
    No problem, thanks for trying to help

    Need help? add me on MSN - [email protected]
    Have questions? email me - [email protected]

  6. #6
    shadowslayer133's Avatar Active Member
    Reputation
    61
    Join Date
    May 2008
    Posts
    313
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    instead of SetPlayerLevel try SetLevel

  7. #7
    _DEFiANT's Avatar Member
    Reputation
    44
    Join Date
    Aug 2008
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by shadowslayer133 View Post
    instead of SetPlayerLevel try SetLevel
    No errors starting up, but when I talk to her and click on the level, it says the same exact error, but "SetLevel"

    Alright, I have an idea that I am going to try. So people can continue to post their ideas, but I am going to try to update my LUA engine.


    Need help? add me on MSN - [email protected]
    Have questions? email me - [email protected]

  8. #8
    _DEFiANT's Avatar Member
    Reputation
    44
    Join Date
    Aug 2008
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright. I updated my LUA engine, and it still didn't work. Any more ideas?
    Last edited by _DEFiANT; 09-07-2008 at 09:32 PM.

    Need help? add me on MSN - [email protected]
    Have questions? email me - [email protected]

  9. #9
    Pimpin_N0ob's Avatar Active Member
    Reputation
    42
    Join Date
    Feb 2007
    Posts
    424
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm no expert on LUA but try:

    ModPlayerLevel
    ModLevel
    AddLevel

    I have no clue if these will work but it's worth a shot

  10. #10
    The [Bapes]'s Avatar Banned
    Reputation
    14
    Join Date
    Aug 2008
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Arc Emu doesn't have a level up function.

  11. #11
    _DEFiANT's Avatar Member
    Reputation
    44
    Join Date
    Aug 2008
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ooo... Darn. Alright, thanks guys.

    Need help? add me on MSN - [email protected]
    Have questions? email me - [email protected]

Similar Threads

  1. C++ Linking error with LUA
    By Master674 in forum Programming
    Replies: 2
    Last Post: 05-09-2012, 01:42 PM
  2. [Lua Script] Getting errors trying to load my lua npc
    By Darcvigilante in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 06-21-2010, 04:00 AM
  3. [Lua Guide] Level NPC
    By DarkFever in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 09-10-2009, 03:30 PM
  4. Needs Help with Warp Npc Lua
    By Lytle69 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 10-03-2008, 02:39 AM
  5. Ganking 60 n00bs (with a level 9)
    By Alkhara Majere in forum World of Warcraft Guides
    Replies: 16
    Last Post: 02-05-2007, 08:30 AM
All times are GMT -5. The time now is 09:53 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search