Just got back into Lua and I have a problem... menu

User Tag List

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

    Just got back into Lua and I have a problem...

    Hey,

    As the title says I just got back into scripting Lua after about a year. I started off with a basic gossip NPC but it doesn't seem to be working, if someone could check over the script below and tell me what I've done wrong that would help.
    What is happening is that when I span and right click on the NPC in-game all I get is the usual "hello $N" message, there are no buttons or that in the menu.

    Code:
    local NPCID = 99999
    
    function On_Gossip(Unit, event, player)
    Unit:GossipCreateMenu(1, player, 0)
    Unit:GossipMenuAddItem(0, "Screw you Oxhorn.", 1, 0)
    Unit:GossipSendMenu(player)
    end
    
    function SubMenu_Gossip(Unit, event, player, id, intid, code)
    if (intid == 1) then
    Unit:SendChatMessage(12, 7, "**** off buddy, you don't want to fight with me.")
    Unit:GossipComplete()
    end
    end
    
    RegisterUnitGossipEvent(99999, 1, "On_Gossip")
    RegisterUnitGossipEvent(99999, 2, "SubMenu_Gossip")
    The NPCs entry ID is 99999 and I did select gossip when creating him on WoW-V.


    WhyDB rev.157 changeset.107
    Arcemu rev is in the latest as of yesterday
    (I compiled my own server for once =) )
    Last edited by tyeeeee1; 11-10-2011 at 09:36 AM.

    Just got back into Lua and I have a problem...
  2. #2
    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 script looks fine.

    The issue here is a small bug with Lua: You can't have only one menu item.

    If you change it to:

    Code:
    function testOn_Gossip(Unit, event, player)
    	Unit:GossipCreateMenu(1, player, 0)
    	Unit:GossipMenuAddItem(0, "Screw you Oxhorn.", 1, 0)
    	Unit:GossipMenuAddItem(0, "Nevermind.", 2, 0)
    	Unit:GossipSendMenu(player)
    end
    
    function testSubMenu_Gossip(Unit, event, player, id, intid, code)
    	if (intid == 1) then
    		Unit:SendChatMessage(12, 7, "**** off buddy, you don't want to fight with me.")
    	end
    	Unit:GossipComplete()
    end
    
    RegisterUnitGossipEvent(99999, 1, "testOn_Gossip")
    RegisterUnitGossipEvent(99999, 2, "testSubMenu_Gossip")
    It should work

    Using:
    Code:
    function testOn_Gossip(Unit, event, player)
    	Unit:GossipCreateMenu(1, player, 0)
    	Unit:GossipMenuAddItem(0, "Screw you Oxhorn.", 1, 0)
    	if (not Unit) then
    		Unit:GossipMenuAddItem(0, "[DEBUG BUTTON - WILL NOT SHOW]", 2, 0)
    	end
    	Unit:GossipSendMenu(player)
    end
    Sometimes works at displaying only one button, since the other button condition is never met but the code is loaded.

  3. #3
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, I think it might be a problem with the NPC now. I just changed my script and re-started the server (reloadscripts wont work =/ ) and he still says "Hey there, $N. How can I help you?

    Code:
    local NPCID = 99999
    
    function On_Gossip(Unit, event, player)
    Unit:GossipCreateMenu(1, player, 0)
    Unit:GossipMenuAddItem(0, "Screw you Oxhorn.", 1, 0)
    Unit:GossipMenuAddItem(0, "Nevermind.", 2, 0)
    Unit:GossipSendMenu(player)
    end
    
    function SubMenu_Gossip(Unit, event, player, id, intid, code)
    	if (intid == 1) then
    		Unit:SendChatMessage(12, 7, "**** off buddy, you don't want to fight with me.")
    	end
    	Unit:GossipComplete()
    end
    
    RegisterUnitGossipEvent(99999, 1, "On_Gossip")
    RegisterUnitGossipEvent(99999, 2, "SubMenu_Gossip")
    Would it be possible that Lua was disabled/not-installed on my server? When I first went to create a script I manually created the scripts folder in my ArcEmu folder. I'm thinking that maybe I messed up somewhere in the compiling process.

  4. #4
    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)
    You need to have the LuaEngine project enabled and then to make sure you copy it over into the correct folder.

    Cmake -> enable LuaEngine project.
    ArcEmu project -> compile -> run 'install' project.
    Run contents of output folder -> should display "X Lua scripts loaded" in console when it nears the end of server start up.

  5. #5
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like Lua isnt being loaded as far as my world.exe says. I'll do a re-compile and see where that gets me.
    I'll report back in a few hours.
    Last edited by tyeeeee1; 11-10-2011 at 01:43 PM.

  6. #6
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well its all fixed now... I'll just say it was all human error.

Similar Threads

  1. [Buying] looking to get back into game and become addicted
    By hilary878 in forum WoW-US Account Buy Sell Trade
    Replies: 3
    Last Post: 03-29-2013, 02:26 AM
  2. [Buying] looking to get back into game and become addicted again
    By hilary878 in forum WoW-EU Account Buy Sell Trade
    Replies: 0
    Last Post: 03-29-2013, 01:04 AM
  3. Just got back at D3
    By dintiy in forum Diablo 3 General
    Replies: 2
    Last Post: 01-13-2013, 08:17 AM
  4. Just got back into the game!
    By tallbus1 in forum World of Warcraft General
    Replies: 1
    Last Post: 12-31-2010, 04:57 AM
  5. [Rate]Just got back into gfx please rate
    By CodeDemon in forum Art & Graphic Design
    Replies: 1
    Last Post: 06-08-2009, 03:07 PM
All times are GMT -5. The time now is 06:01 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