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

Feature [TFS 1.3] Adding New Skills

FYI for your instructions with vocations.h, you give the exact same line to replace, which means there's no skill multiplier for the skill tries. Instead, the new line should be something like this:
C++:
float skillMultipliers[SKILL_LAST + 1] = {1.5f, 2.0f, 2.0f, 2.0f, 2.0f, 1.5f, 1.1f, 1.1f};
 
Hey Ramirow, thanks a bunch for sharing this code :) I've began learning on c++ for OTs and this helped me a lot :D
I did have trouble updated items.h though; I couldn't find the line of code to change in that file.

I'm also trying to integrate the new skill in melee items/spells. I made a new skill called "Intelligence" (like in DnD), but I can't (yet) make it a requirement for spells (e.g, "You don't have enough intelligence to cast this spell"). I know that in the ForgottenTibia distribution they have this sort of implementation; I'm currently reading that distribution's code. If I get it to work, I'll post here my solution if anyone else had trouble

edit: I should mention I'm using TFS 1.3, stable version.
Pay close attention to the file, items.h is not the same as item.h (You may have tried to edit the last one, search for itemS.h)
For the spells section, you can try to add a check within the spell itself.
A quick example, so you get the idea:
Code:
function onCastSpell(creature, variant)
    if creature:getSkillLevel(SKILL_INTELLIGENCE) => (Int Level for spell) then
        return combat:execute(creature, variant)
    else
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You don't have enough intelligence to cast this spell.")
end


FYI for your instructions with vocations.h, you give the exact same line to replace, which means there's no skill multiplier for the skill tries. Instead, the new line should be something like this:
C++:
float skillMultipliers[SKILL_LAST + 1] = {1.5f, 2.0f, 2.0f, 2.0f, 2.0f, 1.5f, 1.1f, 1.1f};
Might have missed it :c will see if I can update it on main post. Thanks for pointing it out!
 
the guy that keep on giving :)

well done and thanks!
once i move to tfs 1.3 i'll make sure to have this in my pocket!
 
I can not find that line. I even did a grep search for the keyword mentioned in the first post, but found 0 results in the search results.
 
I can not find that line. I even did a grep search for the keyword mentioned in the first post, but found 0 results in the search results.
That's weird, just checked the file on the latest source and it does contain the exact lines I mentioned, I would mind taking a look at your source files if you feel like you need it.
Have a look:
 
@Ramirow how do you make skills to add percentage on the bar when using an item, i.e. fishing, you use the rod and you get some % of skill.??

also how do you set a character to gain intelligence skill percentage when casting a spell or attacking? I have a lot of questions, sorry this is new to me.
 
@Ramirow how do you make skills to add percentage on the bar when using an item, i.e. fishing, you use the rod and you get some % of skill.??

also how do you set a character to gain intelligence skill percentage when casting a spell or attacking? I have a lot of questions, sorry this is new to me.
Sorry for the delayed answer, been kinda busy these weeks.

A) In order to add skill tries for a skill you use, for example in fishing:
Code:
player:addSkillTries(SKILL_FISHING, 1)
This adds 1 try or "exp" for the skill progress itself, it doesn't add a flat %. Replace SKILL_FISHING for any other skill you added using the modifications in these thread.

B) If you want to add it on casting a spell, you just use the same as mentioned above. Will leave you an example of Flame Strike (exori flam).
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 1.4) + 8
    local max = (level / 5) + (magicLevel * 2.2) + 14
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    creature:addSkillTries(SKILL_INTELLIGENCE, 1)
    return combat:execute(creature, variant)
end

This example will only add experience to Intelligence but it will not serve any other purpose than levelling the skill itself. It won't add damage to it or anything, for that you will need to modify the spell formula you have in the middle of script. You should check for the player's intelligence lvl and then mix that into the formula however you see fit.
 
Last edited:
i don't know who i do it :
ALTER TABLE players
ADD COLUMN skill_runecraft int(10) unsigned NOT NULL DEFAULT 10,
ADD COLUMN skill_runecraft_tries bigint(20) unsigned NOT NULL DEFAULT 0;
-
I need to know if i have to compile everything because i did with notepadd+ and dind't work
 
i don't know who i do it :
ALTER TABLE players
ADD COLUMN skill_runecraft int(10) unsigned NOT NULL DEFAULT 10,
ADD COLUMN skill_runecraft_tries bigint(20) unsigned NOT NULL DEFAULT 0;
-
I need to know if i have to compile everything because i did with notepadd+ and dind't work
That bit you quoted doesn't require you to compile (it's an sql query to run on your existing database), needless to say, all the modifications ranging from tools.cpp to vocation.cpp require you to compile the server again
 
That bit you quoted doesn't require you to compile (it's an sql query to run on your existing database), needless to say, all the modifications ranging from tools.cpp to vocation.cpp require you to compile the server again


the first time I compiled it worked, it was to run the server, now the compile is not working to add this mechanism. do you know a recompile tutorial please
 
Hey, guys, I'm gonna try this tonight.
I have a bunch of ideas and this is going to help me a lot :D
After testing, I'll post my results.
Will use the latest source.

Btw, is the github source stable?

Thanks, @Ramirow


I followed step-by-step, carefully, adding 9 new skills, and it worked perfectly.
 
Last edited:
I've just made 16 new skills (combat, economy, rating) and I am going to create new mechanics to most of them such as interconnectidness between skills, distinguish between core skills, economy skills, and weapon skills, also, new formulas and so much more but none of that could've happen without your kind help, many thanks!

@Ramirow
 
I had problem!
When i up my new skills, when i logoff and log in again my skills won't save correctly:
1592793775452.png
1592793823585.png

When i use this: player:addSkillTries(SKILL_INTELLIGENCE, 200) my skills go up, but when i logoff and login Mining skills receive the intelligence skills, and intelligence skills go to 10, when i logoff again and login my skills mining go to fishing and mining go to 10... lol :/
 
Sorry it took me so long to reply, been really busy this year and I totally forgot about the forum until now. @rickgv and @grayn i'm so happy to hear that! I didn't think many people would even use this, feels amazing that you find it useful or fun to play around with n_n

@Morineau Never tested it, If I have to guess I would say "yes", if you did test it, share your results, maybe it's easy to adapt if it does indeed not work on 1.2

@001rafa sorry again for the delay, i'm almost sure that's because you didn't add the required columns on the players table on your database. Try to run this query on your db:
Code:
ALTER TABLE players
ADD COLUMN skill_yourSkillName int(10) unsigned NOT NULL DEFAULT 10,
ADD COLUMN skill_yourSkillName_tries bigint(20) unsigned NOT NULL DEFAULT 0;
Replace "yourSkillName" with the proper name you gave your skill/s.
 
Hello mr. @Ramirow ! Thank you for the tutorial!

I think I've followed all the way, without making mistakes and updated properly the database.

The thing is, when I equip any item that gives any kind of skill (pally armor for example), it works properly. but if I logout and login, the skills just come back to normal, and I have to dequip and equip again the item for the effect work again.

BEFORE LOGOUT

1596689234813.png

AFTER LOGOUT

1596689281033.png

This happens with Distance as well (these 2 was the only ones I tested)...

If you can help me I really appretiate!

Best!
 
Is it any way to apply a new skill on a database with previously writen characters?
I tried to apply the new skill, but my players are causing debug.
 
Back
Top