• Vote in May Mapping Competition to select a winner!
  • 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

Infernum

Asshole
Support Team
Joined
Feb 14, 2015
Messages
5,450
Best answers
540
Reaction score
3,290
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};
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
522
Best answers
14
Reaction score
217
Location
Argentina
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!
 

oshrigames

Active Member
Joined
Nov 9, 2012
Messages
221
Best answers
0
Reaction score
38
Location
israel
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!
 

Otfan125

Member
Joined
Mar 1, 2008
Messages
94
Best answers
0
Reaction score
8
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.
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
522
Best answers
14
Reaction score
217
Location
Argentina
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:
 

royalpala

Member
Joined
Dec 31, 2019
Messages
21
Best answers
0
Reaction score
8
@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.
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
522
Best answers
14
Reaction score
217
Location
Argentina
@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:

felipe carvalho

New Member
Joined
Mar 13, 2020
Messages
23
Best answers
0
Reaction score
0
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
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
522
Best answers
14
Reaction score
217
Location
Argentina
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
 

felipe carvalho

New Member
Joined
Mar 13, 2020
Messages
23
Best answers
0
Reaction score
0
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
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
522
Best answers
14
Reaction score
217
Location
Argentina
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
How is it not working? Got any errors?
 

rickgv

Member
Joined
Oct 22, 2007
Messages
44
Best answers
0
Reaction score
9
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:

grayn

New Member
Joined
Nov 23, 2019
Messages
1
Best answers
0
Reaction score
0
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
 
Top