Well here is my first release, by a little help of my friend Nightfoxx change everything in red :P
Lua Engine used: None
Lua Engine used: Gastricpenguinfunction Gambler_On_Gossip(unit, event, player)
if (player:IsPlayer() == true) then
unit:GossipCreateMenu(1, player, 0)
unit:GossipMenuAddItem(0, "I will gamble 5 Coins (Win 50 coins!)", 1, 0)
unit:GossipSendMenu(player)
else
unit:GossipCreateMenu(1, player, 0)
unit:GossipSendMenu(player)
end
end
function Gambler_Gossip_Submenus(unit, event, player, id, intid, code)
if (intid == 1) then
if (player:GetItemCount(ITEMIDITEMIDITEMID) < 5) then --Remember to set the item id!
player:SendAreaTriggerMessage("You don't have enough Coins to bet!")
player:GossipComplete()
else
Choice=math.random(1, 100)
if Choice >= 1 and Choice <= 20 then -- Change 20 to another procent. Currently the chance for u win is 20%
player:SendAreaTriggerMessage("You won 50 Coins! Lucky you >.<")
unit:FullCastSpellOnTarget(33082, player)
unit:FullCastSpellOnTarget(33081, player)
unit:FullCastSpellOnTarget(33077, player)
unit:FullCastSpellOnTarget(33078, player)
unit:FullCastSpellOnTarget(33079, player)
unit:FullCastSpellOnTarget(33080, player)
player:AddItem(ITEMIDITEMIDITEMID, 50) -- REMEMBER TO SET ITEMID and 50 u win 50 coins. Be free to change it
player:GossipComplete()
else
player:SendAreaTriggerMessage("You lost 5 coins, and that means more money to me ")
player:RemoveItem(ITEMIDITEMIDITEMID, 5)
player:GossipComplete()
end
end
if (intid == 2) then -- Ignore this <.> to fix the you can only have 1 gossip submenu bug :P
player:SendAreaTriggerMessage("")
player:GossipComplete()
end
end
end
RegisterUnitGossipEvent(NPCID, 1, "Gambler_On_Gossip") -- Remember the npc id!
RegisterUnitGossipEvent(NPCID, 2, "Gambler_Gossip_Submenus")
Someone test this pl0x ^^
Hope you like!function Gambler_On_Gossip(unit, event, player)
if (player:IsPlayer() == true) then
unit:GossipCreateMenu(1, player, 0)
unit:GossipMenuAddItem(0, "I will gamble 5 Coins (Win 50 coins!)", 1, 0)
unit:GossipSendMenu(player)
else
unit:GossipCreateMenu(1, player, 0)
unit:GossipSendMenu(player)
end
end
function Gambler_Gossip_Submenus(unit, event, player, id, intid, code)
if (intid == 1) then
if (player:CanRemoveGold(5)) then
player:SendAreaTriggerMessage("You don't have enough Coins to bet!")
player:GossipComplete()
else
Choice=math.random(1, 100)
if Choice >= 1 and Choice <= 20 then -- Change 20 to another procent. Currently the chance for u win is 20%
player:SendAreaTriggerMessage("You won 50 Coins! Lucky you >.<")
unit:FullCastSpellOnTarget(33082, player)
unit:FullCastSpellOnTarget(33081, player)
unit:FullCastSpellOnTarget(33077, player)
unit:FullCastSpellOnTarget(33078, player)
unit:FullCastSpellOnTarget(33079, player)
unit:FullCastSpellOnTarget(33080, player)
player:AddCoinage(50, 0, 0) -- U win 50 gold coins 50 is gold, then there is silver then copper. Be FREE to change :P
player:GossipComplete()
else
player:SendAreaTriggerMessage("You lost 5 coins, and that means more money to me ")
player:RemoveGold(5)
player:GossipComplete()
end
end
if (intid == 2) then -- Ignore this <.> to fix the you can only have 1 gossip submenu bug :P
player:SendAreaTriggerMessage("")
player:GossipComplete()
end
end
end
RegisterUnitGossipEvent(NPCID, 1, "Gambler_On_Gossip") -- Remember the npc id!
RegisterUnitGossipEvent(NPCID, 2, "Gambler_Gossip_Submenus")