Need help. menu

User Tag List

Thread: Need help.

Results 1 to 6 of 6
  1. #1
    sarov's Avatar Private
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help.

    Okay, so first I began to make a new script.
    First, I make the gossip menu and it works without any errors at all.
    Then, I begin to do some event registering.. and guess what? I reload the scripts, test it.. the gossip works fine but what is meant to happen after isn't working at all.
    I'm using LuaHypArc, btw.

    Code:
    function haddan_OnMenu1(pUnit, event, player)
    
    	pUnit:GossipCreateMenu(4344576, player, 0)
    	pUnit:GossipMenuAddItem(9, "We need to stop lying low and start doing something. If we stay here the guards will track us down and arrest us.", 1, 0)
    	pUnit:GossipMenuAddItem(7, "I'll wait.", 2, 0)
    	pUnit:GossipSendMenu(player)
    end
    
    function haddan_OnGossipSelect(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		pUnit:SendChatMessage(12, 0, "What is ther' tae do? We're stuck here 'til we can--")
    		player:GossipComplete()
    		pUnit:Emote(1, 1000)
    		pUnit:RegisterEvent("haddan_Cast", 5000, 1)
            end
    
    	if (intid == 2) then
    		player:GossipComplete()
    	end
    
    end
    
    RegisterUnitGossipEvent(844575, 1, haddan_OnMenu1)
    RegisterUnitGossipEvent(844575, 2, haddan_OnGossipSelect)
    
    function haddan_Cast(pUnit, event, player)
    pUnit:SendChatMessage(12, 0, "Did ye hear that? It's coming from upstairs...")
    pUnit:SendChatMessage(16, 0, "The sound of a loud horn fills your ears.")
     pUnit:Emote(6, 1155)
     player:PlaySoundToPlayer(10843)
     pUnit:RegisterEvent("haddan_scared_Cast", 5000, 1)
     end
     
     function haddan_scared_Cast(pUnit, event, player)
     pUnit:SendChatMessage(12, 0, "Do ye even know what a bloody HORN means?! It means they've found us! We're dead!")
     pUnit:Emote(430, 5555)
        pUnit:RegisterEvent("haddan_beg_Cast", 5555, 1)
     end
     
     function haddan_beg_Cast(pUnit, event, player)
     pUnit:SendChatMessage(12, 0, "Titans above, I beg of ye, save my spirit from damnation...")
    end
    I don't know about this one.. in the past I have been able to solve errors like this but this one eludes me. There's probably a simple and easy solution which I may have forgot.

    Need help.
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You can't register events within a gossip menu (a ancient bug that has always existed).

    To get around this, register a event to happen every few seconds on spawn of the npc, then in that function check to see whether a boolean has been set to true (which can be set to true when you click gossip menu) then you know when it has been pressed and can continue as normal.

  3. #3
    sarov's Avatar Private
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's still not working... perhaps I really am missing the error here but nevertheless further guidance would be great.

    Code:
    -- Much thanks goes to Stoneharry for his assistance.
    
    local hax = nil
    
    function haddan_OnMenu1(pUnit, event, player)
    
    	pUnit:GossipCreateMenu(4344576, player, 0)
    	pUnit:GossipMenuAddItem(9, "We need to stop lying low and start doing something. If we stay here the guards will track us down and arrest us.", 1, 0)
    	pUnit:GossipMenuAddItem(7, "I'll wait.", 2, 0)
    	pUnit:GossipSendMenu(player)
    end
    
    function haddan_OnGossipSelect(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		pUnit:SendChatMessage(12, 0, "What is ther' tae do? We're stuck here 'til we can--")
    		player:GossipComplete()
    		pUnit:Emote(1, 1000)
            end
    
    	if (intid == 2) then
    		player:GossipComplete()
    	end
    
    end
    
    function haddan_OnSpawn (pUnit, event, player)
    pUnit:RegisterEvent("ancienterror_Cast", 5, 1)
    end
    
    
    RegisterUnitGossipEvent(844575, 1, haddan_OnMenu1)
    RegisterUnitGossipEvent(844575, 2, haddan_OnGossipSelect)
    RegisterUnitEvent(844575, 1, haddan_OnSpawn)
    
    function ancienterror_Cast (pUnit, event, player)
    hax = pUnit
    hax:RegisterEvent("haddan_Cast", 5000, 1)
    end
    
    
    function haddan_Cast(pUnit, event, player)
    pUnit:SendChatMessage(12, 0, "Did ye hear that? It's coming from upstairs...")
    pUnit:SendChatMessage(16, 0, "The sound of a loud horn fills your ears.")
     pUnit:Emote(6, 1155)
     player:PlaySoundToPlayer(10843)
     pUnit:RegisterEvent("haddan_scared_Cast", 5000, 1)
     end
     
     function haddan_scared_Cast(pUnit, event, player)
     pUnit:SendChatMessage(12, 0, "Do ye even know what a bloody HORN means?! It means they've found us! We're dead!")
     pUnit:Emote(430, 5555)
        pUnit:RegisterEvent("haddan_beg_Cast", 5555, 1)
     end
     
     function haddan_beg_Cast(pUnit, event, player)
     pUnit:SendChatMessage(12, 0, "Titans above, I beg of ye, save my spirit from damnation...")
    end
    Last edited by sarov; 02-23-2011 at 04:03 PM. Reason: noticed and error in the script, fixed it but it still doesn't work

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code:
    local ready = false
    
    function haddan_OnMenu1(pUnit, event, player)
    	pUnit:GossipCreateMenu(4344576, player, 0)
    	pUnit:GossipMenuAddItem(9, "We need to stop lying low and start doing something. If we stay here the guards will track us down and arrest us.", 1, 0)
    	pUnit:GossipMenuAddItem(7, "I'll wait.", 2, 0)
    	pUnit:GossipSendMenu(player)
    end
    
    function haddan_OnGossipSelect(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		pUnit:SendChatMessage(12, 0, "What is ther' tae do? We're stuck here 'til we can--")
    		player:GossipComplete()
    		pUnit:Emote(1, 1000)
    		ready = true
        end
    	if (intid == 2) then
    		player:GossipComplete()
    	end
    
    end
    
    function haddan_OnSpawn (pUnit, event)
    	pUnit:RegisterEvent("ancienterror_Cast", 1000, 1)
    end
    
    
    RegisterUnitGossipEvent(844575, 1, haddan_OnMenu1)
    RegisterUnitGossipEvent(844575, 2, haddan_OnGossipSelect)
    RegisterUnitEvent(844575, 1, haddan_OnSpawn)
    
    function ancienterror_Cast (pUnit, event)
    	pUnit:RegisterEvent("haddan_Cast", 1000, 0)
    end
    
    
    function haddan_Cast(pUnit, event)
    	if ready then
    		ready = false
    		pUnit:RemoveEvents()
    		pUnit:SendChatMessage(12, 0, "Did ye hear that? It's coming from upstairs...")
    		pUnit:SendChatMessage(16, 0, "The sound of a loud horn fills your ears.")
    		pUnit:Emote(6, 1155)
    		local player = pUnit:GetClosestPlayer()
    		if player ~= nil then
    			player:PlaySoundToPlayer(10843)
    		end
    		pUnit:RegisterEvent("haddan_scared_Cast", 5000, 1)
           end
     end
     
     function haddan_scared_Cast(pUnit, event)
    	pUnit:SendChatMessage(12, 0, "Do ye even know what a bloody HORN means?! It means they've found us! We're dead!")
    	pUnit:Emote(430, 5555)
        pUnit:RegisterEvent("haddan_beg_Cast", 5555, 1)
     end
     
    function haddan_beg_Cast(pUnit, event, player)
    	pUnit:SendChatMessage(12, 0, "Titans above, I beg of ye, save my spirit from damnation...")
    	-- Reset gossip
    	pUnit:RegisterEvent("haddan_Cast", 1000, 0)
    end

  5. #5
    sarov's Avatar Private
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man. Rep'd.

  6. #6
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    To improve the script and to stop people 'exploiting' it (and possible causing a server crash) you may want to change NPC flags upon gossip.

    :SetNPCFlags(flags) : Sets the Unit's flags to the flags specified (This is used to disable gossip, etc).

    0 doesn't work for some reason (thinks it is a nil value) so just set it to 2 (quest flags) until you are ready to reset gossip then change it back to 1 (talk).

Similar Threads

  1. need help with shammy talents
    By jason in forum World of Warcraft General
    Replies: 5
    Last Post: 07-19-2006, 02:02 AM
  2. Need Help with WoW Glider
    By paypal in forum World of Warcraft General
    Replies: 2
    Last Post: 07-07-2006, 02:08 AM
  3. I need help
    By ff9pro in forum World of Warcraft General
    Replies: 4
    Last Post: 07-05-2006, 08:43 PM
  4. Need help
    By zamp in forum World of Warcraft General
    Replies: 1
    Last Post: 06-24-2006, 10:54 PM
  5. Need Help
    By Slumlorde in forum World of Warcraft General
    Replies: 4
    Last Post: 06-23-2006, 08:20 AM
All times are GMT -5. The time now is 08:07 AM. 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