• Sign up for TFS Icon Competition! The prize includes Otland Premium time and a medal, as well as obviously taking part in TFS history.
  • 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!

Show additional skills on client

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
541
Solutions
15
Reaction score
246
Location
Argentina
This goes hand to hand with my other thread Feature - [TFS 1.3] Adding New Skills (https://otland.net/threads/tfs-1-3-adding-new-skills.265784/)

In order to display an additional skill you code into the sources, you must edit the following files:
(I will use the same example as my other thread, "Runecraft")

src/client/const.h
Search for: enum Skill {. Under the Fishing, line just add: Runecraft,

src/client/protocolgameparse.cpp

Search for: int lastSkill = Otc::Fishing + 1; and replace it with int lastSkill = Otc::Runecraft + 1;
Next look for if(skill <= Otc::Fishing) and change to if(skill <= Otc::Runecraft)

That's enough for source edits, compile it and it's half way done.
Next, we need to modify some otc modules.

modules/gamelib/const.lua

Look for line Skill = {
Edit that table until it has the correct ids. Example.
Code:
Skill = {
  Fist = 0,
  Club = 1,
  Sword = 2,
  Axe = 3,
  Distance = 4,
  Shielding = 5,
  Fishing = 6,
  Runecraft = 7,
  CriticalChance = 8,
  CriticalDamage = 9,
  LifeLeechChance = 10,
  LifeLeechAmount = 11,
  ManaLeechChance = 12,
  ManaLeechAmount = 13
}

modules/game_skills/skills.otui

Search for
Code:
SkillButton
      id: skillId6
      SkillNameLabel
        !text: tr('Fishing')
      SkillValueLabel
      SkillPercentPanel
Under it paste
Code:
SkillButton
      id: skillId7
      SkillNameLabel
        !text: tr('Runecraft')
      SkillValueLabel
      SkillPercentPanel
Remember to give a +1 to the id of skills below (Critical hit chance, manaleech, etc)

modules/game_skills/skills.lua

Search for if i > Skill.Fishing then and change it to if i > Skill.Runecraft then

That should be enough. Hope it helps someone.
 

~X~

LoA Founder
Premium User
Joined
Oct 30, 2007
Messages
365
Reaction score
62
Location
USA
Followed this and I ended up with the following...
otc.png
 

~X~

LoA Founder
Premium User
Joined
Oct 30, 2007
Messages
365
Reaction score
62
Location
USA
Are you sure you can compile the client without any modifications? As in the picture you uploaded at least, it doesn't mention any error pointing to the two files you needed to modify.
That was a fresh OTC src, only edit's was your skill edits.
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
541
Solutions
15
Reaction score
246
Location
Argentina
That was a fresh OTC src, only edit's was your skill edits.
I get that, but try downloading the source, don't edit anything and try to compile without any changes. If it succeeds I might download the new sources to see if anything changed drastically from August to November

I may also ask you, are you trying to compile in release 64bits?
 
Last edited:

~X~

LoA Founder
Premium User
Joined
Oct 30, 2007
Messages
365
Reaction score
62
Location
USA
I get that, but try downloading the source, don't edit anything and try to compile without any changes. If it succeeds I might download the new sources to see if anything changed drastically from August to November

I may also ask you, are you trying to compile in release 64bits?
I got it working hehe Delusion helped me out!
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
541
Solutions
15
Reaction score
246
Location
Argentina
I am experiencing the exact same issue. How did you resolve this?

Thanks in advance!

Panza
Did you tried to compile the otclient source without modifications? Just to see if you have your compiler set up properly.
 

panza17

New Member
Joined
Apr 6, 2019
Messages
6
Reaction score
0
Did you tried to compile the otclient source without modifications? Just to see if you have your compiler set up properly.

I fixed it by adding luajit to the #includes in the source files that were giving problems. It was the first time i have compiled the client myself and i must say that it misses a lot of features that were included in the downloadable client from otv8. Maybe i have to add these myself. Anyway i followed your entire tutorial but it wasn't showing the new skill. It might have to do something with the database. I followed your guide on how to update the existing database.

1614113417387.png

Kind regards
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
541
Solutions
15
Reaction score
246
Location
Argentina
I fixed it by adding luajit to the #includes in the source files that were giving problems. It was the first time i have compiled the client myself and i must say that it misses a lot of features that were included in the downloadable client from otv8. Maybe i have to add these myself. Anyway i followed your entire tutorial but it wasn't showing the new skill. It might have to do something with the database. I followed your guide on how to update the existing database.

View attachment 55423

Kind regards
You have the error there on the screen, the correct syntax seems to be using a different quotation mark for the skill, you have this one " ' " but it should be " ` " this one i believe, hope it makes sense
So, in short:
Code:
'skill_mining'
Should be:
Code:
`skill_mining`

Check the update query to change as needed.
 

Oneda

Aspiring Spriter
Premium User
Joined
Dec 3, 2013
Messages
149
Solutions
2
Reaction score
84
Location
Brazil
1614429892822.png

Not really sure whats causing that, can anyone help?
If it matters: built on Release x64
 

PuszekLDZ

Member
Joined
Jan 2, 2020
Messages
145
Reaction score
24
Location
Lodz
Hello! Great work! but.. ;)
I did all steps (on OTClinet + TFS 1.3 Nekiro ver 8.60 and on OTClient + OTX3)

I dona all like in tutorial (even with name Runecraft) - Feature - [TFS 1.3] Adding New Skills (https://otland.net/threads/tfs-1-3-adding-new-skills.265784/)
both servers compiled.

On OTX3 items.cpp there is no where to write parsing like on TFS)
Diff:
Search for this line: {"skillfish", ITEM_PARSE_SKILLFISH},
Right under it paste: {"skillrunecraft", ITEM_PARSE_SKILLRUNECRAFT},

I write in client - Runecraft 'lvl and percent" like:
C++:
void ProtocolGame::AddPlayerSkills(NetworkMessage& msg)
{
    msg.addByte(0xA1);
    for (uint8_t i = SKILL_FIRST; i < SKILL_LAST; ++i) {
        msg.addByte(std::min<int32_t>(player->getSkillLevel(i), std::numeric_limits<uint16_t>::max()));
        msg.addByte(player->getSkillPercent(i));
    }
    msg.addByte(123);
    msg.addByte(36);
}

and show that skill as number 7 - but in otclient i changed it with fishing (with changing SkillId to 7 - so i get skills list like 1, 2 , 3 , 4, 5, 7)
Diff:
SkillButton
      id: skillId0
      SkillNameLabel
        !text: tr('Fist fighting')
      SkillValueLabel
      SkillPercentPanel
      
      < ... >

SkillButton
      id: skillId5
      SkillNameLabel
        !text: tr('Shielding')
      SkillValueLabel
      SkillPercentPanel
      
SkillButton
      id: skillId7
      SkillNameLabel
        !text: tr('Runecraft')
      SkillValueLabel
      SkillPercentPanel
then skill Runecraft appear, but that Life Leech / Mana Leech etc shows too.. .
thats why I think i doing smething wrong with showing it in OTClient

I follow that tutorial about adding it to OTC - now i thinking maybe its some with those OPCODES - but i dont know how to make it work even with opcodes - maybe some got a solution for this?
 

PuszekLDZ

Member
Joined
Jan 2, 2020
Messages
145
Reaction score
24
Location
Lodz
ok, I figured it out! i think ;)

for next ones - what i do?

in skills.lua (modules/game_skills/skills.lua)
you need to find (as in tutorial)
Diff:
if i > Skill.Fishing then
and change to
Diff:
if i > Skill.Runecraft then



find also
Diff:
local hasAdditionalSkills = g_game.getFeature(GameAdditionalSkills)
  for i = Skill.Fist, Skill.ManaLeechAmount do

replace by
Diff:
local hasAdditionalSkills = g_game.getFeature(GameAdditionalSkills)
  for i = Skill.Fist, Skill.Runecraft do



in skills.otui (modules/game_skills/skills.otui)
after
Diff:
SmallSkillButton
      id: skillId12
      SkillNameLabel
        !text: tr('Life Leech Amount')
      SkillValueLabel

add
Diff:
SkillButton
      id: skillId7
      SkillNameLabel
        !text: tr('Runecraft')
      SkillValueLabel
      SkillPercentPanel

so it looks like
Diff:
SmallSkillButton
      id: skillId12
      SkillNameLabel
        !text: tr('Life Leech Amount')
      SkillValueLabel
      
    SkillButton
      id: skillId7
      SkillNameLabel
        !text: tr('Runecraft')
      SkillValueLabel
      SkillPercentPanel

it worked for me - maybe its not well done, but for my purpose its good :)

if this is not good way, just tell - I am learning still so ;)
 
OP
Ramirow

Ramirow

Advanced OT User
Joined
Aug 22, 2009
Messages
541
Solutions
15
Reaction score
246
Location
Argentina
I don't really have any experience nor have I looked at the code changes on OTX3, it should work with Nekiro's release though.
For adding more, which I did if I remember correctly, I just added them after Runecraft with the next id, and just moved all the rest up (You have to edit the SkillButton id in skills.otui).
You can add let's say, crafting, it would have skillid 8 (which is originally criticalChance I believe), just add +1 to that and the ones that come after it, you edit skills.otui to the new skill, and remap criticalChance, etc to the new incremented id. You can try, there might be better ways, but I wrote this back when I was working on a private project for fun, didn't really mess around with it too much.
 

Similar threads

Top