Arena Master Script not working as intended menu

User Tag List

Results 1 to 4 of 4
  1. #1
    chris999's Avatar Member
    Reputation
    1
    Join Date
    Jan 2008
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arena Master Script not working as intended

    Hey all. Ok so basically I've made this script where you talk to an NPC who gives out a quest for the arena. If you accept the quest then choose the first option upon talking to him again, you are moved down to the center of the arena and then after 5 seconds THIS SHOULD HAPPEN (but doesn't ): The battlemaster should speak (see code if you want to know what he says) and then spawn an NPC.

    Code:
    --[[
            Arena Battlemaster Script
    ]]
    
    -- Variables
    local NPC_ID = 50000
    
    -- On Triggers
    
    function exampleGossipOnTalk(Unit, Event, player)
            Unit:GossipCreateMenu(100, player, 0)
            Unit:GossipMenuAddItem(0, "Let's do this!", 1, 0)
            Unit:GossipMenuAddItem(0, "Forget it.", 2, 0)
            Unit:GossipSendMenu(player)
    end
    
    function exampleGossipOnSelect(Unit, Event, player, id, intid, code, pMisc)
            if (intid == 1)then
                if player:HasQuest(50000) then
                    player:MovePlayerTo(-13208.142578, 263.146149, 21.858044, 1.000000, 4096)
                    Unit:RegisterEvent("Initiation_RoundOne", 5000, 1)
                    player:GossipComplete()
                else
                    player:SendBroadcastMessage("You currently have no active arena quest.")
                    player:GossipComplete()
                end
            end
            if (intid == 2) then
                player:GossipComplete()
            end
    end
    
    function Initiation_RoundOne(Unit, Event)
        Unit:SendChatMessage(14, 0, "Good luck, challenger! Commence round one!!")
        Unit:SpawnCreature(118, -13194.796875, 290.456818, 21.858200, 4.300000, 2, 0)
    end
    
            
    
    
    RegisterUnitGossipEvent(NPC_ID, 1, "exampleGossipOnTalk")
    RegisterUnitGossipEvent(NPC_ID, 2, "exampleGossipOnSelect")
    RegisterUnitEvent(NPC_ID, 0, "Initiation_RoundOne")
    Any ideas? Thankyou in advance

    Arena Master Script not working as intended
  2. #2
    The-Eradicator's Avatar Contributor

    Reputation
    149
    Join Date
    May 2007
    Posts
    829
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know what the issue is as I don't work with Lua serverside, however, try some basic debugging.

    Ensure the function is actually firing, and see if the variables match the values you think they're supposed to have:

    Code:
    function exampleGossipOnSelect(Unit, Event, player, id, intid, code, pMisc)
            player:SendBroadcastMessage("exampleGossipOnSelect fired! id: " .. tostring(id) .. "; intid: " .. tostring(intid) .. ";")
    end
    My apologies if the Lua syntax is incorrect, I don't remember it very well.
    The most beautiful thing we can experience is the mysterious. It is the source of all true art and all science. He to whom this emotion is a stranger, who can no longer pause to wonder and stand rapt in awe, is as good as dead: his eyes are closed.
    Albert Einstein

  3. #3
    chris999's Avatar Member
    Reputation
    1
    Join Date
    Jan 2008
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, well I just tested both OnSelect possibilities (Let's do this and Forget it) and they both execute properly. The
    Code:
    Unit:RegisterEvent("Initiation_RoundOne", 5000, 1)
    however just doesn't seem to pass the registration to
    Code:
    function Initiation_RoundOne(Unit, Event)
        Unit:SendChatMessage(14, 0, "Good luck, challenger! Commence round one!!")
        Unit:SpawnCreature(118, -13194.796875, 290.456818, 21.858200, 4.300000, 2, 0)
    end
    EDIT: Just changed the Event Registers down the bottom of the script from
    Code:
    RegisterUnitGossipEvent(NPC_ID, 1, "exampleGossipOnTalk")
    RegisterUnitGossipEvent(NPC_ID, 2, "exampleGossipOnSelect")
    RegisterUnitEvent(NPC_ID, 0, "Initiation_RoundOne")
    to
    Code:
    RegisterUnitGossipEvent(NPC_ID, 1, "exampleGossipOnTalk").
    RegisterUnitGossipEvent(NPC_ID, 2, "exampleGossipOnSelect")
    RegisterUnitGossipEvent(NPC_ID, 2, "Initiation_RoundOne")

    Doing this properly passes the SendChatMessage for the NPC and spawns the other NPC as it should, however the player is no longer moved to the center of the arena.

  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)
    A historical error with Lua in emulation is that you can not actually register events inside a gossip event. That function will never be called.

    Alternatively, you can do something like this:

    Code:
    local Count = 0
    
    function KaelSummon_OnGossip(pUnit, event, player)
        pUnit:GossipCreateMenu(1260722, player, 0)
        pUnit:GossipMenuAddItem(0, "Kael'thas we are ready.", 4, 0)
        pUnit:GossipMenuAddItem(0, "Nevermind.", 3, 0)
        pUnit:GossipSendMenu(player)
    end
    
    
    function KaelSummon_GossipSubmenus(pUnit, event, player, id, intid, code)
        if(intid == 4) then
            pUnit:SendChatMessage(12, 0, "Stand back, mortals. I will summon the Lord and master.")
            pUnit:SetNPCFlags(2)
            Count = 1
            player:GossipComplete()
        end
        if(intid == 3) then
            player:GossipComplete()
        end
    end
    
    RegisterUnitGossipEvent(24855, 1, "KaelSummon_OnGossip")
    RegisterUnitGossipEvent(24855, 2, "KaelSummon_GossipSubmenus")
    
    function On_Spawn(pUnit, Event)
        pUnit:RegisterEvent("CheckForGossip", 2000, 0)
    end
    
    function CheckForGossip(pUnit)
        if Count == 1 then
        Count = 0
        pUnit:RemoveEvents()
        pUnit:SendChatMessage(12,0,"So, you decided to click my gossip menu, did you?!")
        pUnit:RegisterEvent("NowContinueWithTheScript", 5000, 1)
        end
    end
    
    RegisterUnitEvent(24855, 18, "On_Spawn")

Similar Threads

  1. Script not working
    By LJN in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 07-16-2008, 02:47 PM
  2. [HELP] Lua boss script not working-solutions?
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 03-21-2008, 08:19 AM
  3. [Help] Lua Script Not Working
    By Muruk in forum World of Warcraft Emulator Servers
    Replies: 26
    Last Post: 03-16-2008, 02:13 PM
  4. Simple Lua Script , not working need help!
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 16
    Last Post: 12-30-2007, 02:06 PM
  5. Ud f-> Ud M, Arena 2 Helm not working
    By Laokon in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 11-29-2007, 11:15 AM
All times are GMT -5. The time now is 09:54 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