I need some Lua help, menu

User Tag List

Results 1 to 12 of 12
  1. #1
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I need some Lua help,

    Hello, i am trying to make a Skill NPC (As i stated in my earlier thread) but i have now ran into a new difficulty, i am trying to make it so it checks the class and race but the Race bit is giving a error, Here is the script:

    Code:
        function NPC_main_menu(pUnit, player)
           pUnit:GossipCreateMenu(3543, player, 0)
           pUnit:GossipMenuAddItem(0, "Welcome to Blahblah's Custom Trainer", 1, 0)
           pUnit:GossipMenuAddItem(0, "I am here to train you ur missing spells.", 2, 0)
           pUnit:GossipMenuAddItem(3, "Hunter", 3, 0)
           pUnit:GossipMenuAddItem(3, "Warlock", 4, 0)
           pUnit:GossipMenuAddItem(3, "Warrior", 5, 0)  
           pUnit:GossipMenuAddItem(3, "Paladin", 6, 0) 
           pUnit:GossipSendMenu(player)
        end
    
        function SkillNPC_on_gossip_talk(pUnit, event, player)
           NPC_main_menu(pUnit, player)
        end
    
        function SkillNPC_on_gossip_select(pUnit, event, player, id, intid, code, pMisc)
        local pclass = player:GetPlayerClass()
            local race = player:GetPlayerRace()
        if(intid == 3) then
        if( pclass == 3 ) then
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Hello, this is the Hunter Training Area, Please click one of the following spells to learn them.", 100, 0)
         pUnit:GossipMenuAddItem(3, "Pet Skills", 10, 0)
         pUnit:GossipMenuAddItem(3, "Arcane Shot", 11, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        else
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Sorry but you are not a Hunter, You cannot use this Area", 100, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        end
        end
    
        if(intid == 4) then
        if ( pclass == 9) then
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Hello, this is the Warlock Training Area, Please click one of the following spells to learn them.", 100, 0)
         pUnit:GossipMenuAddItem(3, "Give me my Pets Please", 12, 0)
         pUnit:GossipSendMenu(player)
        else
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Sorry but you are not a Warlock, You cannot use this Area", 100, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        end
        end
    
        if(intid == 5) then
        if ( pclass == 1) then
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Hello, this is the Warrior Training Area, Please click one of the following spells to learn them.", 100, 0)
         pUnit:GossipMenuAddItem(3, "Defensive Stance", 13, 0)
         pUnit:GossipMenuAddItem(3, "Berserker Stance", 14, 0)
         pUnit:GossipSendMenu(player)
        else
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Sorry but you are not a Warrior, You cannot use this Area", 100, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        end
        end
    
        if(intid == 6) then
        if ( pclass == 2) then
        if race==1 or race==3 or race==4 or race==7 or race==11 then
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Hello, this is the Alliance Paladin Training Area, Please click one of the following spells to learn them.", 100, 0)
         pUnit:GossipMenuAddItem(3, "Seal of Vengeance", 15, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        else if ( pclass == 2) then
        if race==2 or race==5 or race==6 or race==116 or race==1610 then
         pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Hello, this is the Horde Paladin Training Area, Please click one of the following spells to learn them.", 100, 0)
         pUnit:GossipMenuAddItem(3, "Seal of Blood", 16, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        else if ( pclass == 1 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 11) then
          pUnit:GossipCreateMenu(3543, player, 0)
         pUnit:GossipMenuAddItem(4, "Sorry but you are not a Paladin, You cannot use this Area", 100, 0)
         pUnit:GossipMenuAddItem(0, "Back", 100, 0)
         pUnit:GossipSendMenu(player)
        end
        end
        end
        end
        end
        
        if ( pclass == 3 ) then
        if(intid == 10) then
         player:LearnSpell(883)     
         player:LearnSpell(2641)
         player:LearnSpell(6991)
         player:LearnSpell(982)
         player:LearnSpell(1515)
         player:LearnSpell(5149)
        end
        end
    
        if ( pclass == 3 ) then
        if(intid == 11) then
         player:LearnSpell(27019)
        end
        end
    
        if ( pclass == 9 ) then
        if(intid == 12) then
         player:LearnSpell(691)
         player:LearnSpell(688)
         player:LearnSpell(712)
         player:LearnSpell(697)
        end
        end
    
        if(intid == 15) then
         player:LearnSpell(31081)
        end
    
        if(intid == 16) then
         player:LearnSpell(31892)
        end
    
        if(intid == 100) then
            pUnit:GossipCreateMenu(3543, player, 0)
           pUnit:GossipMenuAddItem(0, "Welcome to Blahblah's Custom Trainer", 1, 0)
           pUnit:GossipMenuAddItem(0, "I am here to train you ur missing spells.", 2, 0)
           pUnit:GossipMenuAddItem(3, "Hunter", 3, 0)
           pUnit:GossipMenuAddItem(3, "Warlock", 4, 0) 
           pUnit:GossipMenuAddItem(3, "Warrior", 5, 0)  
           pUnit:GossipMenuAddItem(3, "Paladin", 6, 0) 
           pUnit:GossipSendMenu(player)
        end
        end
        end
    
    RegisterUnitGossipEvent(59996, 1, "SkillNPC_on_gossip_talk") 
    RegisterUnitGossipEvent(59996, 2, "SkillNPC_on_gossip_select")
    Here is the line: local race = player:GetPlayerRace()
    It is saying:

    scripts\Spell Trainer.lua:18: attempt to call method 'GetPlayerRace' (a
    nil value)
    scripts\Spell Trainer.lua:18: attempt to call method 'GetPlayerRace' (a
    nil value)

    I need some Lua help,
  2. #2
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone? {Filler}

  3. #3
    jinktreek's Avatar Member
    Reputation
    8
    Join Date
    Sep 2008
    Posts
    109
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont think LUA can handle classes... but I could be wrong. When attempted to do something like this, any class was able to learn any of the avaliable skills
    EDIT: Lua cant handle races but can handle classes
    Last edited by jinktreek; 12-24-2008 at 01:50 PM.

  4. #4
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Classes is not a problem, its the Race part, it wont work

  5. #5
    jinktreek's Avatar Member
    Reputation
    8
    Join Date
    Sep 2008
    Posts
    109
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i meant races* sorry for the typo

  6. #6
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, ive seen it in portals and in many scripts, but i guess it isnt supported for Players?

  7. #7
    jinktreek's Avatar Member
    Reputation
    8
    Join Date
    Sep 2008
    Posts
    109
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, ive seen it in portals and in many scripts, but i guess it isnt supported for Players?
    Yes, I believe that is a correct statement.

  8. #8
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, maybe a pro coder could help me out

  9. #9
    jinktreek's Avatar Member
    Reputation
    8
    Join Date
    Sep 2008
    Posts
    109
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol... yeah, youd need to use C++ for this

  10. #10
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You never know, you might be able to do it in .lua

  11. #11
    jinktreek's Avatar Member
    Reputation
    8
    Join Date
    Sep 2008
    Posts
    109
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, itll definately be possible in the future, but right now ARCEMU doesnt support races with LUA

  12. #12
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dammit oh well

Similar Threads

  1. [Lua Script] Need some Lua help =P
    By tyeeeee1 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 07-21-2012, 01:35 PM
  2. Making an addon, need some LUA help
    By gryphons53 in forum WoW UI, Macros and Talent Specs
    Replies: 1
    Last Post: 12-30-2009, 02:39 AM
  3. I need some Lua help please. Great concept.
    By TripZone in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 08-01-2009, 02:01 PM
  4. Need some LUA help!
    By grothar1993 in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 04-18-2009, 07:36 AM
  5. i need some lua help please
    By runiker in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 02-29-2008, 07:49 AM
All times are GMT -5. The time now is 11:36 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