• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Fishing Rod Script Help

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
LUA:
local water = {
    4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,
    622
}

local fishableWater = {
    4597, 4598, 4599, 4600, 4601, 4602
}

function onUse(player, item, fromPosition, target, toPosition)
    if not target:isItem() then
        return false
    end
   
    if not table.contains(water, target:getId()) then
        return false
    end
   
    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
        if player:getItemCount(3492) >= 1 then
            player:addSkillTries(SKILL_FISHING, 1)
            if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
                player:addItem(3578, 1)
                target:transform(4609, 1)
                target:decay()
                player:removeItem(3492, 1)
            end
        end
    end
   
    target:getPosition():sendMagicEffect(2)
    return true
end


Hello guys, i have a problem with this script, i can advance my fishing skill on (local water) =... how to block the advance of skill there? i want just on local fishableWater skill advance... but ofcorse i want use the fishing rod in local waters too... but no chance to take fish and no advance skill

thanks for help
 
Solution
this on same script? idk how to do it

LUA:
local water = {
    4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,
    622
}

local waterIncreaseSkill = {
    4608, 4610
}

function onUse(player, item, fromPosition, target, toPosition)
    if not target:isItem() then
        return false
    end
 
    if not table.contains(water, target:getId()) then
        return false
    end
 
    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
        if player:getItemCount(3492) >= 1 then
            for i = 1, #waterIncreaseSkill do
                if toPosition:getTile():getThing(STACKPOS_GROUND):getId() == waterIncreaseSkill[i] then...
LUA:
local water = {
    4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,
    622
}

local fishableWater = {
    4597, 4598, 4599, 4600, 4601, 4602
}

function onUse(player, item, fromPosition, target, toPosition)
    if not target:isItem() then
        return false
    end
  
    if not table.contains(water, target:getId()) then
        return false
    end
  
    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
        if player:getItemCount(3492) >= 1 then
            player:addSkillTries(SKILL_FISHING, 1)
            if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
                player:addItem(3578, 1)
                target:transform(4609, 1)
                target:decay()
                player:removeItem(3492, 1)
            end
        end
    end
  
    target:getPosition():sendMagicEffect(2)
    return true
end


Hello guys, i have a problem with this script, i can advance my fishing skill on (local water) =... how to block the advance of skill there? i want just on local fishableWater skill advance... but ofcorse i want use the fishing rod in local waters too... but no chance to take fish and no advance skill

thanks for help

Create one table for the water tiles you want to advance your fishing skill and another for only tiles that will allow you to fish without skill increase, then simply create a function with everything except addSkillTries and execute this function in both cases when player is using fishing rod on any water tile, then just add player:addSkillTries
 
this on same script? idk how to do it

LUA:
local water = {
    4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,
    622
}

local waterIncreaseSkill = {
    4608, 4610
}

function onUse(player, item, fromPosition, target, toPosition)
    if not target:isItem() then
        return false
    end
 
    if not table.contains(water, target:getId()) then
        return false
    end
 
    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
        if player:getItemCount(3492) >= 1 then
            for i = 1, #waterIncreaseSkill do
                if toPosition:getTile():getThing(STACKPOS_GROUND):getId() == waterIncreaseSkill[i] then
                    player:addSkillTries(SKILL_FISHING, 1)
                end
            end
            if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
                player:addItem(3578, 1)
                target:transform(4609, 1)
                target:decay()
                player:removeItem(3492, 1)
            end
        end
    end

    target:getPosition():sendMagicEffect(2)
    return true
end

Add any water ids to the waterIncreaseSkill table, these ids mean that it will increase the skill for the player
 
Solution
LUA:
local water = {
    4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,
    622
}

local waterIncreaseSkill = {
    4608, 4610
}

function onUse(player, item, fromPosition, target, toPosition)
    if not target:isItem() then
        return false
    end
 
    if not table.contains(water, target:getId()) then
        return false
    end
 
    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
        if player:getItemCount(3492) >= 1 then
            for i = 1, #waterIncreaseSkill do
                if toPosition:getTile():getThing(STACKPOS_GROUND):getId() == waterIncreaseSkill[i] then
                    player:addSkillTries(SKILL_FISHING, 1)
                end
            end
            if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
                player:addItem(3578, 1)
                target:transform(4609, 1)
                target:decay()
                player:removeItem(3492, 1)
            end
        end
    end

    target:getPosition():sendMagicEffect(2)
    return true
end

Add any water ids to the waterIncreaseSkill table, these ids mean that it will increase the skill for the player




How delete for not need worms for fishing?
 
LUA:
[LIST=1]
[*]local water = {
[*]    4597, 4598, 4599, 4600, 4601, 4602,
[*]    4609, 4610, 4611, 4612, 4613, 4614,
[*]    4615, 4616, 4617, 4618, 4619, 4620,
[*]    622
[*]}
[*]

[*]local waterIncreaseSkill = {
[*]    4608, 4610
[*]}
[*]

[*]function onUse(player, item, fromPosition, target, toPosition)
[*]    if not target:isItem() then
[*]        return false
[*]    end
[*]

[*]    if not table.contains(water, target:getId()) then
[*]        return false
[*]    end
[*]

[*]    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
[*]                if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
[*]                player:addItem(3578, 1)
[*]                target:transform(4609, 1)
[*]                target:decay()
[*]                end
[*]        end
[*]    end
[*]

[*]    target:getPosition():sendMagicEffect(2)
[*]    return true
[*]end
[/LIST]




This?
 
LUA:
[LIST=1]
[*]local water = {
[*]    4597, 4598, 4599, 4600, 4601, 4602,
[*]    4609, 4610, 4611, 4612, 4613, 4614,
[*]    4615, 4616, 4617, 4618, 4619, 4620,
[*]    622
[*]}
[*]

[*]local waterIncreaseSkill = {
[*]    4608, 4610
[*]}
[*]

[*]function onUse(player, item, fromPosition, target, toPosition)
[*]    if not target:isItem() then
[*]        return false
[*]    end
[*]

[*]    if not table.contains(water, target:getId()) then
[*]        return false
[*]    end
[*]

[*]    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
[*]                if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
[*]                player:addItem(3578, 1)
[*]                target:transform(4609, 1)
[*]                target:decay()
[*]                end
[*]        end
[*]    end
[*]

[*]    target:getPosition():sendMagicEffect(2)
[*]    return true
[*]end
[/LIST]




This?

nonono

this

LUA:
local water = {
    4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,
    622
}
 
local waterIncreaseSkill = {
    4608, 4610
}

function onUse(player, item, fromPosition, target, toPosition)
    if not target:isItem() then
        return false
    end
 
    if not table.contains(water, target:getId()) then
        return false
    end

    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
            for i = 1, #waterIncreaseSkill do
                if toPosition:getTile():getThing(STACKPOS_GROUND):getId() == waterIncreaseSkill[i] then
                    player:addSkillTries(SKILL_FISHING, 1)
                end
            end
            if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then
                player:addItem(3578, 1)
                target:transform(4609, 1)
                target:decay()
            end
    end

    target:getPosition():sendMagicEffect(2)

    return true
end
 
Lua Script Error: [Action Interface]
data/actions/scripts/others/fishing_rod.lua:onUse
data/actions/scripts/others/fishing_rod.lua:23: attempt to call method 'getTile' (a nil value)
stack traceback:
[C]: in function 'getTile'
data/actions/scripts/others/fishing_rod.lua:23: in function <data/actions/scripts/others/fishing_rod.lua:12>
 
Lua Script Error: [Action Interface]
data/actions/scripts/others/fishing_rod.lua:eek:nUse
data/actions/scripts/others/fishing_rod.lua:23: attempt to call method 'getTile' (a nil value)
stack traceback:
[C]: in function 'getTile'
data/actions/scripts/others/fishing_rod.lua:23: in function <data/actions/scripts/others/fishing_rod.lua:12>

aww I think I broke something. I cant test rn

this should work

LUA:
local water = {
  4597, 4598, 4599, 4600, 4601, 4602,
    4609, 4610, 4611, 4612, 4613, 4614,
    4615, 4616, 4617, 4618, 4619, 4620,

    622

}

 

local waterIncreaseSkill = {

    4608, 4610

}

 

function onUse(player, item, fromPosition, target, toPosition)

    if not target:isItem() then

        return false

    end

 

    if not table.contains(water, target:getId()) then

        return false

    end

 

    if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then

        if player:getItemCount(3492) >= 1 or player:getItemCount(3492) < 1 then

            for i = 1, #waterIncreaseSkill do

                if toPosition:getTile():getThing(STACKPOS_GROUND):getId() == waterIncreaseSkill[i] then

                    player:addSkillTries(SKILL_FISHING, 1)

                end

            end

            if math.random(1, 100) <= math.min(math.max(10 + (player:getEffectiveSkillLevel(SKILL_FISHING) - 10) * 0.597, 10), 50) then

                player:addItem(3578, 1)

                target:transform(4609, 1)

                target:decay()

            end

        end

    end

 

    target:getPosition():sendMagicEffect(2)

    return true

end

cant format spaces properly. just copy n paste it
 
Lua Script Error: [Action Interface]
data/actions/scripts/others/fishing_rod.lua:onUse
data/actions/scripts/others/fishing_rod.lua:42: attempt to call method 'getTile' (a nil value)
stack traceback:
[C]: in function 'getTile'
data/actions/scripts/others/fishing_rod.lua:42: in function <data/actions/scripts/others/fishing_rod.lua:18>
 
worked, but the problem is

LUA:
[LIST=1]
[*] if not table.contains(water, target:getId()) then
[*]

[*]        return false
[*]

[*]    end
[/LIST]
now i can't fishing on local waterIncreaseSkill too, and i need in local water only the effect and no skills advanced also no possibility to get fishs there...
 
Back
Top