[Release] Code Box Npc (Lua) menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    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)

    [Release] Code Box Npc (Lua)

    Attachment 2480

    Description

    We all remember those good old redeember npc's, where if you have a item you can get something? Well this is the next level.
    Basically when you talk to the npc, you get a series of options if your not in combat, and you can choose a item to add to yourself.
    Now when you pick a item, here is the thing, it opens up a code box, and if you don't get the code right then it doesn't give you the item.
    This way you can give certain codes to certain people if they win a event etc, and they can go do it!
    The script is easily configured so you can change the password, item and gossip names in seconds.
    Good luck!

    Screenshots


    http://i40.tinypic.com/2pqnqsw.jpg
    http://i41.tinypic.com/2r2m07d.jpg
    http://i39.tinypic.com/2eq8mfo.jpg
    http://i44.tinypic.com/f4p5r9.jpg
    http://i39.tinypic.com/2w3e5hy.jpg

    Lua

    Code:
    --===================================================================================================
    --====== Define the npc id ==========================================================================
    --===================================================================================================
    
    local RedeemNpc = 999885
    
    --===================================================================================================
    --= Option is what to display on the gossip when you talk to the npc ================================
    --= Code   is the code you need to type in to get the item ==========================================
    --= Item   is the item you get when you get the code correct ========================================
    --= Amount is the amount of that item to get, so maybe 5 beers for example? =========================
    --===================================================================================================
    
    local Option1 = "Test Function"
    local Code1 = "Test"
    local Item1 = 11846
    local Amount1 = 5
    
    
    local Option2 = "I want a pet frog please."
    local Code2 = "Frog"
    local Item2 = 11027
    local Amount2 = 1
    
    
    local Option3 = "I GAMEMASTER (noob) GIEF ARTIFACT"
    local Code3 = "E39GFA11KC37"
    local Item3 = 192
    local Amount3 = 1
    
    local Option4 = "May I have a Swift Spectral Tiger?"
    local Code4 = "Spectral Ownage"
    local Item4 = 33225
    local Amount4 = 1
    
    local Option5 = "Food... NOW!"
    local Code5 = "Food is Nice"
    local Item5 = 12202
    local Amount5 = 20
    
    
    --===================================================================================================
    --====== The Script it's self =======================================================================
    --===================================================================================================
    
    function Redeem_OnGossipTalk(pUnit, event, player, pMisc)
       if (player:IsInCombat() == true) then
       player:SendAreaTriggerMessage("Please leave combat first.")
       player:SendBroadcastMessage("Please leave combat first.")
       pUnit:GossipComplete(player)
       else
       pUnit:GossipCreateMenu(44, player, 0)
       pUnit:GossipMenuAddItem(30, Option1, 10, 1)
       pUnit:GossipMenuAddItem(30, Option2, 9, 1)
       pUnit:GossipMenuAddItem(30, Option3, 8, 1)
       pUnit:GossipMenuAddItem(30, Option4, 7, 1)
       pUnit:GossipMenuAddItem(30, Option5, 6, 1)
       pUnit:GossipMenuAddItem(30, "Exit", 11, 0)
       pUnit:GossipSendMenu(player)
       end
    end
    
    function Redeem_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
    if (intid == 10) then
       if code == Code1 then
       player:SendBroadcastMessage("Correct Code.")
       player:AddItem(Item1, Amount1)
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       else
       player:SendBroadcastMessage("Invalid Code.")
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       end
    end
    if (intid == 9) then
       if code == Code2 then
       player:SendBroadcastMessage("Correct Code.")
       player:AddItem(Item2, Amount2)
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       else
       player:SendBroadcastMessage("Invalid Code.")
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       end
    end
    if (intid == 8) then
       if code == Code3 then
       player:SendBroadcastMessage("Correct Code.")
       player:AddItem(Item3, Amount3)
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       else
       player:SendBroadcastMessage("Invalid Code.")
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       end
    end
    if (intid == 7) then
       if code == Code4 then
       player:SendBroadcastMessage("Correct Code.")
       player:AddItem(Item4, Amount4)
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       else
       player:SendBroadcastMessage("Invalid Code.")
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       end
    end
    if (intid == 6) then
       if code == Code5 then
       player:SendBroadcastMessage("Correct Code.")
       player:AddItem(Item5, Amount5)
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       else
       player:SendBroadcastMessage("Invalid Code.")
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
       end
    end
    if (intid == 11) then
       pUnit:GossipComplete(player)
       pUnit:FullCastSpellOnTarget(16716, player)
    end
    end
    
    RegisterUnitGossipEvent(RedeemNpc, 1, "Redeem_OnGossipTalk")
    RegisterUnitGossipEvent(RedeemNpc, 2, "Redeem_OnGossipSelect")
    
    --===================================================================================================
    --====== A logo to annoy people :) People seem to be using this since I have...======================
    --===================================================================================================
    
    print("                 -                ")
    print("  Lua script made by stoneharry   ")
    print("          Have fun                ")
    print("  Report bugs to mmowned.com      ")
    print("                 -                ")
    
    --===================================================================================================
    --====== The end, good luck! ========================================================================
    --===================================================================================================

    Sql (NCDB ArcEmu)

    Code:
    insert into `creature_names` (`entry`, `name`, `subname`, `info_str`, `Flags1`, `type`, `family`, `rank`, `unk4`, `spelldataid`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `civilian`, `leader`) values('999885','The Salamanda','Redeemer','','0','0','0','3','0',NULL,'24052','0','0','0','1','1',NULL,NULL);
    insert into `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `death_state`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`) values('999885','75','75','35','10000','100000','0','1','1','1000','0','500','1387','0','0','0','0','360000','2575','0','0','0','0','0','0','1','0','0','0','852','0','0','2.5','8','14','0','0','0','0','0','0','0');


    Have fun!
    Last edited by stoneharry; 04-13-2010 at 05:24 AM.

    [Release] Code Box Npc (Lua)
  2. #2
    Mildan's Avatar Member
    Reputation
    10
    Join Date
    Feb 2009
    Posts
    80
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, didnt know you could make codes.
    Hmm, anyways exactly what is it good for?

  3. #3
    bsod-staff14's Avatar Member
    Reputation
    35
    Join Date
    Nov 2008
    Posts
    443
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I love it . Dude this thing is awesome!! +Rep

    Fckin cooldown I gotta wait 24 hours bro soz...
    Immortal GamerZ Under Development!

  4. #4
    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)
    Another very good release, stoneharry. Keep at it, you're awesome man.

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


  5. #5
    Nymphx's Avatar Active Member
    Reputation
    83
    Join Date
    Sep 2008
    Posts
    212
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Care to explain how this works? O.o

    Code:
    function Redeem_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
    if (intid == 10) then
       if code == Code1 then
    Is it the;

    (pUnit, event, player, id, intid, code, pMisc)

    that does this? You always find weird shit hiding in the server core.. Good job

  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)
    Mildan, you didn't read the description, I said what it would be usefull for in there
    Also Nymphx, yes and no. The code is part of the function where your defining it all, then on the create gossip you put a extra 1 instead of 0 or blank (which is default 0) here:

    Code:
       pUnit:GossipMenuAddItem(30, Option1, 10, 1)

  7. #7
    y2kss66's Avatar Member
    Reputation
    104
    Join Date
    Jan 2008
    Posts
    778
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is sweet but couldn't if some one wins an item then distribute that code to other people and then you would have mass pandemonium with everyone having the epic items....

    or do you have a protection against this?

    nice work though!
    +RepX2

    grrrr.... cooldown!

  8. #8
    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)
    Couldn't think of a protection againts that y2kss66, so instead I made it so you can easily edit the password in seconds.

  9. #9
    y2kss66's Avatar Member
    Reputation
    104
    Join Date
    Jan 2008
    Posts
    778
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok that works

  10. #10
    Kiyoshi's Avatar Member
    Reputation
    28
    Join Date
    Jun 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They all said it couldn't be done, in LUA, but you proved them wrong...Amazing release. A question though bro, when you wanna change the pass, does that mean you have to reset the server every time someone uses the code?

  11. #11
    Lilltimmy's Avatar Member
    Reputation
    20
    Join Date
    Jun 2007
    Posts
    275
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remember a Code Box like that on Project Silvermoon's GM Vendor which gives GM Armor Pretty nice

  12. #12
    nbhfam's Avatar Member
    Reputation
    5
    Join Date
    Feb 2008
    Posts
    41
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ....... u a so very x2 good !
    awesome !!!!

  13. #13
    Hellgawd's Avatar Account not activated by Email
    Reputation
    710
    Join Date
    Jun 2007
    Posts
    2,480
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now imagine if you combined this with some database codes, and made it so you could enter a code (and then it gets removed from teh database, making it unusable) and you could hand them out like gifts!

  14. #14
    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)
    Kiyoshi, I think there was a function of rehash or something in the code box that got released at some point which makes it reload Lua scripts, but I don't know if it ever went ahead... So yes you have to restart the server normally to reload Lua scripts.
    Hellgawd, that actually wouldn't be to hard to do, just add to pMisc:ExecuteQuery("delete from items where entry = x") but I havn't tested this, I just know there is a execute command with LuaAppArc or the GuaEngine.

  15. #15
    kaato's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hellgawd got a nice idea here.
    It could be a row in the world database where you provide code, item reward and how many times it can be used..

    would be damn awesome
    https://nordicwow.servegame.com/ +Rep

Page 1 of 2 12 LastLast

Similar Threads

  1. [Release] Fun Teleporter npc [Lua++]
    By stoneharry in forum WoW EMU General Releases
    Replies: 24
    Last Post: 02-23-2009, 06:48 PM
  2. [Release]Buffer npc lua
    By Noobcraft in forum WoW EMU General Releases
    Replies: 8
    Last Post: 10-04-2008, 07:20 AM
  3. [Release] Healing / Buffing NPC (LUA++)
    By Vaudville in forum WoW EMU General Releases
    Replies: 0
    Last Post: 09-21-2008, 07:46 AM
  4. [Release]Instant 70 Npc Lua
    By Noobcraft in forum WoW EMU General Releases
    Replies: 27
    Last Post: 09-08-2008, 11:28 PM
  5. [Release] Info NPC -- LUA
    By Babbaa in forum WoW EMU General Releases
    Replies: 6
    Last Post: 08-17-2008, 02:29 PM
All times are GMT -5. The time now is 07:23 AM. 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