How do i make the Slick water elemental have a 30% chance to be cought?
Code:
local config = {
waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
rateSkill = getConfigValue("rateSkill"),
allowFromPz = false,
useWorms = false
}
local v = {
[200] = {name = "Slick Water Elemental", chance = {10}},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.waterIds, itemEx.itemid) then
return false
end
if (config.allowFromPz or not getTileInfo(getThingPos(cid)).protection) and itemEx.itemid ~= 493 and math.random((100 + (getPlayerSkill(cid, SKILL_FISHING) / 50))) < getPlayerSkill(cid, SKILL_FISHING) and (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1))) then
local bsMessage = "%s has caught a %s"
for i, k in pairs(v) do
if getPlayerLevel(cid) >= i then
local c = math.random(1, 20)
if c >= k.chance[1] then
doSummonCreature(k.name, getThingPos(cid))
end
end
if k.broadcast then
doBroadcastMessage(bsMessage:format(getCreatureName(cid), k.name))
break
end
end
end
return doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
end
Last edited: