• 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!

TFS 1.X+ Fishing Rod tfs 0.4 to tfs 1.5

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
881
Solutions
7
Reaction score
122
Location
Brazil
YouTube
caruniawikibr
Hello, I'm trying to adapt this script from my old tfs 0.4 server to version 1.5 and an error is appearing in the distro, could anyone tell me how to adapt?



Lua:
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
}

--water elementals config
local find_anything = 30 -- chance to find anything.
local difficulty = 40 -- 1-100 range for difficulty. The higher it is, the less likely it is that player will get a good item

local items = {
[10499] = {2238, 2226, 2148, 2376, 2509, 2168, 7588, 7589, 2152, 2146, 2149, 2169, 7632, 7633, 9811, 9808, 8764, 10220}, -- normal water and massive. I noticed that they are the same one.(based on tibiawikia) QuaS
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if items[itemEx.itemid] ~= nil then
              if math.random(100) <= find_anything then
                        doTransformItem(itemEx.uid, 2016)
                        doDecayItem(itemEx.uid)
                        doSendMagicEffect(toPosition, 1)
                else
                        local geti = items[itemEx.itemid]
                        local newId
                        for i = 1, #items[itemEx.itemid] do
                                local x = math.random(100)
                                                        if (x < difficulty) then
                                                        newId = geti[i]
                                                        break
                                                        elseif (i >= #items[itemEx.itemid]) then
                                                        newId = geti[#items[itemEx.itemid]]
                                                        end   
                        end

                        doTransformItem(itemEx.uid, 2016)
                        doPlayerAddItem(cid, newId, 1)
                        doSendMagicEffect(toPosition, 1)

                end
        end

        if(not isInArray(config.waterIds, itemEx.itemid)) then
                return false
        end

        if((config.allowFromPz or not getTileInfo(getCreaturePosition(cid)).protection) and itemEx.itemid ~= 493 and
                math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) < getPlayerSkill(cid, SKILL_FISHING) and
                (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1)))) then
                doPlayerAddItem(cid, ITEM_FISH, 1)
                doPlayerAddSkillTry(cid, SKILL_FISHING, config.rateSkill)
        end

        doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
        return true
end

1651954802004.png
 
Lua:
rateSkill = getConfigValue("rateSkill"),

It's that line that's causing the issue. Seems like the function has been removed from TFS 1.5.

I guess change it out for whatever rateskill number you have in your config.
 
I know it's asking a lot, but I have holes in the middle of the desert where there's an action 2554 from the shovel, but I can't open them, could you help me?

Lua:
local holes = {468, 481, 483}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if not tile then
        return false
    end

    local ground = tile:getGround()
    if not ground then
        return false
    end

    local groundId = ground:getId()
    if table.contains(holes, groundId) then
        ground:transform(groundId + 1)
        ground:decay()

        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)
    elseif groundId == 231 then
        local randomValue = math.random(1, 100)
        if randomValue == 1 then
            Game.createItem(2159, 1, toPosition)
        elseif randomValue > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end

    return true
end
 
I know it's asking a lot, but I have holes in the middle of the desert where there's an action 2554 from the shovel, but I can't open them, could you help me?

Lua:
local holes = {468, 481, 483}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if not tile then
        return false
    end

    local ground = tile:getGround()
    if not ground then
        return false
    end

    local groundId = ground:getId()
    if table.contains(holes, groundId) then
        ground:transform(groundId + 1)
        ground:decay()

        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)
    elseif groundId == 231 then
        local randomValue = math.random(1, 100)
        if randomValue == 1 then
            Game.createItem(2159, 1, toPosition)
        elseif randomValue > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end

    return true
end
Why not add hole id to holes array?
 
because if I put sand in the holes id it will open a hole in all the desert sands :/
View attachment 67656
Add this
Lua:
local sandHoles = {} -- add sand ids
local sandAID = 2554

and change
Lua:
if table.contains(holes, groundId) then
to
Lua:
if table.contains(holes, groundId) or (ground:getActionId() == sandAID and table.contains(sandHoles, groundId)) then
 
Back
Top