Ill give ya the basic blueprint and you can fill in the details of what you want. I will also describe what each one does
Code:
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player, 0)
unit:GossipMenuAddItem(2, "Remove Rezz Sickness", 1, 3)
unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3)
unit:GossipMenuAddItem(2, "Add spell", 4, 3)
unit:GossipMenuAddItem(2, "Add spell", 5, 3)
unit:GossipMenuAddItem(2, "Add spell", 6, 3)
unit:GossipMenuAddItem(2, "Add spell", 7, 3)
unit:GossipMenuAddItem(2, "Add spell", 8,3 )
unit:GossipSendMenu(player)
end
function Gossip_Submenus(unit, event, player, id, intid, code)
if(intid == 3544) then
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player, 0)
unit:GossipMenuAddItem(2, "Remove Rezz Sickness", 1, 3)
unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3)
unit:GossipMenuAddItem(2, "Add spell", 4, 3)
unit:GossipMenuAddItem(2, "Add spell", 5, 3)
unit:GossipMenuAddItem(2, "Add spell", 6, 3)
unit:GossipMenuAddItem(2, "Add spell", 7, 3)
unit:GossipMenuAddItem(2, "Add spell", 8, 3)
unit:GossipSendMenu(player)
end
if(intid == 1) then
player:LearnSpell(15007)
player:UnlearnSpell(15007)
end
if(intid == 3) then
player:LearnSpell(26013)
player:UnlearnSpell(26013)
end
if(intid == 4) then
player:LearnSpell(17040)
end
if(intid == 5) then
player:LearnSpell(17039)
end
if(intid == 6) then
player:LearnSpell(17041)
end
if(intid == 7) then
player:LearnSpell(20221)
end
if(intid == 8) then
player:LearnSpell(20220)
end
end
RegisterUnitGossipEvent(npcid, 1, "On_Gossip")
RegisterUnitGossipEvent(npcid, 2, "Gossip_Submenus")
The first 2 lines are standard in any npc using lua. No need to explain it, except the second line is to exstablish a menu ID for the menu.
Next we have a bunch of lines that add that option to the menu, the title is add spell for each, replace that with the spell you want to add. if you add more lines make sure the second digit like here, unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3) is not the same as any other option, that is the options ID, the first number, unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3)
is what icon is displayed next to that option, the range is 1-9, theres a list you can look up somewhere here in mmowned.
now for the unit:GossipSendMenu(player) this makes it where it targets the player.
End is self explainitory, it ends the sequence. you always need to put end after every sequence, like I have.
function Gossip_Submenus(unit, event, player, id, intid, code)
this ones adds a submenu to the first one.
if(intid == 3544) then
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player, 0)
unit:GossipMenuAddItem(2, "Remove Rezz Sickness", 1, 3)
unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3)
unit:GossipMenuAddItem(2, "Add spell", 4, 3)
unit:GossipMenuAddItem(2, "Add spell", 5, 3)
unit:GossipMenuAddItem(2, "Add spell", 6, 3)
unit:GossipMenuAddItem(2, "Add spell", 7, 3)
unit:GossipMenuAddItem(2, "Add spell", 8, 3)
unit:GossipSendMenu(player)
end
I added this to make sure it loops back to the starting page.
unit:GossipSendMenu(player)
end
use that to end the second one.
Now for the submenus!
if(intid == 1) then
player:LearnSpell(15007)
player:UnlearnSpell(15007)
end
this targets the first menuid, which was assigned to 1, and add the spell "rezz sickness" then removes it to dispel the debuff. If you want the player to perm learn the spell, remove the unlearn part. The spell ID is in the brackets (ID) replace with the spell you want learned and unlearned, you can also learn 1 thing and have the player unlearn another, like if you wanted custom classes for example, you could have the player learn all mage spells, and remove all warlock spells, and if you knew alot more about lua, add a line taking off all warlock profiencies and adding mage ones.
you can have more then one submenu ofc, so it looks like this:
if(intid == 1) then
player:LearnSpell(15007)
player:UnlearnSpell(15007)
end
if(intid == 3) then
player:LearnSpell(26013)
player:UnlearnSpell(26013)
end
if(intid == 4) then
player:LearnSpell(17040)
end
if(intid == 5) then
player:LearnSpell(17039)
end
if(intid == 6) then
player:LearnSpell(17041)
end
if(intid == 7) then
player:LearnSpell(20221)
end
if(intid ==
then
player:LearnSpell(20220)
end
Now, simply add end again to complete it.
if(intid == 1) then
player:LearnSpell(15007)
player:UnlearnSpell(15007)
end
if(intid == 3) then
player:LearnSpell(26013)
player:UnlearnSpell(26013)
end
if(intid == 4) then
player:LearnSpell(17040)
end
if(intid == 5) then
player:LearnSpell(17039)
end
if(intid == 6) then
player:LearnSpell(17041)
end
if(intid == 7) then
player:LearnSpell(20221)
end
if(intid ==
then
player:LearnSpell(20220)
end
end
RegisterUnitGossipEvent(npcid, 1, "On_Gossip")
RegisterUnitGossipEvent(npcid, 2, "Gossip_Submenus")
This final line registers the menu and submenus to the NPC, replace npcid with the npcs id (DERP)
now it should look like the above, this:
Code:
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player, 0)
unit:GossipMenuAddItem(2, "Remove Rezz Sickness", 1, 3)
unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3)
unit:GossipMenuAddItem(2, "Add spell", 4, 3)
unit:GossipMenuAddItem(2, "Add spell", 5, 3)
unit:GossipMenuAddItem(2, "Add spell", 6, 3)
unit:GossipMenuAddItem(2, "Add spell", 7, 3)
unit:GossipMenuAddItem(2, "Add spell", 8,3 )
unit:GossipSendMenu(player)
end
function Gossip_Submenus(unit, event, player, id, intid, code)
if(intid == 3544) then
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player, 0)
unit:GossipMenuAddItem(2, "Remove Rezz Sickness", 1, 3)
unit:GossipMenuAddItem(2, "Remove Deserter", 3, 3)
unit:GossipMenuAddItem(2, "Add spell", 4, 3)
unit:GossipMenuAddItem(2, "Add spell", 5, 3)
unit:GossipMenuAddItem(2, "Add spell", 6, 3)
unit:GossipMenuAddItem(2, "Add spell", 7, 3)
unit:GossipMenuAddItem(2, "Add spell", 8, 3)
unit:GossipSendMenu(player)
end
if(intid == 1) then
player:LearnSpell(15007)
player:UnlearnSpell(15007)
end
if(intid == 3) then
player:LearnSpell(26013)
player:UnlearnSpell(26013)
end
if(intid == 4) then
player:LearnSpell(17040)
end
if(intid == 5) then
player:LearnSpell(17039)
end
if(intid == 6) then
player:LearnSpell(17041)
end
if(intid == 7) then
player:LearnSpell(20221)
end
if(intid == 8) then
player:LearnSpell(20220)
end
end
RegisterUnitGossipEvent(npcid, 1, "On_Gossip")
RegisterUnitGossipEvent(npcid, 2, "Gossip_Submenus")