• 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

Veteran OT User
Joined
Aug 22, 2009
Messages
584
Solutions
15
Reaction score
301
Location
Argentina
YouTube
ramirogrant
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.
 
Followed this and I ended up with the following...
otc.png
 
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.
 
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:
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!
 
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
 
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.
 
1614429892822.png

Not really sure whats causing that, can anyone help?
If it matters: built on Release x64
 
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?
 
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 ;)
 
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.
 
Sorry for rescuing something from the past, but I'm having a hard time, I followed all the steps, and it's still giving the following error in Skills.otui
Can someone help me?

@PuszekLDZ
@Ramirow

Skills.otui
Lua:
SkillFirstWidget < UIWidget

SkillButton < UIButton
  height: 21
  margin-bottom: 2
  &onClick: onSkillButtonClick

SmallSkillButton < SkillButton
  height: 14

SkillNameLabel < GameLabel
  font: verdana-11px-monochrome
  anchors.left: parent.left
  anchors.top: parent.top
  anchors.bottom: parent.bottom

SkillValueLabel < GameLabel
  id: value
  font: verdana-11px-monochrome
  text-align: topright
  anchors.right: parent.right
  anchors.top: parent.top
  anchors.bottom: parent.bottom
  anchors.left: prev.left

SkillPercentPanel < ProgressBar
  id: percent
  background-color: green
  height: 5
  margin-top: 15
  anchors.left: parent.left
  anchors.right: parent.right
  anchors.top: parent.top
  phantom: false

MiniWindow
  id: skillWindow
  !text: tr('Skills')
  height: 150
  icon: /images/topbuttons/skills
  @onClose: modules.game_skills.onMiniWindowClose()
  &save: true

  MiniWindowContents
    padding-left: 5
    padding-right: 5
    layout: verticalBox

    SkillButton
      margin-top: 5
      id: experience
      height: 15
      SkillNameLabel
        !text: tr('Experience')
      SkillValueLabel

    SkillButton
      id: level
      SkillNameLabel
        !text: tr('Level')
      SkillValueLabel
      SkillPercentPanel
        background-color: red

    SkillButton
      id: health
      height: 15
      SkillNameLabel
        !text: tr('Hit Points')
      SkillValueLabel

    SkillButton
      id: mana
      height: 15
      SkillNameLabel
        !text: tr('Mana')
      SkillValueLabel

    SkillButton
      id: soul
      height: 15
      SkillNameLabel
        !text: tr('Soul Points')
      SkillValueLabel

    SkillButton
      id: capacity
      height: 15
      SkillNameLabel
        !text: tr('Capacity')
      SkillValueLabel

    SkillButton
      id: speed
      height: 15
      SkillNameLabel
        !text: tr('Speed')
      SkillValueLabel

    SkillButton
      id: regenerationTime
      SkillNameLabel
        !text: tr('Regeneration Time')
      SkillValueLabel

    SkillButton
      id: stamina
      SkillNameLabel
        !text: tr('Stamina')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: offlineTraining
      SkillNameLabel
        !text: tr('Offline Training')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: magiclevel
      SkillNameLabel
        !text: tr('Magic Level')
      SkillValueLabel
      SkillPercentPanel
        background-color: red

    SkillButton
      id: skillId0
      SkillNameLabel
        !text: tr('Fist Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId1
      SkillNameLabel
        !text: tr('Club Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId2
      SkillNameLabel
        !text: tr('Sword Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId3
      SkillNameLabel
        !text: tr('Axe Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId4
      SkillNameLabel
        !text: tr('Distance Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId5
      SkillNameLabel
        !text: tr('Shielding')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId6
      SkillNameLabel
        !text: tr('Fishing')
      SkillValueLabel
      SkillPercentPanel
      
     SkillButton
      id: skillId7
      SkillNameLabel
        !text: tr('Runecraft')
      SkillValueLabel
      SkillPercentPanel

    SmallSkillButton
      id: skillId8
      SkillNameLabel
        !text: tr('Critical Hit Chance')
      SkillValueLabel

    SmallSkillButton
      id: skillId9
      SkillNameLabel
        !text: tr('Critical Hit Damage')
      SkillValueLabel

    SmallSkillButton
      id: skillId10
      SkillNameLabel
        !text: tr('Life Leech Chance')
      SkillValueLabel

    SmallSkillButton
      id: skillId11
      SkillNameLabel
        !text: tr('Life Leech Amount')
      SkillValueLabel

    SmallSkillButton
      id: skillId12
      SkillNameLabel
        !text: tr('Life Leech Chance')
      SkillValueLabel

    SmallSkillButton
      id: skillId13
      SkillNameLabel
        !text: tr('Life Leech Amount')
      SkillValueLabel

1645209873868.png
 
also paste skills.lua

Skills.otui
Lua:
SkillFirstWidget < UIWidget

SkillButton < UIButton
  height: 21
  margin-bottom: 2
  &onClick: onSkillButtonClick

SmallSkillButton < SkillButton
  height: 14

SkillNameLabel < GameLabel
  font: verdana-11px-monochrome
  anchors.left: parent.left
  anchors.top: parent.top
  anchors.bottom: parent.bottom

SkillValueLabel < GameLabel
  id: value
  font: verdana-11px-monochrome
  text-align: topright
  anchors.right: parent.right
  anchors.top: parent.top
  anchors.bottom: parent.bottom
  anchors.left: prev.left

SkillPercentPanel < ProgressBar
  id: percent
  background-color: green
  height: 5
  margin-top: 15
  anchors.left: parent.left
  anchors.right: parent.right
  anchors.top: parent.top
  phantom: false

MiniWindow
  id: skillWindow
  !text: tr('Skills')
  height: 150
  icon: /images/topbuttons/skills
  @onClose: modules.game_skills.onMiniWindowClose()
  &save: true

  MiniWindowContents
    padding-left: 5
    padding-right: 5
    layout: verticalBox

    SkillButton
      margin-top: 5
      id: experience
      height: 15
      SkillNameLabel
        !text: tr('Experience')
      SkillValueLabel

    SkillButton
      id: level
      SkillNameLabel
        !text: tr('Level')
      SkillValueLabel
      SkillPercentPanel
        background-color: red

    SkillButton
      id: health
      height: 15
      SkillNameLabel
        !text: tr('Hit Points')
      SkillValueLabel

    SkillButton
      id: mana
      height: 15
      SkillNameLabel
        !text: tr('Mana')
      SkillValueLabel

    SkillButton
      id: soul
      height: 15
      SkillNameLabel
        !text: tr('Soul Points')
      SkillValueLabel

    SkillButton
      id: capacity
      height: 15
      SkillNameLabel
        !text: tr('Capacity')
      SkillValueLabel

    SkillButton
      id: speed
      height: 15
      SkillNameLabel
        !text: tr('Speed')
      SkillValueLabel

    SkillButton
      id: regenerationTime
      SkillNameLabel
        !text: tr('Regeneration Time')
      SkillValueLabel

    SkillButton
      id: stamina
      SkillNameLabel
        !text: tr('Stamina')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: offlineTraining
      SkillNameLabel
        !text: tr('Offline Training')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: magiclevel
      SkillNameLabel
        !text: tr('Magic Level')
      SkillValueLabel
      SkillPercentPanel
        background-color: red

    SkillButton
      id: skillId0
      SkillNameLabel
        !text: tr('Fist Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId1
      SkillNameLabel
        !text: tr('Club Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId2
      SkillNameLabel
        !text: tr('Sword Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId3
      SkillNameLabel
        !text: tr('Axe Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId4
      SkillNameLabel
        !text: tr('Distance Fighting')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId5
      SkillNameLabel
        !text: tr('Shielding')
      SkillValueLabel
      SkillPercentPanel

    SkillButton
      id: skillId6
      SkillNameLabel
        !text: tr('Fishing')
      SkillValueLabel
      SkillPercentPanel
      
     SkillButton
      id: skillId7
      SkillNameLabel
        !text: tr('Runecraft')
      SkillValueLabel
      SkillPercentPanel

    SmallSkillButton
      id: skillId8
      SkillNameLabel
        !text: tr('Critical Hit Chance')
      SkillValueLabel

    SmallSkillButton
      id: skillId9
      SkillNameLabel
        !text: tr('Critical Hit Damage')
      SkillValueLabel

    SmallSkillButton
      id: skillId10
      SkillNameLabel
        !text: tr('Life Leech Chance')
      SkillValueLabel

    SmallSkillButton
      id: skillId11
      SkillNameLabel
        !text: tr('Life Leech Amount')
      SkillValueLabel

    SmallSkillButton
      id: skillId12
      SkillNameLabel
        !text: tr('Life Leech Chance')
      SkillValueLabel

    SmallSkillButton
      id: skillId13
      SkillNameLabel
        !text: tr('Life Leech Amount')
      SkillValueLabel

Up!
 
Back
Top