Olá a todos, hoje é terça, portanto venho trazer mais um script. Esse é bem simples, mas é legal... Fiz ele baseando-me em um pedido: http://www.xtibia.com/forum/topic/229539-sistema-de-pesca-de-itens/#entry1619129. Para ver os outros scripts de terça, clique aqui.
O que ele faz? É um simples sistema de pesca (com efeitos bem legais), onde se pode configurar tudo a seu gosto. Quando se usa a vara na água aparece um efeito, espera-se um tempo (3 segundos) e começam a aparecer vários efeitos na água. Nesse momento, você pode ou não conseguir um peixe.
Para instalar, crie Killua Fishing System.lua em data/actions/scripts e coloque:
local waterIDs = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625}
local config = {
{level = {10,19}, fishes = {2667}, maxFish = 1, chance = 50}, -- {level = {Do level, Até o level}, fishes = {id dos peixes que podem vir}, maxFish = quantidade máxima de peixes que podem vir, chance = chance em %
{level = {20,29}, fishes = {2667, 2669}, maxFish = 2, chance = 60},
{level = {30,39}, fishes = {2667, 2669}, maxFish = 3, chance = 70},
{level = {40,49}, fishes = {2667, 2669, 2668}, maxFish = 4, chance = 80},
{level = {50,59}, fishes = {2667, 2669, 2668}, maxFish = 5, chance = 80},
{level = {60,69}, fishes = {2667, 2669, 2668, 2670}, maxFish = 6, chance = 80},
{level = {70,79}, fishes = {2667, 2669, 2668, 2670, 2160}, maxFish = 6, chance = 80},
{level = {80,math.huge}, fishes = {2667, 2669, 2668, 2670, 2160, 2157}, maxFish = 7, chance = 90}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local worms = math.random(1, 5)
if getPlayerStorageValue(cid, 381921) < os.time() then
if isInArray(waterIDs, itemEx.itemid) then
if getPlayerItemCount(cid, 3976) >= worms then
doPlayerRemoveItem(cid, 3976, worms)
doSendMagicEffect(toPosition, 1)
local times = {2900, 3100, 3300, 3500, 3700, 3900, 4000}
for i = 1, #times do
addEvent(doSendMagicEffect, times[i], toPosition, 1)
end
addEvent(function()
local random = math.random(1, 100)
for _, fishing in pairs(config) do
if random <= fishing.chance then
if getPlayerSkillLevel(cid, 6) >= fishing.level[1] and getPlayerSkillLevel(cid, 6) <= fishing.level[2] then
doPlayerAddItem(cid, fishing.fishes[math.random(1, #fishing.fishes)], math.random(1, fishing.maxFish))
doPlayerAddSkillTry(cid, 6, 6)
doSendMagicEffect(toPosition, 53)
break
end
else
doSendMagicEffect(toPosition, 25)
doPlayerAddSkillTry(cid, 6, 1)
end
end
end, 4000)
doPlayerSetStorageValue(cid, 381921, os.time() + 5)
else
doPlayerSendCancel(cid, "Voce precisa de mais minhocas!")
end
else
doPlayerSendCancel(cid, "Voce nao pode pescar aqui")
end
else
doPlayerSendCancel(cid, "Sua isca ainda esta na agua!")
end
return true
end
Em actions.xml, coloque essa tag:
<action itemid="2580" script="Killua Fishing System.lua" allowfaruse="1"/>
ATENÇAO: para evitar problemas, remova a seguinte tag do actions.xml
<action itemid="2580" event="script" value="tools/fishing.lua" allowfaruse="1"/>
Configure a tabela config a seu gosto (siga o comentário no script).










