[Lua] Father Christmas menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Father Christmas

    Santa NPC.

    Really simple, change the configs to reward the Item ID of your choice to your players on Christmas day

    Code:
    --[ Made By Ground Zero of MMOwned ]--
    
    -- Start Config
    
    local enable = 1 -- Turn to 0 to Disable
    local x1 = 0000 -- Change to the Item ID of Random Reward 1
    local x2 = 0000 -- Change to the Item ID of Random Reward 2
    local x3 = 0000 -- Change to the Item ID of Random Reward 3
    local x4 = 0000 -- Change to the Item ID of Random Reward 4
    local x5 = 0000 -- Change to the Item ID of Random Reward 5
    local x6 = 0000 -- Change to the Item ID of Random Reward 6
    local npcid = 80000
    
    -- End Config
    
    --- Do not Edit beyond this point. --
    
    function Santagossip(pUnit, event, plr)
        pUnit:GossipCreateMenu(3429, plr, 0)
        pUnit:GossipMenuAddItem(7, "Merry Christmas Santa!", 300, 0)
        pUnit:GossipMenuAddItem(1, "Can I have my present please Santa?", 301, 0)
        pUnit:GossipMenuAddItem(7, "Goodbye", 302, 0)
        pUnit:GossipSendMenu(plr)
    end
    
    function Santa_onchat(pUnit, event, plr, id, intid, code)
    
        if (intid == 300) then
        pUnit:SendChatMessage(12, 0, "Merry Christmas to you too and have a Happy New Year!")
        end
        
        if (intid == 301) then
            if (enable == 1) then
                local choice = math.random(1.6)
                pUnit:SendBroadcastMessage("You have recieved a Christmas Present!")
                if choice == 1 then
                    plr:AddItem(x1, 1)
                    elseif
                    choice == 2 then
                    plr:AddItem(x2, 1)
                    elseif
                    choice == 3 then
                    plr:AddItem(x3, 1)
                    elseif
                    choice == 4 then
                    plr:AddItem(x3, 1)
                    elseif
                    choice == 5 then
                    plr:AddItem(x5, 1)
                    elseif
                    choice == 6 then
                    plr:AddItem(x6, 1)
                end
                else
                pUnit:SendBroadcastMessage("This feature is currently disabled!")
            end
        end
        
        if (intid == 302) then
        plr:GossipComplete()
        end
    end
        
    RegisterUnitGossipEvent(npcid, 1, "Santagossip")
    RegisterUnitGossipEvent(npcid, 2, "Santa_onchat")
    Lua pastebin - collaborative debugging tool

    Enjoy.

    [Lua] Father Christmas
  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)
    You should add a cooldown to the script so that players can not spam the npc till they get all the rewards.

  3. #3
    Reflection's Avatar Legendary
    Reputation
    783
    Join Date
    Mar 2008
    Posts
    3,377
    Thanks G/R
    1/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ho ho ho ho

    sorry, just had to!

    Freelance Digital Artist
    https://reflectionartwork.deviantart.com
    You did not desert me
    My brothers in arms


  4. #4
    Confucius's Avatar Panda of Worlds The Idiot

    CoreCoins Purchaser Authenticator enabled
    Reputation
    1389
    Join Date
    Oct 2007
    Posts
    2,590
    Thanks G/R
    267/283
    Trade Feedback
    7 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GJ what are the diff presents?

  5. #5
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What ever you want them to be Confucius.

    Oh lawd Harry, I thought I did, meh did this script as 1am so was tired.

  6. #6
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually did a Santa Boss fight, but I never felt like releasing it. But nice job.



  7. #7
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you test the script, considering you have:
    Code:
    local choice = math.random(1.6)
    Because of the dot the math.random() function will always return 1, thus ruining the whole point of randomisation. Obviously it's a small typo, but I thought testing a script before releasing it is common sense.

    Not to mention without a cooldown some kind its randomisation is pointless anyway, like Stoneharry pointed out. Get those things fixed and clean up some code (your elseif's look messy, get them on the same line as that which it's compared with and use a tab for the next line; now it's not a big issue but it's a good habit for bigger scripts)

    If you're interested it's possible to write it more dynamically and much shorter through a table, something like
    Code:
    player:AddItem(PresentTable[math.random(1, #PresentTable)], 1)
    Much shorter and if someone wants to add an item it just needs to be added to the table, thus allowing for easier customisation without having to add a bunch of code.

    Nonetheless I don't think it's a bad script per say, just lacking a few pointers. Improve above mentioned points and it's worth a few rep.

  8. #8
    adriann54's Avatar Member
    Reputation
    1
    Join Date
    Aug 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wonderful!

Similar Threads

  1. Merry Christmas
    By Marlo in forum Community Chat
    Replies: 25
    Last Post: 12-25-2006, 03:40 PM
  2. Merry Christmas to all
    By Fault in forum World of Warcraft General
    Replies: 1
    Last Post: 12-25-2006, 10:35 AM
  3. Coolest Christmas gift EVER!!111one
    By Trustdale in forum Community Chat
    Replies: 12
    Last Post: 11-26-2006, 04:36 PM
  4. Giftwrap Scam But On Christmas (may Have A Better Success Chance)
    By Elites360 in forum WoW Scam Prevention
    Replies: 8
    Last Post: 09-24-2006, 12:55 AM
  5. a lil christmas scam
    By WarriorPwner in forum WoW Scam Prevention
    Replies: 3
    Last Post: 09-05-2006, 11:14 AM
All times are GMT -5. The time now is 02:35 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