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

Error with skills - TFS 0.4 - 8.6

hanzoha

New Member
Joined
May 8, 2016
Messages
87
Reaction score
2
Hello guys.

Everytime I want to update a God's or a player's skills from mysql I get an error. The error only presents when I use a weapon that belongs to that skill.

Let's say I update the table using a value of "200" on the Distance skill.
Then, I login to the server (everything normal) but, As soon as I use a crossbow or any weapon that involves that skill, what happens is that suddenly the sever just kicks me and I can get in again. No errors in console


When I check in the database, the skill that I used is updating again and again, and it never stops.

Do you know a solution for that?

Thanks!
 
yeah, use
/addskill Xikini, distance
/addskill Xikini, distance
/addskill Xikini, distance
x 187


Skill max is based on vocations.xml.
If you change the character skills above this point, your going to get error's.
Give player skills in-game, and you won't get any errors. :p
 
Thx Xikini! You're a life saver.

I want to remove the limit of the max skills a player can get.
Where can I change that? Also, magic level on God it can't be more than 150 or server crashes.

Here's my vocations.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">
        <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.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="1" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="1">
        <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.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="2" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="2">
        <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.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="3" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="3">
        <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.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="4" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" 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>
    <vocation id="5" name="Master Sorcerer" description="a master sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
        <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.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="6" name="Elder Druid" description="an elder druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
        <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.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="7" name="Royal Paladin" description="a royal paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
        <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.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="8" name="Elite Knight" description="an elite knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
        <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>
</vocations>
 
You might need to change that in onAdvance.

data/creaturescripts/scripts/advancesave.lua
Code:
local config = {
    savePlayersOnAdvance = true,
    maxLevel = 150
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill ~= SKILL_LEVEL then
        if newLevel >= config.maxLevel then
            newLevel = config.maxLevel
        end
    end
 
    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end

    return true
end
 
You might need to change that in onAdvance.

data/creaturescripts/scripts/advancesave.lua
Code:
local config = {
    savePlayersOnAdvance = true,
    maxLevel = 150
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill ~= SKILL_LEVEL then
        if newLevel >= config.maxLevel then
            newLevel = config.maxLevel
        end
    end

    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end

    return true
end

Thank you very much. Now level is working...
From I can see this works only for Exp Level, not for skills...Is it possible to add skills and magic too?

Thanks!
 
Sorry, I thought that is what it did :(

Sorry, I didn't want to look mean to you xD

I found this script (which is a skill limiter) in another thread, is it possible to modify it in order to add skills and magic new limit?
Thanks!

Code:
function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL_SWORD then
        if getPlayerSkillLevel(cid, SKILL_SWORD) >= 171 then
                doPlayerSetRate(cid, SKILL_SWORD, 0.0)
        end
  
    elseif skill == SKILL_SWORD then
        if getPlayerSkillLevel(cid, SKILL_FIST) >= 171 then
                doPlayerSetRate(cid, SKILL_FIST, 0.0)
        end  
    return false
  
    elseif skill == SKILL_AXE then
        if getPlayerSkillLevel(cid, SKILL_AXE) >= 171 then
                doPlayerSetRate(cid, SKILL_AXE, 0.0)
        end  
    return false
  
    elseif skill == SKILL_CLUB then
        if getPlayerSkillLevel(cid, SKILL_CLUB) >= 171 then
                doPlayerSetRate(cid, SKILL_CLUB, 0.0)
        end  
    return false
  
    elseif skill == SKILL_DISTANCE then
        if getPlayerSkillLevel(cid, SKILL_DISTANCE) >= 171 then
                doPlayerSetRate(cid, SKILL_DISTANCE, 0.0)
        end  
    return false
  
    elseif skill == SKILL_SHIELD then
        if getPlayerSkillLevel(cid, SKILL_FIST) >= 171 then
                doPlayerSetRate(cid, SKILL_FIST, 0.0)
        end  
    return false
  
    elseif skill == SKILL_FISH then
        if getPlayerSkillLevel(cid, SKILL_FISH) >= 171 then
                doPlayerSetRate(cid, SKILL_FISH, 0.0)
        end  
    return false
  
end
end
 
I just simplified the script you posted and combined it with the default onAdvance script.
Code:
--[[
    SKILL_FIST = 0
    SKILL_CLUB = 1
    SKILL_SWORD = 2
    SKILL_AXE = 3
    SKILL_DISTANCE = 4
    SKILL_SHIELD = 5
    SKILL_FISHING = 6
    SKILL_MAGLEVEL = 7
    SKILL_LEVEL = 8
]]
local config = {
    savePlayersOnAdvance = true,
    skillsArray = {1,2,3,4,5,6},
    maxLevel = 150,
    rate = 0.0
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if isInArray(config.skillsArray, skill) then
        if getPlayerSkillLevel(cid, skill) >= config.maxLevel then
            doPlayerSetRate(cid, skill, config.rate)
        end
    end
   
    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end
    return true
end
Beyond that I am unsure of what you want to do :(
 
@Omni Cloud I can't really tell if the script is working, but thank you very much.

I was doing some testing and I realize that God and Players can get up to this limits in skills:

Magic: 156
Fist: 56
Club: 37
Sword: 37
Axe: 37
Distance: 38
Shielding: 54

After that, nothing happens

Does anyone have an idea where can I change those limits?

Thanks!

BUMP!

bump
 
Last edited by a moderator:
24 hour bump rule hanzoha.

https://otland.net/threads/tfs-0-3-6-star-skills-problem.241293/#post-2334700


I just simplified the script you posted and combined it with the default onAdvance script.
Code:
--[[
    SKILL_FIST = 0
    SKILL_CLUB = 1
    SKILL_SWORD = 2
    SKILL_AXE = 3
    SKILL_DISTANCE = 4
    SKILL_SHIELD = 5
    SKILL_FISHING = 6
    SKILL_MAGLEVEL = 7
    SKILL_LEVEL = 8
]]
local config = {
    savePlayersOnAdvance = true,
    skillsArray = {1,2,3,4,5,6},
    maxLevel = 150,
    rate = 0.0
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if isInArray(config.skillsArray, skill) then
        if getPlayerSkillLevel(cid, skill) >= config.maxLevel then
            doPlayerSetRate(cid, skill, config.rate)
        end
    end
  
    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end
    return true
end
Beyond that I am unsure of what you want to do :(
I think you'll need to create a onLogin event as well, otherwise when players relog they would be able to advance their skills again.
 
Last edited:
Back
Top