Lua script help menu

User Tag List

Results 1 to 2 of 2
  1. #1
    igud2's Avatar Member
    Reputation
    10
    Join Date
    Nov 2007
    Posts
    47
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua script help

    Lua script help

    how to limit professions to like 2 on a professions npc script i made from scratch

    Lua script from my lua professions npc:

    Code:
    function On_Gossip_Talk(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(3, "Professions", 813, 0)
    unit:GossipMenuAddItem(5, "set my profession skills to 450", 50,0);
    unit:GossipSendMenu(player)
    end
    
    function On_Gossip_Select (unit, event, player, id, intid, code)
    
    if (intid == 5) then
    unit:GossipMenuAddItem(3, "Professions", 813, 0)
    unit:GossipMenuAddItem(5, "set my profession skills to 450", 50,0);
    unit:GossipSendMenu(player)
    end
    
    
    if(intid == 813) then 
    unit:GossipCreateMenu(50, player, 0)
    unit:GossipMenuAddItem(0, "Alchemy", 400, 0)
    unit:GossipMenuAddItem(0, "Blacksmithing", 401, 0)
    unit:GossipMenuAddItem(0, "Enchanting", 402, 0)
    unit:GossipMenuAddItem(0, "Engineering", 403, 0)
    unit:GossipMenuAddItem(0, "Herbalism", 404, 0)
    unit:GossipMenuAddItem(0, "Inscription", 405, 0)
    unit:GossipMenuAddItem(0, "Jewelcrafting", 406, 0)
    unit:GossipMenuAddItem(0, "Leatherworking", 407, 0)
    unit:GossipMenuAddItem(0, "Mining", 408, 0)
    unit:GossipMenuAddItem(0, "Skinning", 409, 0)
    unit:GossipMenuAddItem(0, "Cooking", 410, 0)
    unit:GossipMenuAddItem(0, "First Aid", 411, 0)
    unit:GossipMenuAddItem(0, "Fishing", 412, 0)
    unit:GossipMenuAddItem(0, "Tailoring", 413, 0)
    unit:GossipMenuAddItem(0, "[Back]", 5, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 400) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Alchemy", 415, 0)
    unit:GossipMenuAddItem(3, "Grand Master Alchemy", 416, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 401) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Blacksmithing", 417, 0)
    unit:GossipMenuAddItem(3, "Grand Master Blacksmithing", 418, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 402) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "UnlearnGrand Master Enchanting", 419, 0)
    unit:GossipMenuAddItem(3, "Grand Master Enchanting", 420, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 403) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Engineering", 421, 0)
    unit:GossipMenuAddItem(3, "Grand Master Engineering", 422, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    
    if(intid == 404) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Herbalism", 423, 0)
    unit:GossipMenuAddItem(3, "Grand Master Herbalism", 424, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 405) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Inscription", 425, 0)
    unit:GossipMenuAddItem(3, "Grand Master Inscription", 426, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 406) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Jewelcrafting", 427, 0)
    unit:GossipMenuAddItem(3, "Grand Master Jewelcrafting", 428, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 407) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Leatherworking", 429, 0)
    unit:GossipMenuAddItem(3, "Grand Master Leatherworking", 430, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 408) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Mining", 431, 0)
    unit:GossipMenuAddItem(3, "Grand Master Mining", 432, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 409) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Skinning", 433, 0)
    unit:GossipMenuAddItem(3, "Grand Master Skinning", 434, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 410) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Cooking", 435, 0)
    unit:GossipMenuAddItem(3, "Grand Master Cooking", 436, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 411) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master First Aid", 437, 0)
    unit:GossipMenuAddItem(3, "Grand Master First Aid", 438, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 412) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Fishing", 439, 0)
    unit:GossipMenuAddItem(3, "Grand Master Fishing", 440, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    if(intid == 13) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(3, "Unlearn Grand Master Tailor", 441, 0)
    unit:GossipMenuAddItem(3, "Grand Master Tailor", 442, 0)
    unit:GossipMenuAddItem(0, "[Back]", 813, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 415) then
    player:UnlearnSpell(51303)
    end
    if(intid == 416) then
    player:LearnSpell(51303)
    end
    if(intid == 417) then
    player:UnlearnSpell(51298)
    end
    if(intid == 418) then
    player:LearnSpell(51298)
    end
    if(intid == 419) then
    player:UnlearnSpell(51312)
    end
    if(intid == 420) then
    player:LearnSpell(51312)
    end
    if(intid == 421) then 
    player:UnlearnSpell(51305)
    end
    if(intid == 422) then
    player:LearnSpell(51305)
    end
    if(intid == 423) then
    player:UnlearnSpell(50301)
    end
    if(intid == 424) then
    player:LearnSpell(50301)
    end
    if(intid == 425) then
    player:UnlearnSpell(45380)
    end
    if(intid == 426) then
    player:LearnSpell(45380)
    end
    if(intid == 427) then
    player:UnlearnSpell(51310)
    end
    if(intid == 428) then 
    player:LearnSpell(51310)
    end
    if(intid == 429) then
    player:UnlearnSpell(51301)
    end
    if(intid == 430) then
    player:LearnSpell(51301)
    end
    if(intid == 431) then
    player:UnlearnSpell(50309)
    end
    if(intid == 432) then
    player:LearnSpell(50309)
    end
    if(intid == 433) then
    player:UnlearnSpell(50307)
    end
    if(intid == 434) then 
    player:LearnSpell(50307)
    end
    if(intid == 435) then
    player:UnlearnSpell(51295)
    end
    if(intid == 436) then
    player:LearnSpell(51295)
    end
    if(intid == 437) then
    player:UnlearnSpell(50299)
    end
    if(intid == 438) then
    player:LearnSpell(50299)
    end
    if(intid == 439) then
    player:UnlearnSpell(51293)
    end
    if(intid == 440) then
    player:LearnSpell(51293)
    end
    
    if(intid == 441) then
    player:UnlearnSpell(51308)
    end
    if(intid == 442) then
    player:LearnSpell(51308)
    end
    
    if (intid == 50) then
    player:AdvanceSkill(333, 450);
    player:AdvanceSkill(197, 450);
    player:AdvanceSkill(202, 450);
    player:AdvanceSkill(755, 450);
    player:AdvanceSkill(171, 450);
    player:AdvanceSkill(164, 450);
    player:AdvanceSkill(182, 450);
    player:AdvanceSkill(165, 450);
    player:AdvanceSkill(186, 450);
    player:AdvanceSkill(393, 450);
    player:AdvanceSkill(185, 450);
    player:AdvanceSkill(129, 450);
    player:AdvanceSkill(356, 450);
    player:AdvanceSkill(773, 450);
    unit:GossipComplete(player)
    unit:SendChatMessage(12,0,"All Skills At Max")
    unit:GossipMenuAddItem(0, "[Back]", 5, 0)
    end
    end
    
    RegisterUnitGossipEvent(400035, 1, "On_Gossip_Talk")
    RegisterUnitGossipEvent(400035, 2, "On_Gossip_Select")

    Lua script help
  2. #2
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    player:GetUInt32Value(1397)
    will give you the number of available profession points the player has.

    When a player unlearns a profession run this:
    Code:
    player:ModUInt32Value(1397, 1)
    and when he learns a profession, make sure to check if his number of available profession points is greater than 0.

    As for learning professions, since you teach the player the learning spell and not the spell itself, the core will handle decreasing his available profession points.

Similar Threads

  1. Simple LUA Script Help
    By Wolfly in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 09-02-2008, 04:22 PM
  2. LUA Script Help Thread
    By mager1794 in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 07-04-2008, 12:46 AM
  3. LuA Scripting Help
    By Jlp in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 06-27-2008, 03:33 AM
  4. Lua script help and general questions from beginner
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 02-23-2008, 04:38 AM
  5. Need LUA Scripting Help ?
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-04-2008, 12:36 PM
All times are GMT -5. The time now is 10:50 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