Here you go:
Code:
function NPCGossipTest_OnGossipTalk(pUnit, event, player, pMisc)
pUnit:GossipCreateMenu(100, player, 0)
pUnit:GossipMenuAddItem(0, "Bake a cake!", 1, 0)
pUnit:GossipMenuAddItem(0, "Bake a pie!", 2, 0)
pUnit:GossipSendMenu(player)
end
function NPCGossipTest_OnGossipSelect(Unit, Event, player, id, intid, code, pMisc)
if (intid == 1) then
player:SendBroadcastMessage("Here is your cake.")
Unit:GossipComplete()
end
if (intid == 2) then
player:SendBroadcastMessage("Here is your pie.")
Unit:GossipComplete()
end
end
RegisterUnitGossipEvent(500002, 1, "NPCGossipTest_OnGossipTalk")
RegisterUnitGossipEvent(500002, 2, "NPCGossipTest_OnGossipSelect")
Instead of the chat messages, you can ofcourse put your own events in like additem or something. Take a look at some guides for cool events, for example from here: full list of lua commands