3.0+
Actions: monsterfish.lua
Talkaction: checkcatches.lua
[edit] The randmonsters = is the numbers that will spawn the monster when the math.radom picks a number between 1 and 1000.
so water elemental has 20/1000 chance, thats 1/50 chance.
Actions: monsterfish.lua
LUA:
local monsters = {
[1] = {name = "Water Spirit", level = 50, fishing = 100, magiceffect = 1, msg = "You have caught a water spirit!", bcmsg = getPlayerName(cid) .. "has caught a water spirit!", bc = false},
[2] = {name = "Great Water Spirit", level = 75, fishing = 105, magiceffect = 1, msg = "You have caught a great water spirit!", bcmsg = getPlayerName(cid) .. "has caught a great water spirit!", bc = false},
[3] = {name = "Hydros", level = 120, magiceffect = 2, fishing = 110, msg = "You have caught a hydros!", bcmsg = getPlayerName(cid) .. "has caught a hydros!", bc = false}
}
local chance = (1, 1000)
local randMonsters = {
[1] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
[2] = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30}
[3] = {31, 32, 33, 34, 35, 36, 37}
}
local water = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(water, itemEx.itemid) then
return false
end
if math.random(chance) == randMonsters[1] and getPlayerLevel(cid) >= monsters[1].level and getPlayerSkillLevel(cid, SKILL_FISHING) >= monsters[1]. fishing then
doTeleportThing(monsters[1].name, getPlayerPosition(cid), true)
doSendMagicEffect(getPlayerPosition(cid), monsters[1].magiceffect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, monsters[1].msg)
setPlayerStorageValue(cid, monster[1].name) + 1
if monsters[1].bc == true then
doBroadcastMessage(monsters[1].bcmsg)
end
elseif math.random(chance) == randMonsters[2] and getPlayerLevel(cid) >= monsters[2].level and getPlayerSkillLevel(cid, SKILL_FISHING) >= monsters[2]. fishing then
doTeleportThing(monsters[2].name, getPlayerPosition(cid), true)
doSendMagicEffect(getPlayerPosition(cid), monsters[2].magiceffect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, monsters[2].msg)
setPlayerStorageValue(cid, monster[2].name) + 1
if monsters[2].bc == true then
doBroadcastMessage(monsters[2].bcmsg)
end
elseif math.random(chance) == randMonsters[3] and getPlayerLevel(cid) >= monsters[3].level and getPlayerSkillLevel(cid, SKILL_FISHING) >= monsters[3]. fishing then
doTeleportThing(monsters[3].name, getPlayerPosition(cid), true)
doSendMagicEffect(getPlayerPosition(cid), monsters[3].magiceffect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, monsters[3].msg)
setPlayerStorageValue(cid, monster[3].name) + 1
if monsters[3].bc == true then
doBroadcastMessage(monsters[3].bcmsg)
end
elseif math.random(chance) == randMonsters[4] and getPlayerLevel(cid) >= monsters[4].level and getPlayerSkillLevel(cid, SKILL_FISHING) >= monsters[4]. fishing then
doTeleportThing(monsters[4].name, getPlayerPosition(cid), true)
doSendMagicEffect(getPlayerPosition(cid), monsters[4].magiceffect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, monsters[4].msg)
setPlayerStorageValue(cid, monster[4].name) + 1
if monsters[4].bc == true then
doBroadcastMessage(monsters[4].bcmsg)
end
end
doPlayerAddSkillTry(cid, skillid, 1)
doSendMagicEffect(toPosition, 1)
return true
end
Talkaction: checkcatches.lua
LUA:
local monsters = {["water spirit"], ["great water spirit"], ["hydros"]}
local monster1 = getPlayerStorageValue(cid, monsters[1])
local monster2 = getPlayerStorageValue(cid, monsters[2])
local monster3 = getPlayerStorageValue(cid, monsters[3])
local text = "[FISHING RECORD]: /n Water Spirits: " .. monster1 .. "/n Great Water Spirits: " .. monster2 .. "/n Hydros: " .. monster3 ..""
function onSay(cid, words, param, channel)
if (isPlayer(param)) then
doShowTextDialog(cid, 2175, text)
else
doShowTextDialog(cid, 2175, text)
end
[edit] The randmonsters = is the numbers that will spawn the monster when the math.radom picks a number between 1 and 1000.
so water elemental has 20/1000 chance, thats 1/50 chance.
Last edited: