• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Captured Fishing Monster script tfs 0.3.2 change to tfs 0.3.6

zcorpy

New Member
Joined
Sep 12, 2017
Messages
85
Reaction score
4
good morning to all! I need help with a script !! it is called captured fishing monster the script that I will show you was for tfs 0.3.2 and now I am already using tfs 0.3.6 and it does not work for me who can help me please?

function onUse(cid, item, frompos, item2, topos)
local r = {
[28] = 210,
[29] = 180,
[30] = 45}
local s = math.random(28,30)
if item.itemid == 5928 then
if getTilePzInfo(getThingPos(cid)) == FALSE then
if isMonster(item2.uid) == TRUE then
setItemArticle(item.uid, getCreatureName(item2.uid))
doRemoveCreature(item2.uid)
doSendMagicEffect(topos, s)
doSendAnimatedText(topos, 'Captured!', r)
doTransformItem(item.uid, 5929)
return TRUE
else
doSendMagicEffect(frompos, 2)
doPlayerSendCancel(cid, 'You cannot catch it.')
return TRUE
end
return TRUE
else
doPlayerSendCancel(cid, 'You cannot use in protection zone.')
doSendMagicEffect(frompos, 2)
return TRUE
end
elseif item.itemid == 5929 then
if getTilePzInfo(getThingPos(cid)) == FALSE then
doCreateMonster(getItemDescriptions(item.uid).article, getThingPos(cid))
return doRemoveItem(item.uid, 1)
else
return doPlayerSendCancel(cid, 'You cannot use in protection zone.')
end
end
return TRUE
end
 
Solution
Okay, with this other players cannot capture another players monster if he releases from bowl.

Lua:
----Add this to global.lua---
releasedMonsters = {}
----------------------------

local monsters = {
    [1] = {name = "Troll", aid = 1000},
    [2] = {name = "Cyclops", aid = 1001},
    [3] = {name = "Dragon", aid = 1002},
    [4] = {name = "Demon", aid = 1003}
}

local effects = {
[1] = {28, 210},
[2] = {29, 180},
[3] = {30, 45}
}

function onUse(cid, item, frompos, item2, topos)
if item.itemid == 5928 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot capture monsters in protection zone.")
    end

  local MONS = nil
    for i = 1, #monsters do
        if monsters[i].name ==...
Code:
function onUse(cid, item, frompos, item2, topos)
local r = {
[28] = 210,
[29] = 180,
[30] = 45}
local s = math.random(28,30)
if item.itemid == 5928 then
if getTilePzInfo(getThingPos(cid)) == FALSE then
if isMonster(item2.uid) == TRUE then
setItemArticle(item.uid, getCreatureName(item2.uid))
doRemoveCreature(item2.uid)
doSendMagicEffect(topos, s)
doSendAnimatedText(topos, 'Captured!', r)
doTransformItem(item.uid, 5929)
return TRUE
else
doSendMagicEffect(frompos, 2)
doPlayerSendCancel(cid, 'You cannot catch it.')
return TRUE
end
return TRUE
else
doPlayerSendCancel(cid, 'You cannot use in protection zone.')
doSendMagicEffect(frompos, 2)
return TRUE
end
elseif item.itemid == 5929 then
if getTilePzInfo(getThingPos(cid)) == FALSE then
doCreateMonster(getItemDescriptions(item.uid).article, getThingPos(cid))
return doRemoveItem(item.uid, 1)
else
return doPlayerSendCancel(cid, 'You cannot use in protection zone.')
end
end
return TRUE
end

You are welcome
 
Code:
function onUse(cid, item, frompos, item2, topos)
local r = {
[28] = 210,
[29] = 180,
[30] = 45}
local s = math.random(28,30)
if item.itemid == 5928 then
if getTilePzInfo(getThingPos(cid)) == FALSE then
if isMonster(item2.uid) == TRUE then
setItemArticle(item.uid, getCreatureName(item2.uid))
doRemoveCreature(item2.uid)
doSendMagicEffect(topos, s)
doSendAnimatedText(topos, 'Captured!', r)
doTransformItem(item.uid, 5929)
return TRUE
else
doSendMagicEffect(frompos, 2)
doPlayerSendCancel(cid, 'You cannot catch it.')
return TRUE
end
return TRUE
else
doPlayerSendCancel(cid, 'You cannot use in protection zone.')
doSendMagicEffect(frompos, 2)
return TRUE
end
elseif item.itemid == 5929 then
if getTilePzInfo(getThingPos(cid)) == FALSE then
doCreateMonster(getItemDescriptions(item.uid).article, getThingPos(cid))
return doRemoveItem(item.uid, 1)
else
return doPlayerSendCancel(cid, 'You cannot use in protection zone.')
end
end
return TRUE
end

You are welcome

it still does not work check error in console --> Imgur: The magic of the Internet
 
Last edited:
Lua:
local effects = {
[1] = {28, 210},
[2] = {29, 180},
[3] = {30, 45}
}

function onUse(cid, item, frompos, item2, topos)
if item.itemid ~= 5928 then return false end

if getTilePzInfo(getPlayerPosition(cid)) then
    return doPlayerSendCancel(cid, "You cannot capture monsters in protection zone.")
end

if not isMonster(item2.uid) then return false end

local EFF = effects[math.random(1, 3)]

if not EFF then
    return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
end

doItemSetAttribute(item.uid, "desc", getCreatureName(item2.uid))
doRemoveCreature(item2.uid)
doSendMagicEffect(topos, EFF[1])
doSendAnimatedText(topos, 'Captured!', EFF[2])
doTransformItem(item.uid, 5929)
return true
end
 
Lua:
local effects = {
[1] = {28, 210},
[2] = {29, 180},
[3] = {30, 45}
}

function onUse(cid, item, frompos, item2, topos)
if item.itemid ~= 5928 then return false end

if getTilePzInfo(getPlayerPosition(cid)) then
    return doPlayerSendCancel(cid, "You cannot capture monsters in protection zone.")
end

if not isMonster(item2.uid) then return false end

local EFF = effects[math.random(1, 3)]

if not EFF then
    return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
end

doItemSetAttribute(item.uid, "desc", getCreatureName(item2.uid))
doRemoveCreature(item2.uid)
doSendMagicEffect(topos, EFF[1])
doSendAnimatedText(topos, 'Captured!', EFF[2])
doTransformItem(item.uid, 5929)
return true
end

yes he managed to capture it but he can not release it and he does not have text what was captured
 
he does not have text what was captured

What do you mean? It doesn't show on the item? or you want the player to receive a message saying he caught the monster?
 
he does not have text what was captured

What do you mean? It doesn't show on the item? or you want the player to receive a message saying he caught the monster?
if something like that but I also want that once the monster was captured, the monster that was captured was released when the fish was clicked on the fish tank
 
Okay, with this other players cannot capture another players monster if he releases from bowl.

Lua:
----Add this to global.lua---
releasedMonsters = {}
----------------------------

local monsters = {
    [1] = {name = "Troll", aid = 1000},
    [2] = {name = "Cyclops", aid = 1001},
    [3] = {name = "Dragon", aid = 1002},
    [4] = {name = "Demon", aid = 1003}
}

local effects = {
[1] = {28, 210},
[2] = {29, 180},
[3] = {30, 45}
}

function onUse(cid, item, frompos, item2, topos)
if item.itemid == 5928 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot capture monsters in protection zone.")
    end

  local MONS = nil
    for i = 1, #monsters do
        if monsters[i].name == getCreatureName(item2.uid) then
            MONS = monsters[i]
            break
        end
    end
 
    if not MONS then
        return doPlayerSendCancel(cid, "You cannot capture this monster.")
    end

    local EFF = effects[math.random(1, 3)]

    if not EFF then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
 
    if releasedMonsters[item2.uid] and releasedMonsters[item2.uid] ~= getPlayerGUID(cid) then
        return doPlayerSendCancel(cid, "This monster is not yours to catch.")
    end

    doItemSetAttribute(item.uid, "description", "It contains a: "..getCreatureName(item2.uid)..".")
    doItemSetAttribute(item.uid, "aid", MONS.aid)
    if releasedMonsters[item2.uid] then
        releasedMonsters[item2.uid] = nil
    end
    doRemoveCreature(item2.uid)
    doSendMagicEffect(topos, EFF[1])
    doSendAnimatedText(topos, 'Captured!', EFF[2])
    doTransformItem(item.uid, 5929)
 
elseif item.itemid == 5929 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot release monsters in protection zone.")
    end
    local MONS = nil
    for i = 1, #monsters do
        if monsters[i].aid == getItemAttribute(item.uid, "aid") then
            MONS = monsters[i]
            break
        end
    end
 
    if not MONS then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
 
    local EFF = effects[math.random(1, 3)]

    if not EFF then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
 
    local mons = doCreateMonster(MONS.name, getCreaturePosition(cid))
 
    if mons then
        releasedMonsters[mons] = getPlayerGUID(cid)
        doSendMagicEffect(getCreaturePosition(mons), EFF[1])
        doSendAnimatedText(getCreaturePosition(mons), 'Released!', EFF[2])
        doRemoveItem(item.uid, 1)
    else
        return doPlayerSendCancel(cid, "Could not release monster.")
    end
end
return true
end
 
Last edited:
Solution
Okay, with this other players cannot capture another players monster if he releases from bowl.

Lua:
----Add this to global.lua---
releasedMonsters = {}
----------------------------

local monsters = {
    [1] = {name = "Troll", aid = 1000},
    [2] = {name = "Cyclops", aid = 1001},
    [3] = {name = "Dragon", aid = 1002},
    [4] = {name = "Demon", aid = 1003}
}

local effects = {
[1] = {28, 210},
[2] = {29, 180},
[3] = {30, 45}
}

function onUse(cid, item, frompos, item2, topos)
if item.itemid == 5928 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot capture monsters in protection zone.")
    end

    for i = 1, #monsters do
        if monsters[i].name == getCreatureName(item2.uid) then
            MONS = monsters[i]
            break
        end
    end
  
    if not MONS then
        return doPlayerSendCancel(cid, "You cannot capture this monster.")
    end

    local EFF = effects[math.random(1, 3)]

    if not EFF then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
  
    if releasedMonsters[item2.uid] and releasedMonsters[item2.uid] ~= getPlayerGUID(cid) then
        return doPlayerSendCancel(cid, "This monster is not yours to catch.")
    end

    doItemSetAttribute(item.uid, "description", "It contains a: "..getCreatureName(item2.uid)..".")
    doItemSetAttribute(item.uid, "aid", MONS.aid)
    if releasedMonsters[item2.uid] then
        releasedMonsters[item2.uid] = nil
    end
    doRemoveCreature(item2.uid)
    doSendMagicEffect(topos, EFF[1])
    doSendAnimatedText(topos, 'Captured!', EFF[2])
    doTransformItem(item.uid, 5929)
  
elseif item.itemid == 5929 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot release monsters in protection zone.")
    end
  
    for i = 1, #monsters do
        if monsters[i].aid == getItemAttribute(item, "aid") then
            MONS = monsters[i]
            break
        end
    end
  
    if not MONS then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
  
    local EFF = effects[math.random(1, 3)]

    if not EFF then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
  
    local mons = doCreateMonster(MONS.name, getCreaturePosition(cid))
  
    if mons then
        releasedMonsters[mons.uid] = getPlayerGUID(cid)
        doSendMagicEffect(getCreaturePosition(mons), EFF[1])
        doSendAnimatedText(getCreaturePosition(mons), 'Released!', EFF[2])
        doRemoveItem(item.uid, 1)
    else
        return doPlayerSendCancel(cid, "Could not release monster.")
    end
end
return true
end

if I capture but when releasing monster is error because if I capture 1 demon appears 1 cyclops and if I capture troll is the same 1 cyclops appears and I can free it as many times as I want it is as if it had unlimited charges
 
Any errors in console?

console say
[error - action inferface]
data/actions/scripts/captured.lua:eek:nu
Description:
data/actions/scripts/captured.lua:80: attempt to index local 'mons' > a number value> stack traceback:
data/actions/scripts/captured.lua:80: in function <data/actions/scripts/captured.lua:18>
 
Okay, with this other players cannot capture another players monster if he releases from bowl.

Lua:
----Add this to global.lua---
releasedMonsters = {}
----------------------------

local monsters = {
    [1] = {name = "Troll", aid = 1000},
    [2] = {name = "Cyclops", aid = 1001},
    [3] = {name = "Dragon", aid = 1002},
    [4] = {name = "Demon", aid = 1003}
}

local effects = {
[1] = {28, 210},
[2] = {29, 180},
[3] = {30, 45}
}

function onUse(cid, item, frompos, item2, topos)
if item.itemid == 5928 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot capture monsters in protection zone.")
    end

    for i = 1, #monsters do
        if monsters[i].name == getCreatureName(item2.uid) then
            MONS = monsters[i]
            break
        end
    end
 
    if not MONS then
        return doPlayerSendCancel(cid, "You cannot capture this monster.")
    end

    local EFF = effects[math.random(1, 3)]

    if not EFF then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
 
    if releasedMonsters[item2.uid] and releasedMonsters[item2.uid] ~= getPlayerGUID(cid) then
        return doPlayerSendCancel(cid, "This monster is not yours to catch.")
    end

    doItemSetAttribute(item.uid, "description", "It contains a: "..getCreatureName(item2.uid)..".")
    doItemSetAttribute(item.uid, "aid", MONS.aid)
    if releasedMonsters[item2.uid] then
        releasedMonsters[item2.uid] = nil
    end
    doRemoveCreature(item2.uid)
    doSendMagicEffect(topos, EFF[1])
    doSendAnimatedText(topos, 'Captured!', EFF[2])
    doTransformItem(item.uid, 5929)
 
elseif item.itemid == 5929 then
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendCancel(cid, "You cannot release monsters in protection zone.")
    end
 
    for i = 1, #monsters do
        if monsters[i].aid == getItemAttribute(item, "aid") then
            MONS = monsters[i]
            break
        end
    end
 
    if not MONS then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
 
    local EFF = effects[math.random(1, 3)]

    if not EFF then
        return doPlayerSendCancel(cid, "Please report this error to the gamemaster.")
    end
 
    local mons = doCreateMonster(MONS.name, getCreaturePosition(cid))
 
    if mons then
        releasedMonsters[mons] = getPlayerGUID(cid)
        doSendMagicEffect(getCreaturePosition(mons), EFF[1])
        doSendAnimatedText(getCreaturePosition(mons), 'Released!', EFF[2])
        doRemoveItem(item.uid, 1)
    else
        return doPlayerSendCancel(cid, "Could not release monster.")
    end
end
return true
end

if now it captures and releases the problem is that now the first thing I capture example I capture 1 troll and then I capture 2 cyclops when releasing the troll if it appears but when releasing the cyclops trolls continue to come out, the first thing I capture is always what that will appear
A little more explained is that the first thing you capture in 1 fish tank will always be the same if you then catch another one because the monster will keep coming out of the first one that captures
 

Similar threads

Back
Top