LUA Script Error, Help would be appreciated! menu

User Tag List

Results 1 to 6 of 6
  1. #1
    pachuco55's Avatar Member
    Reputation
    12
    Join Date
    Mar 2008
    Posts
    75
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA Script Error, Help would be appreciated!

    So first here's my script:

    Code:
    function Keleth_Announce (Unit, Event)
        Unit:SendChatMessage(11, 0, "It seems that some classes are missing spells... Click on me to get them!")
    end
    
    function Keleth_MainMenu (Unit, Player)
        Unit:GossipCreateMenu(99970, Player)
        Unit:GossipMenuAddItem(Player, 3, "Teach me my spells!", 1, 0)
        Unit:GossipSendMenu(Player)
    end
    
    function Keleth_OnGossipSelect (Unit, event, Player, id, intid, code)
    --[[    Classes
        WARRIOR = 1,
        PALADIN = 2,
        HUNTER = 3,
        ROGUE = 4,
        PRIEST = 5,
        SHAMAN = 7,
        MAGE = 8,
        WARLOCK = 9,
        DRUID = 11,
    ]]--
        local pc = Player:GetPlayerClass()
        if(pc == 11) then --Druid
            Player:LearnSpell(9634) --Dire Bear Form
            Player:LearnSpell(40120) --Swift Flight Form
            Player:LearnSpell(26996) --Maul (Rank 8)
            Player:LearnSpell(33745) --Lacerate (Rank 1)
            Player:LearnSpell(26999) --Frenzied Regeneration (Rank 4)
            Player:LearnSpell(26997) --Swipe (Rank 6)
            Player:LearnSpell(26998) --Demoralizing Roar (Rank 6)
            Player:LearnSpell(8983) --Bash (Rank 3)
            Player:LearnSpell(1066) --Aquatic Form
        elseif(pc == 3) then --Hunter
            Player:LearnSpell(5149) --Beast Training
            Player:LearnSpell(883) --Call Pet
            Player:LearnSpell(2641) --Dismiss Pet
            Player:LearnSpell(6991) --Feed Pet
            Player:LearnSpell(982) --Revive Pet
            Player:LearnSpell(1515) --Tame Beast
        elseif(pc == 2) then --Paladin
            Player:LearnSpell(20773) --Redemption (Rank 5)
            Player:LearnSpell(34767) --Summon Charger (Horde)
            Player:LearnSpell(23214) --Summon Charger (Ally)
        elseif(pc == 9) then --Warlock
            Player:LearnSpell(688) --Summon Imp
            Player:LearnSpell(697) --Summon Voidwalker
            Player:LearnSpell(712) --Summon Succubus
            Player:LearnSpell(691) --Summon Felhunter
            Player:LearnSpell(23161) --Summon Dreadsteed
        elseif(pc == 1) then --Warrior
            Player:LearnSpell(2458) --Berserker Stance
            Player:LearnSpell(355) --Taunt
            Player:LearnSpell(25275) --Intercept (Rank 5)
            Player:LearnSpell(71) --Defensive Stance
        elseif(pc == 8) then --Mage
            Player:LearnSpell(45438) --Ice Block
        else
            Unit:SendChatMessage(11, 0, "I have no spells to teach you.")
        end
        Player:GossipComplete()
    end
    
    function Keleth_OnSpawn(Unit, Event)
        Unit:RegisterEvent("Keleth_Announce", 180000, 0)
    end
    
    RegisterUnitEvent(100000, 6, "Keleth_OnSpawn")
    RegisterGossipEvent(100000, 1, "Keleth_MainMenu")
    RegisterGossipEvent(100000, 2, "Keleth_OnGossipSelect")

    And here is the error:


    Code:
    scriptsmissing_spells_trainer.lua:6: bad argument #1 to 'GossipCreateMenu' (Unit expected, got number)
    Anyone know? +Rep for help!

    LUA Script Error, Help would be appreciated!
  2. #2
    newfang's Avatar Master Sergeant
    Reputation
    19
    Join Date
    Oct 2007
    Posts
    103
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    =/ what happens if you just delete that one part?

    Unit:GossipCreateMenu(99970, Player)

  3. #3
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unit:GossipCreateMenu(99970, Player)

    First argument should be a unit, not a num.

  4. #4
    pachuco55's Avatar Member
    Reputation
    12
    Join Date
    Mar 2008
    Posts
    75
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by TheSpidey View Post
    Unit:GossipCreateMenu(99970, Player)

    First argument should be a unit, not a num.
    I think I got that from the error. Look, I don't have much of a scripting background, so I don't really understand why it says this. The number there is just the gossip menu id.

    Removing it wouldn't be good because you need to create the menu before you can add items to it...

    Anyone have a solution to this, and not just a paraphrase of the error?

  5. #5
    kajdzas's Avatar Corporal
    Reputation
    2
    Join Date
    Mar 2008
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function On_Gossip (pUnit, event, player)
    pUnit:GossipCreateMenu(100, player)
    pUnit:GossipGossipMenuAddItem(player, 0, "Horde Cities", 1, 0)
    pUnit:GossipSendMenu(player)
    end
    function Gossip_Submenus (pUnit, event, player, id, intid, code)
    if(intid == 1) then
    pUnit:GossipGossipMenuAddItem(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Orgrimmar", 10, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:GossipSendMenu(player)
    end
    if(intid == 10) then
    player:Teleport(1, 1371.068970, -4370.801758, 26.052483)
    end
    intid = 0
    end
    RegisterGossipEvent(1111117 , 7, "On_Gossip")(1111117 , 7,"Gossip_Submenus")
    it's not a full script, only orgrimmar but when i turn on ascent-world.exe i got something like error:
    LuaEngine: teleporter.lua...
    failed. <could not run>
    script/teleporter.lua:22: attempt to call global 'RegisterGossipEvent' <a nil value>
    pls help and i give u +rep if it will be ok xD
    Last edited by kajdzas; 06-20-2008 at 11:34 AM.

  6. #6
    Maven01's Avatar Active Member
    Reputation
    23
    Join Date
    Nov 2007
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isn't it RegisterUnitGossipEvent?

    Here is an example of a script I wrote..

    Code:
    function NPC_main_menu(pUnit, player)
    pUnit:GossipCreateMenu(3543, player, 0)
    pUnit:GossipMenuAddItem(0, "Notable Gear Vendors", 0, 0) 
    pUnit:GossipMenuAddItem(0, "Other Gear Vendors", 1, 0)
    pUnit:GossipMenuAddItem(0, "Misc. Vendors", 2, 0)
    pUnit:GossipMenuAddItem(0, "Reagent Vendors", 3, 0)
    pUnit:GossipMenuAddItem(0, "Recipe Vendors", 4, 0)
    pUnit:GossipMenuAddItem(0, "Class Trainers", 5, 0)
    pUnit:GossipMenuAddItem(0, "Battlemasters", 6, 0)
    pUnit:GossipSendMenu(player)
    end
    
    function NPC_on_gossip_talk(pUnit, event, player)
    NPC_main_menu(pUnit, player)
    end
    
    function NPC_on_gossip_select(pUnit, event, player, id, intid, code)
    if(intid == 0) then
    --Stuff goes here....
    end
    end
    
    
    
    RegisterUnitGossipEvent(99999, 1, "NPC_on_gossip_talk")
    RegisterUnitGossipEvent(99999, 2, "NPC_on_gossip_select")
    and it works perfectly with my ArcEmu version

Similar Threads

  1. [Question] Need help with Lua Script error
    By Rempage in forum WoW Bots Questions & Requests
    Replies: 0
    Last Post: 11-12-2016, 08:06 PM
  2. [Lua] lua script errors - HELP
    By singoe in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 04-28-2010, 07:42 AM
  3. Boss Lua Script Need help
    By David2222 in forum World of Warcraft General
    Replies: 0
    Last Post: 01-25-2009, 04:22 PM
  4. LUA script error :(
    By lilbdiablo12 in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 10-29-2008, 07:45 PM
  5. [Help me] Lua script error? please help.
    By Szharz in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-22-2008, 12:20 PM
All times are GMT -5. The time now is 09:15 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