• 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+ Skills rates

leandroluck

New Member
Joined
Dec 24, 2010
Messages
104
Reaction score
1
Code:
local config = {


        -- base vocationId
        [1] = {
                -- skillId
                [SKILL_FIST] = {
                        -- [{skillLevel}] = skillRate
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5

                        },
                [SKILL_CLUB] = {
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5
                },
                [SKILL_SWORD] = {
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5
                },
                [SKILL_AXE] = {
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5
                },
                [SKILL_DISTANCE] = {
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5
                },
                [SKILL_SHIELD] = {
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5
                },
                [SKILL_FISHING] = {
                        [{10, 60}] = 70,
                        [{61, 80}] = 30,
                        [{81, 100}] = 10,
                        [{101, 300}] = 5
                },
                [SKILL_MAGLEVEL] = {
                        [{0, 6}] = 20,
                        [{7, 15}] = 10,
                        [{16, 80}] = 5,
                        [{81, 90}] = 3,
                        [{91, 95}] = 2,               
                        [{96, 300}] = 1               
                       
                }
        },


local function getSkillRate(player, skillId)
        local targetVocation = config[player:getVocation():getBase():getId()]
        if targetVocation then
                local targetSkillStage = targetVocation[skillId]
                if targetSkillStage then
                       local skillLevel = skillId ~= SKILL_MAGLEVEL and player:getSkillLevel(skillId) or player:getBaseMagicLevel()
                        for level, rate in pairs(targetSkillStage) do
                                if skillLevel >= level[1] and skillLevel <= level[2] then
                                        return rate
                                end
                        end
                end
        end

        return skillId == SKILL_MAGLEVEL and configManager.getNumber(configKeys.RATE_MAGIC) or configManager.getNumber(configKeys.RATE_SKILL)
end

function Player:onGainSkillTries(skill, tries)
        if not APPLY_SKILL_MULTIPLIER then
                return tries
        end

        return tries * getSkillRate(self, skill)
end

Hello the problem is that when I activate this script the players are gaining the exp x1 not by stages
 
Solution
config.lua · master · Erick Nunes Mello Mattos / Otxserver-Global · GitLab


I do not have this option in config.lua
which looks like it's actually the skill rates script is not being activated.

Leandro, veja o meu config:

-- Rates
experienceStages = false
rateExperience = 2.0
rateExperienceFromPlayers = 0
levelToOfflineTraining = 8
rateSkill = 1.0
rateSkillOffline = 0.5
rateMagic = 1.0
rateMagicOffline = 0.5
rateLoot = 1.0
rateSpawnMin = 15
rateSpawnMax = 25
formulaLevel = 1.0
formulaMagic = 1.0

Veja meu vocation.xml - exemplo knight

<vocation id="4" clientId="1" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="12"...
did you define APPLY_SKILL_MULTIPLIER ?
it only uses stages if APPLY_SKILL_MULTIPLIER is set to true
 
did you define APPLY_SKILL_MULTIPLIER ?
it only uses stages if APPLY_SKILL_MULTIPLIER is set to true
Hello,
in case the experience was working by the normal system of stages after activating this script it stopped working and it was 1x and this system of skills worked

my config.lua
-- Rates
-- NOTE: rateExp is not used if you have enabled stages in data/XML/stages.xml
rateExp = 1
rateSkill = 0
rateLoot = 4
rateMagic = 0
rateSpawn = 1

events.lua
<!-- Player methods -->
<event class="Player" method="onBrowseField" enabled="0" />
<event class="Player" method="onLook" enabled="1" />
<event class="Player" method="onLookInBattleList" enabled="1" />
<event class="Player" method="onLookInTrade" enabled="1" />
<event class="Player" method="onLookInShop" enabled="0" />
<event class="Player" method="onMoveItem" enabled="1" />
<event class="Player" method="onMoveCreature" enabled="0" />
<event class="Player" method="onReportBug" enabled="1" />
<event class="Player" method="onReportRuleViolation" enabled="1" />
<event class="Player" method="onTurn" enabled="1" />
<event class="Player" method="onTradeRequest" enabled="1" />
<event class="Player" method="onTradeAccept" enabled="0" />
<event class="Player" method="onGainExperience" enabled="1" />
<event class="Player" method="onLoseExperience" enabled="0" />
<event class="Player" method="onGainSkillTries" enabled="1" />
 
I tested it '0' and '1' else did not work

well what I wanted to understand is even bouncing 1000x the percentage goes up very low
 
Last edited:
Your .lua is config by 0 rates of skill. Then the stages will get the basis which is 1x. If you change to 50x, then it will work.
 
Does your server has that ugly thing called "formula damages" in config.lua or vocations.xml?
config.lua has nothing. and in vocation.xml
in vocation -
<vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="2" gainmanaamount="25" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.1" />
<skill id="1" multiplier="1.1" />
<skill id="2" multiplier="1.1" />
<skill id="3" multiplier="1.1" />
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
</vocations>
 
That's it then. On the config.lua there must be something named "Formula Rates etc." I can't recall right now, but as soon as I get home I will look into it. Did you recall of deleting this part of the config.lua? That's why its not working.. it must be something in config.lua in formula rates. Once you have that, the stages will be working again, since its basis is from vocation xml, which is based on config.lua as well (in the formula thing). I don't know if you understand me. Try to redownload your config.lua e look for "formula rates".
 
That's it then. On the config.lua there must be something named "Formula Rates etc." I can't recall right now, but as soon as I get home I will look into it. Did you recall of deleting this part of the config.lua? That's why its not working.. it must be something in config.lua in formula rates. Once you have that, the stages will be working again, since its basis is from vocation xml, which is based on config.lua as well (in the formula thing). I don't know if you understand me. Try to redownload your config.lua e look for "formula rates".
config.lua · master · Erick Nunes Mello Mattos / Otxserver-Global · GitLab


I do not have this option in config.lua
which looks like it's actually the skill rates script is not being activated.
 
config.lua · master · Erick Nunes Mello Mattos / Otxserver-Global · GitLab


I do not have this option in config.lua
which looks like it's actually the skill rates script is not being activated.

Leandro, veja o meu config:

-- Rates
experienceStages = false
rateExperience = 2.0
rateExperienceFromPlayers = 0
levelToOfflineTraining = 8
rateSkill = 1.0
rateSkillOffline = 0.5
rateMagic = 1.0
rateMagicOffline = 0.5
rateLoot = 1.0
rateSpawnMin = 15
rateSpawnMax = 25
formulaLevel = 1.0
formulaMagic = 1.0

Veja meu vocation.xml - exemplo knight

<vocation id="4" clientId="1" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="12" gainmanaamount="1" manamultiplier="3.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
</vocation>

e meus arquivos skillstagesadvance.lua
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")
function onAdvance(cid, skill, oldLevel, newLevel)
if(skillStages[skill] ~= nil) then
local skillRate = 1
local oldRates = getPlayerRates(cid)
for i, skillRateInfo in pairs(skillStages[skill]) do
if(newLevel >= skillRateInfo[1]) then
skillRate = skillRateInfo[2]
else
break
end
end
doPlayerSetRate(cid, skill, skillRate)
if(showInfoOnAdvance and skillRate ~= oldRates[skill]) then
if(skill >= 0 and skill <= 6) then
configRate = skillConfig.skill
else
configRate = skillConfig.magiclevel
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, SKILL_NAMES[skill] .. " rate changed from " .. oldRates[skill] * configRate .. "x to " .. skillRate * configRate .. "x. " .. getPlayerSkillRatesText(cid))
end
end
return true
end

arquivo skillstageslogin.lua
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")
function onLogin(cid)
for skill, skillStage in pairs(skillStages) do
if(skill >= 0 and skill <= 6) then
nowSkill = getPlayerSkillLevel(cid, skill)
else
nowSkill = getPlayerMagLevel(cid, true)
end
for i, skillRateInfo in pairs(skillStage) do
if(nowSkill >= skillRateInfo[1]) then
skillRate = skillRateInfo[2]
else
break
end
end
doPlayerSetRate(cid, skill, skillRate)
end
if(showInfoOnLogin) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerSkillRatesText(cid))
end
registerCreatureEvent(cid, "SkillStagesAdvance")
return TRUE
end

stagesconfig.lua
skillConfig = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStages = {}
skillStages[SKILL_FIST] = {{0,7},{40,7},{70,5}}
skillStages[SKILL_CLUB] = {{0,7},{40,7},{70,5}}
skillStages[SKILL_SWORD] = {{0,7},{40,7},{70,5}}
skillStages[SKILL_AXE] = {{0,7},{40,7},{70,5}}
skillStages[SKILL_DISTANCE] = {{0,6},{40,5},{70,4}}
skillStages[SKILL_SHIELD] = {{0,5},{50,4},{70,3}}
skillStages[SKILL_FISHING] = {{0,6},{60,5},{80,4},{100,2},{110,1}} -- uncomment it to make it work, you can remove other skill config if you dont need it
skillStages[SKILL__MAGLEVEL] = {{0,5},{7,2}}
showInfoOnAdvance = false -- send player message about skill rate change
showInfoOnLogin = false -- send player message about skill rates when he login
function getPlayerSkillRatesText(cid)
local skillInfo = getPlayerRates(cid)
return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfig.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfig.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfig.skill .. "x | Sword: " .. skillInfo[SKILL_SWORD] * skillConfig.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfig.skill .. "x | Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfig.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfig.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfig.skill .. "x ]"
end

tenta copiar e ve se dá certo.
 
Solution
Leandro, veja o meu config:



Veja meu vocation.xml - exemplo knight



e meus arquivos skillstagesadvance.lua


arquivo skillstageslogin.lua


stagesconfig.lua


tenta copiar e ve se dá certo.

Você pode explicar melhor? Por favor. Parece que não funciona, adaptei aqui para testar e não deu nada certo.
 
Back
Top