Code:
function On_Gossip(unit, event, player)
local NPCID = 198768
local ITEMID = 32569
unit:RemoveEvents()
if (player:IsInCombat() == true) then
player:SendAreaTriggerMessage("Sorry, you have to leave combat first!")
else
unit:GossipCreateMenu(100, player, 0)
unit:GossipMenuAddItem(5, "Bet 1 Coin", 1, 0)
unit:GossipMenuAddItem(5, "Bet 2 Coins", 2, 0)
unit:GossipSendMenu(player)
end
end
function Gossip_Submenus(unit, event, player, id, intid, code)
if (intid == 7) then
unit:GossipCreateMenu(100, player, 0)
unit:GossipMenuAddItem(5, "[Bet 1 Coin]", 1, 0)
unit:GossipMenuAddItem(5, "[Bet 2 Coins]", 2, 0)
unit:GossipSendMenu(player)
end
if (intid == 1) then
if (player:GetItemCount(ITEMID) < 1) then
player:SendAreaTriggerMessage("You don't have enough coins to bet!")
else
unit:GossipMenuAddItem(5, "You have a 50% chance of winning, continue?", 80, 0)
unit:GossipMenuAddItem(4, "Yes, I'll do it", 5, 0)
unit:GossipMenuAddItem(4, "No, I'd rather not", 7, 0)
unit:GossipSendMenu(player)
end
end
if (intid == 5) then
Choice=math.random(1, 2)
if Choice==1 then
player:AddItem(ITEMID, 1)
end
if Choice==2 then
player:RemoveItem(ITEMID, 1)
end
end
if (intid == 80) then
unit:GossipComplete(player)
end
end
if (intid == 2) then
if (player:GetItemCount(ITEMID) < 2) then
player:SendAreaTriggerMessage("You do not have enough coins to bet!")
else
unit:GossipMenuAddItem(5, "You have a 50% chance of winning, continue?", 80, 0)
unit:GossipMenuAddItem(4, "Yes, make haste", 6, 0)
unit:GossipMenuAddItem(4, "No, take me back", 7, 0)
unit:GossipSendMenu(player)
end
end
if (intid == 6) then
Choice=math.random(1, 2)
if Choice==1 then
player:AddItem(ITEMID, 2)
end
if Choice==2 then
player:RemoveItem(ITEMID, 2)
end
end
RegisterUnitGossipEvent(NPCID, 1, "On_Gossip")
RegisterUnitGossipEvent(NPCID, 2, "Gossip_Submenus")
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
(198768, 'Lizzrik Styliz', 'The Lottery Goblin', 0, 0, 7, 0, 1, 0, 0, 191881, 0, 0, 0, 1, 1, NULL, 0);
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
(198768, 80, 80, 1555, 1000, 1000, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, '', 0, 0, 0, 0, 2.5, 8, 14, 0, 0, 0, 0, 0, 0, 0);
The script is easy to understand and its very easy to modify if you wish to.