[Lua] Error while injecting menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Nilrac's Avatar Banned
    Reputation
    360
    Join Date
    Nov 2007
    Posts
    762
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Error while injecting

    Making a Lua script and I have ran into an error
    Here it is

    input:19: attempt to call global 'RegisterUnitGossipEvent' (a nil value)
    Here is the part that is causing the error, I cant tell whats wrong with it

    function Npc_OnGossip(pUnit, event, player)
    pUnit:GossipCreateMenu(50, player, 0)
    pUnit:GossipMenuAddItem(6, "Sometexthere", 1, 0)
    pUnit:GossipMenuAddItem(6, "Sometexthere", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    function Npc_OnGossipSelect(pUnit, event, player, id, intid)
    if (intid == 1) then
    player:SendBroadcastMessage("Sometexthere")
    pUnit:CastSpell(38627)
    pUnit:GossipComplete(player)
    end
    if (intid == 2) then
    pUnit:GossipComplete(player)
    player:SendBroadcastMessage("Sometexthere")
    end
    end

    RegisterUnitGossipEvent(npcid, 1, "Npc_OnGossip")
    RegisterUnitGossipEvent(npcid, 2, "Npc_OnGossipSelect")
    Last edited by Nilrac; 03-22-2009 at 09:47 PM.

    [Lua] Error while injecting
  2. #2
    Herleybob's Avatar Contributor
    Reputation
    178
    Join Date
    Jul 2007
    Posts
    663
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function Npc_OnGossip(pUnit, event,)

    change it to

    function Npc_OnGossip(pUnit, event)

    Nom Nom Nom :P

  3. #3
    Nilrac's Avatar Banned
    Reputation
    360
    Join Date
    Nov 2007
    Posts
    762
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for spotting that error, but it still gives me

    "input:19: attempt to call global 'RegisterUnitGossipEvent' (a nil value)"

    Even after fixing that

  4. #4
    Herleybob's Avatar Contributor
    Reputation
    178
    Join Date
    Jul 2007
    Posts
    663
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try changing this:

    function Npc_OnGossip(pUnit, event,)

    to

    function Npc_OnGossip(pUnit, event, player)

    You need someone to send menu too.

    Nom Nom Nom :P

  5. #5
    Nilrac's Avatar Banned
    Reputation
    360
    Join Date
    Nov 2007
    Posts
    762
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope... same error message

  6. #6
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    The error is saying line 19 You have npcid, it doesn't know what that is. (Also it does actually saying trying to register it? 0_0). After filling that in or defining it, and if that doesn't work remove the npc_ before each event bit and try.

  7. #7
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    If you need this sort of script, i made one and tested it on ArcEmu rev. 2310.

    It's nearly the same, but maybe it works for you:

    Code:
    function NPC_OnGossip(Unit, Event, player)
    Unit:GossipCreateMenu(100, player, 0)
    Unit:GossipMenuAddItem(6, "CHOOSE 1", 1, 0)
    Unit:GossipMenuAddItem(6, "CHOOSE 2", 2, 0)
    Unit:GossipSendMenu(player)
    end
    
    function NPC_OnSelect(Unit, Event, player, MenuId, id, Code)
    if (id == 1) then
    player:SendBroadcastMessage("YOU CHOOSE 1")
    Unit:CastSpell(38627)
    Unit:GossipComplete(player)
    end
    if (id == 2) then
    player:SendBroadcastMessage("YOU CHOOSE 2")
    Unit:GossipComplete(player)
    end
    end
    
    RegisterUnitGossipEvent(Yournpcid, 1, "NPC_OnGossip")
    RegisterUnitGossipEvent(Yournpcid, 2, "NPC_OnSelect")

  8. #8
    Evilbuffy's Avatar Member
    Reputation
    38
    Join Date
    Mar 2009
    Posts
    185
    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(50, player, 0)
    pUnit:GossipMenuAddItem(6, "Sometexthere", 1, 0)
    pUnit:GossipMenuAddItem(6, "Sometexthere", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    function On_GossipSelect(pUnit, event, player, id, intid)
    if (intid == 1) then
    player:SendBroadcastMessage("Sometexthere")
    pUnit:CastSpell(38627)
    pUnit:GossipComplete(player)
    end
    if (intid == 2) then
    pUnit:GossipComplete(player)
    player:SendBroadcastMessage("Sometexthere")
    end
    end

    RegisterUnitGossipEvent(NPCID , 1, "On_Gossip")
    RegisterUnitGossipEvent(NPCID , 2, "On_GossipSelect")
    Try it now.. You don't need to have "Npc_OnGossip" it's supposed to be like this "On_Gossip".

    Hope it works for you. Just remember to change "NPCID" to the same ID in your SQL script, which is your Entry ID. They need to be the same, else the SQL and LUA will not be able to co-work.


    -Buffy

Similar Threads

  1. [Lua] Error
    By ~ViVo~ in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-15-2008, 11:15 AM
  2. [Errorz] A Lua Error I Havent seen before
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-14-2008, 10:12 AM
  3. Error while using Chrispees repack
    By DarthFly in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 11-25-2007, 09:13 PM
  4. Wow Error While installing the updates
    By PolitisktNamn in forum World of Warcraft General
    Replies: 1
    Last Post: 11-20-2007, 10:51 AM
  5. "Error while oppening the proccess"
    By foxfire60 in forum World of Warcraft General
    Replies: 1
    Last Post: 02-12-2007, 06:21 PM
All times are GMT -5. The time now is 12:10 PM. 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