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

Action Herblore / Mining Skill [TFS 1.1]

one thing i wanna add to it.. is talkaction that show custom skills via modal window.

!Advancedskills
and window show current levels of all the custom skills.
with one button of Exit/Ok.

i will look into it and share it all as one.

thanks for another great contribution!
 
i just notice that new player start at level 10 in both herbalist (harvest plants) and alchemy (make potions)..

any idea how i fix it and rest player skill back to 1?

ps: i got those lines in my login.lua
Lua:
    local skill = 15023 -- herbalist
    if player:getStorageValue(customSkill) == -1 then   
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end
    
    local customSkill = 15022 -- alchemy
    if player:getStorageValue(customSkill) == -1 then   
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end
    
    local skill = 15021 -- mining
    if player:getStorageValue(customSkill) == -1 then   
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end

    local customSkill = 15019 -- smith
    if player:getStorageValue(customSkill) == -1 then   
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end

as far as i know the issue is only at harvest & alchemy..
should i just change storage to reset them?
 
i just notice that new player start at level 10 in both herbalist (harvest plants) and alchemy (make potions)..

any idea how i fix it and rest player skill back to 1?

ps: i got those lines in my login.lua
Lua:
    local skill = 15023 -- herbalist
    if player:getStorageValue(customSkill) == -1 then
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end

    local customSkill = 15022 -- alchemy
    if player:getStorageValue(customSkill) == -1 then
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end

    local skill = 15021 -- mining
    if player:getStorageValue(customSkill) == -1 then
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end

    local customSkill = 15019 -- smith
    if player:getStorageValue(customSkill) == -1 then
        player:setStorageValue(customSkill, 1)
        player:setStorageValue(customSkill + 1, 0)
    end

as far as i know the issue is only at harvest & alchemy..
should i just change storage to reset them?
You are using storages wrong, when you choose an storage for the skill, you must leave the next storage number free.
The system works like this, say you assigned Storage 1000 for Mining. The system will use that storage to store the LEVEL of the skill but not the EXPERIENCE gained, the system will automatically use Storage 1000 + 1 (1001) to store the experience as a counter there. So whenever you want multiple skills you should assign them like this for example:
Code:
local herbalist = 1000
local mining = 1002
local smithing = 1004

That way the storages won't conflict with each skill as 1001 will be used to store herbalist experience automatically, 1003 for mining and 1005 for smithing experience.

If you read carefully at the storage assigned during those logins you will see these lines:
Code:
player:setStorageValue(customSkill, 1)
player:setStorageValue(customSkill + 1, 0)
There is assigning the level 1 for the skill itself and the 0 experience for the skill experience counter.

Also, would like to point out something, you are sometimes naming a var "skill" but never actually using it.
Use this code instead.
Code:
local herbalist = 15023
local alchemy = 15025
local mining = 15027
local smith = 15029

    if player:getStorageValue(herbalist) == -1 then 
        player:setStorageValue(herbalist, 1)
        player:setStorageValue(herbalist + 1, 0)
    end
    if player:getStorageValue(alchemy) == -1 then 
        player:setStorageValue(alchemy, 1)
        player:setStorageValue(alchemy + 1, 0)
    end
    if player:getStorageValue(mining) == -1 then 
        player:setStorageValue(mining, 1)
        player:setStorageValue(mining + 1, 0)
    end
    if player:getStorageValue(smith) == -1 then 
        player:setStorageValue(smith, 1)
        player:setStorageValue(smith + 1, 0)
    end
 
Last edited:
Code:
player:getCustomSkill(15002)
Code:
player:getCustomSkillPercent(15002)

How i can show this in talkaction ?
 
You can use something similar to this one I had when I tested commands:

Code:
local function roundFunct(num, numDecimalPlaces)
  local mult = 10^(numDecimalPlaces or 0)
  return math.floor(num * mult + 0.5) / mult
end

function onSay(player, words, param)
local skill = player:getStorageValue(15012)
local _player = player:getPosition()
local percent = (skill / 200) * 100
local roundNumber = roundFunct(percent, 1)
local experienceSkill = player:getCustomSkillPercent(15012)
local nextLevel = skill + 1

    if skill >= 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Skill Information:"
            .. "\nLv: " ..skill.."."
            .. "\nExperience: " ..experienceSkill.."% to Lv. " ..nextLevel.."."
        _player:sendMagicEffect(CONST_ME_MAGIC_GREEN)
                return false
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You cant use this command.")
        _player:sendMagicEffect(CONST_ME_POFF)
    end
    return false
end

It will output something like this (example) on console with orange text:
Code:
Skill Information:
Lv: 2
Experience: 56% to Lv. 3.


If you're also using OtClient, you may check my other threads to include skills just like the original ones (that appear on the Skills window of the client). With that you won't need any commands, it will appear just like any other skill with progress bar.
 
Last edited:
Back
Top