• 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+ How/where to edit skills

Stanos

Veteran OT User
Joined
Jun 12, 2018
Messages
615
Solutions
5
Reaction score
351
Location
Europe
Hi,
where and how can i edit my skilling. Example with hands it skills "fist fighting" lets say i want it to change to axe fighting + sword fighting and etc. It would be really nice to learn this kind of stuff
 
Solution
Hi,
where and how can i edit my skilling. Example with hands it skills "fist fighting" lets say i want it to change to axe fighting + sword fighting and etc. It would be really nice to learn this kind of stuff
Well normally skills are acquired using or not using a weapon. However if you wanted added specific skill gain with say a club you could also add skill "tries" to an additional existing skill using a script in weapons.
If you are talking source editing then these are the enums which represent all the default skills.
C++:
enum skills_t : uint8_t {
    SKILL_FIST = 0,
    SKILL_CLUB = 1,
    SKILL_SWORD = 2,
    SKILL_AXE = 3,
    SKILL_DISTANCE = 4,
    SKILL_SHIELD = 5,
    SKILL_FISHING = 6,

    SKILL_MAGLEVEL = 7...
in items.xml you change the properties.
items.cpp in the function
Code:
void Items::parseItemNode(const pugi::xml_node& itemNode, uint16_t id)
search any attribute or propertie what you want.
 
Hi,
where and how can i edit my skilling. Example with hands it skills "fist fighting" lets say i want it to change to axe fighting + sword fighting and etc. It would be really nice to learn this kind of stuff
Well normally skills are acquired using or not using a weapon. However if you wanted added specific skill gain with say a club you could also add skill "tries" to an additional existing skill using a script in weapons.
If you are talking source editing then these are the enums which represent all the default skills.
C++:
enum skills_t : uint8_t {
    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,

    SKILL_FIRST = SKILL_FIST,
    SKILL_LAST = SKILL_FISHING
};

These enums are just the default values, now you could combine like for example
C++:
SKILL_FIRST = SKILL_FIST,
Both SKILL_FIRST & SKILL_FIST reference the same value which is 0, so if you wanted to combine SKILL_CLUB with SKILL_SWORD you could just by stating
C++:
SKILL_CLUB = SKILL_SWORD,
Unfortunately what happens then is if you raise the club skill it will also affect the sword skill and maybe that is not what you are looking for.

Plus there are other factors to consider, methods in the sources which call on these such as std::string getSkillName(uint8_t skillid), this particular method uses a switch statement to return a string that tells you the player what type of skill it is.
C++:
std::string getSkillName(uint8_t skillid)
{
    switch (skillid) {
        case SKILL_FIST:
            return "fist fighting";

        case SKILL_CLUB:
            return "club fighting";

        case SKILL_SWORD:
            return "sword fighting";

        case SKILL_AXE:
            return "axe fighting";

        case SKILL_DISTANCE:
            return "distance fighting";

        case SKILL_SHIELD:
            return "shielding";

        case SKILL_FISHING:
            return "fishing";

        case SKILL_MAGLEVEL:
            return "magic level";

        case SKILL_LEVEL:
            return "level";

        default:
            return "unknown";
    }
}
If you share club with sword then no matter if you are gaining sword tries then you will always get "club fighting" because both club & sword reference the same value.
This is not the only place in the sources that references the skills, the problem is if your goal is to add more skills or combine skills then you could run into more trouble than its worth. It's better to define additional skills in a script than messing with the source.
 
Solution
Hi,
where and how can i edit my skilling. Example with hands it skills "fist fighting" lets say i want it to change to axe fighting + sword fighting and etc. It would be really nice to learn this kind of stuff

Hi, if you want to edit the source files then it's something for you. Maybe :D

When you try to hit an enemy it will perform some magic stuff behind in your source code like some complex calculations in combat.cpp

otland/forgottenserver

Line 956 is where the function is being executed to check for weapon type the player is holding in order to increase the right skill, this: lua_pushnumber(L, player->getWeaponSkill(tool));

and here is the actual function (method) in player.cpp:

otland/forgottenserver

If you want the Fist to skill your Axe fighting then just change this:

C++:
    if (!item) {
        return getSkillLevel(SKILL_FIST);
}

to this:

C++:
    if (!item) {
        return getSkillLevel(SKILL_AXE);
}

But then you will somehow have to let the players increase the fist fighting in other ways :confused:

Oh well, Good luck!

/edit

:oops: getSkilLevel method does not sound right when it comes to actually increasing your overall value and I haven't tested that, but it sounds like it should work
 
Last edited:
Hi, if you want to edit the source files then it's something for you. Maybe :D

When you try to hit an enemy it will perform some magic stuff behind in your source code like some complex calculations in combat.cpp

otland/forgottenserver

Line 956 is where the function is being executed to check for weapon type the player is holding in order to increase the right skill, this: lua_pushnumber(L, player->getWeaponSkill(tool));

and here is the actual function (method) in player.cpp:

otland/forgottenserver

If you want the Fist to skill your Axe fighting then just change this:

C++:
    if (!item) {
        return getSkillLevel(SKILL_FIST);
}

to this:

C++:
    if (!item) {
        return getSkillLevel(SKILL_AXE);
}

But then you will somehow have to let the players increase the fist fighting in other ways :confused:

Oh well, Good luck!

/edit

:oops: getSkilLevel method does not sound right when it comes to actually increasing your overall value and I haven't tested that, but it sounds like it should work
I'll try it out. Its okay because i dont really want to use fist skill in my server, because i'm trying to make fist like a sword. So its just increase the same skills but you only hit less.

Edis: int32_t Player::getWeaponSkill(const Item* item) const has nothing to do with changing skill
Well normally skills are acquired using or not using a weapon. However if you wanted added specific skill gain with say a club you could also add skill "tries" to an additional existing skill using a script in weapons.
If you are talking source editing then these are the enums which represent all the default skills.
C++:
enum skills_t : uint8_t {
    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,

    SKILL_FIRST = SKILL_FIST,
    SKILL_LAST = SKILL_FISHING
};

These enums are just the default values, now you could combine like for example
C++:
SKILL_FIRST = SKILL_FIST,
Both SKILL_FIRST & SKILL_FIST reference the same value which is 0, so if you wanted to combine SKILL_CLUB with SKILL_SWORD you could just by stating
C++:
SKILL_CLUB = SKILL_SWORD,
Unfortunately what happens then is if you raise the club skill it will also affect the sword skill and maybe that is not what you are looking for.

Plus there are other factors to consider, methods in the sources which call on these such as std::string getSkillName(uint8_t skillid), this particular method uses a switch statement to return a string that tells you the player what type of skill it is.
C++:
std::string getSkillName(uint8_t skillid)
{
    switch (skillid) {
        case SKILL_FIST:
            return "fist fighting";

        case SKILL_CLUB:
            return "club fighting";

        case SKILL_SWORD:
            return "sword fighting";

        case SKILL_AXE:
            return "axe fighting";

        case SKILL_DISTANCE:
            return "distance fighting";

        case SKILL_SHIELD:
            return "shielding";

        case SKILL_FISHING:
            return "fishing";

        case SKILL_MAGLEVEL:
            return "magic level";

        case SKILL_LEVEL:
            return "level";

        default:
            return "unknown";
    }
}
If you share club with sword then no matter if you are gaining sword tries then you will always get "club fighting" because both club & sword reference the same value.
This is not the only place in the sources that references the skills, the problem is if your goal is to add more skills or combine skills then you could run into more trouble than its worth. It's better to define additional skills in a script than messing with the source.
Its kinda simple and kinda complicated in the same time. Just by thinking that i have to make changes in enum skills_t : uint8_t { makes me think that i'll have a lot of problems. Because i want to to change fist to axe and sword and then axe combine with sword. So if i want to change skills or combine them i have to mess around with values?
 
Last edited:
Back
Top