Hi guys,
I use this script on my server for player that fish to catch monster and/or fishes. It all work fine, I just wanted for the fishing skill also matter in the fishing the player is getting. For example, if the player has 10 fishing skill, he will get 10 shirmp out of 8 tries. If the player has 100 skill he will get 1 shirmp, 2 perchs and 7 sharks out of 10 tries.
I use this script on my server for player that fish to catch monster and/or fishes. It all work fine, I just wanted for the fishing skill also matter in the fishing the player is getting. For example, if the player has 10 fishing skill, he will get 10 shirmp out of 8 tries. If the player has 100 skill he will get 1 shirmp, 2 perchs and 7 sharks out of 10 tries.
Lua:
local waters = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 10499, 15401, 15402, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825, 4828, 4829, 4830, 4831, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 8863}
local lava = {598, 599, 600, 601, 9883}
local swamp = {4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4752}
local water_monsters = {
[1] = {name = "crab", chance = 75000, fishing = 10, level = 10, tries = 1, msg = "|PLAYERNAME| has caught a crab!", broadcastToServer = false},
[2] = {name = "calamary", chance = 50000, fishing = 10, level = 15, tries = 2, msg = "|PLAYERNAME| has caught a calamary!", broadcastToServer = false},
[3] = {name = "fish", chance = 35000, fishing = 10, level = 20, tries = 3, msg = "|PLAYERNAME| has caught a small fish!", broadcastToServer = false},
[4] = {name = "northern pike", chance = 25000, fishing = 10, level = 10, tries = 5, msg = "|PLAYERNAME| has caught a perch!", broadcastToServer = false},
[5] = {name = "jellyfish", chance = 15000, fishing = 10, level = 10, tries = 3, msg = "|PLAYERNAME| has caught a jellyfish!", broadcastToServer = false},
}
local lava_monsters = {
[1] = {name = "Fire Elemental", chance = 35000, fishing = 10, level = 10, tries = 1, msg = "|PLAYERNAME| has caught a fire elemental!", broadcastToServer = false},
[2] = {name = "Fire Devil", chance = 35000, fishing = 10, level = 10, tries = 1, msg = "|PLAYERNAME| has caught a fire devil!", broadcastToServer = false},
[3] = {name = "Dragon Lord", chance = 15000, fishing = 10, level = 10, tries = 1, msg = "|PLAYERNAME| has caught a dragon lord!", broadcastToServer = false}
}
local swap_monsters = {
[1] = {name = "rat", chance = 100000, fishing = 10, level = 10, tries = 1, msg = "|PLAYERNAME| has caught a rat!", broadcastToServer = false}
}
local chance = 500000
local catchFishStorage = 15000 --This is used to so players can turn catching regular fish off or on.
local chanceCatchShrimp = 70 --20% chance to catch normal fish
local chanceCatchSmallfish = 70 --20% chance to catch normal fish
local chanceCatchCommonfish = 50 --20% chance to catch normal fish
local chanceCatchWaterfallfish = 40 --20% chance to catch normal fish
local chanceCatchCatfish = 30 --20% chance to catch normal fish
local chanceCatchCarp = 30 --20% chance to catch normal fish
local chanceCatchPerch = 20 --20% chance to catch normal fish
local chanceCatchOctopus = 10 --20% chance to catch normal fish
local chanceCatchShark = 10 --20% chance to catch normal fish
local shrimpId = 2670 -- Item id of normal fish
local smallfishId = 27905 -- Item id of normal fish
local commonfishId = 27892 -- Item id of normal fish
local waterfallfishId = 27903 -- Item id of normal fish
local catfishId = 27904 -- Item id of normal fish
local carpId = 27900 -- Item id of normal fish
local perchId = 7159 -- Item id of normal fish
local octopusId = 27887 -- Item id of normal fish
local sharkId = 27897 -- Item id of northern pike
exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) + 1))
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getCondition(CONDITION_EXHAUST_HEAL) then
return player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
end
if Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
return player:sendCancelMessage("You may not fish from protection zone.")
end
if not isInArray(waters, target.itemid) and not isInArray(lava, target.itemid) and not isInArray(swamp, target.itemid) then
return false
end
local tmp_table = {}
if isInArray(waters, target.itemid) then
tmp_table = water_monsters
toPosition:sendMagicEffect(CONST_ME_LOSEENERGY)
elseif isInArray(lava, target.itemid) then
tmp_table = lava_monsters
toPosition:sendMagicEffect(CONST_ME_HITBYFIRE)
elseif isInArray(swamp, target.itemid) then
tmp_table = swap_monsters
toPosition:sendMagicEffect(9)
end
for i = 1, #tmp_table do
if (player:getLevel() >= tmp_table[i].level and player:getSkillLevel(SKILL_FISHING) >= tmp_table[i].fishing) then
local catchChance = math.random(1, chance)
local fishSkill = player:getSkillLevel(SKILL_FISHING)
if catchChance <= (tmp_table[i].chance + ((fishSkill - 10)* 1000)) then
local MONS = Game.createMonster(tmp_table[i].name, player:getPosition())
player:addSkillTries(SKILL_FISHING, tmp_table[i].tries)
if MONS then
if tmp_table[i].broadcastToServer then
local text = string.gsub(tmp_table[i].msg, "|PLAYERNAME|", player:getName())
Game.broadcastMessage(text)
end
end
break
end
end
end
if isInArray(waters, target.itemid) then
if math.random(1, 100) <= chanceCatchShrimp then
player:addItem(shrimpId, 1, true)
else
if math.random(1, 100) <= chanceCatchSmallfish then
player:addItem(smallfishId, 1, true)
else
if math.random(1, 100) <= chanceCatchCommonfish then
player:addItem(commonfishId, 1, true)
else
if math.random(1, 100) <= chanceCatchWaterfallfish then
player:addItem(waterfallfishId, 1, true)
else
if math.random(1, 100) <= chanceCatchCatfish then
player:addItem(catfishId, 1, true)
else
if math.random(1, 100) <= chanceCatchCarp then
player:addItem(carpId, 1, true)
else
if math.random(1, 100) <= chanceCatchPerch then
player:addItem(perchId, 1, true)
else
if math.random(1, 100) <= chanceCatchOctopus then
player:addItem(octopusId, 1, true)
else
if math.random(1, 100) <= chanceCatchShark then
player:addItem(sharkId, 1, true)
end
end
end
end
end
end
end
end
end
end
player:addCondition(exhaust)
return true
end