Itutorial
Legendary OT User
- Joined
- Dec 23, 2014
- Messages
- 2,334
- Solutions
- 68
- Reaction score
- 1,012
I know there are a bunch of these but I wanted to give one with more options.. Also, you can use !catchs talkaction to see how many catch you have.
Action Script
Talkaction script
Action Script
Code:
local waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4665, 4664, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 7236, 10499, 15401, 15402}
local use_bait, bait, bait_chance = false, 3976, 1 --Will remove bait every time, if you put 10 its 1/10 chance.
local monsters = {
--monster name, storage for talkaction, chance to catch, level to catch, fishing level to catch, bc message, msg to broadcast, magicEffect sent to player, ME sent to monster, Monster msg when spawn
[1] = {name = "Dragon", storage = 30000, chance = 1, level = 1, fishing = 1, bc = true, msg = "|PLAYER| has caught a Dragon!", magic_effect_player = 9, magic_effect_monster = 10, monster_say_when_spawn = "Time to die."},
[2] = {name = "Dragon Lord", storage = 30001, chance = 1250, level = 45, fishing = 30, bc = true, msg = "A Dragon Lord is attacking |PLAYER|!", magic_effect_player = 11, magic_effect_monster = 13, monster_say_when_spawn = "Time to die."}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if getTilePzInfo(player:getPosition()) then return player:sendCancelMessage("You cannot use the fishing rod in a protection zone.") end
if not isInArray(waterIds, target.itemid) then return false end
if use_bait and player:getItemCount(bait) < 1 then return player:sendCancelMessage("You must have worms to fish.")
elseif player:getItemCount(bait) >= 1 then
if math.random(1, bait_chance) == 1 then
player:removeItem(bait, 1)
end
end
for i = 1, #monsters do
if player:getLevel() >= monsters[i].level and player:getSkillLevel(6) >= monsters[i].fishing then
if math.random(1, monsters[i].chance) == 1 then
EVENT = monsters[i]
MONS = Game.createMonster(EVENT.name, player:getPosition())
createFishingMonster(player, MONS, toPosition, EVENT)
break
end
end
end
doSendMagicEffect(toPosition, 2)
doPlayerAddSkillTry(player, 6, 1, true)
return true
end
function createFishingMonster(player, MONS, toPosition, EVENT)
if not MONS then return false end
MONS:say(EVENT.monster_say_when_spawn, TALKTYPE_MONSTER_SAY, 0, 1, MONS:getPosition())
doSendMagicEffect(MONS:getPosition(), EVENT.magic_effect_monster)
doSendMagicEffect(player:getPosition(), EVENT.magic_effect_player)
doSendMagicEffect(toPosition, CONST_ME_WATERCREATURE)
if EVENT.bc then
text = string.gsub(EVENT.msg, "|PLAYER|", player:getName())
Game.broadcastMessage(text)
end
end
Talkaction script
Code:
local monsters = {
[1] = {name = "Dragon", storage = 30000},
[2] = {name = "Dragon Lord", storage = 30001}
}
function onSay(player, words, param)
for i = 1, #monsters do
if player:getStorageValue(monsters[i].storage) < 0 then
player:setStorageValue(monsters[i].storage, 0)
end
end
text = ""
for i = 1, #monsters do
text = text.."["..monsters[i].name.."]: "..player:getStorageValue(monsters[i].storage).."\n"
end
doShowTextDialog(player, 2580, text)
return false
end
Last edited: