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

Lua Otbr TFS 1.3 New vocation crash

alejandro762

Well-Known Member
Joined
Sep 6, 2021
Messages
224
Reaction score
62
Hello everyone,

As i Try to add a new vocation on otservbr editing this files,
"Crusader" Vocation.

Data/lib/core/player.lua ( added):
Lua:
function Player.isCrusader(self)
    return table.contains({VOCATION.ID.CRUSADER, VOCATION.ID.CRUSADER}, self:getVocation():getId())
end
Data/lib/tables/vocations.lua(added):
Code:
VOCATION = {
    ID = {
        NONE = 0,
        SORCERER = 1,
        DRUID = 2,
        PALADIN = 3,
        KNIGHT = 4,
        MASTER_SORCERER = 5,
        ELDER_DRUID = 6,
        ROYAL_PALADIN = 7,
        ELITE_KNIGHT = 8,
        CRUSADER = 9
    },
    CLIENT_ID = {
        NONE = 0,
        KNIGHT = 1,
        PALADIN = 2,
        SORCERER = 3,
        DRUID = 4,
        ELITE_KNIGHT = 11,
        ROYAL_PALADIN = 12,
        MASTER_SORCERER = 13,
        ELDER_DRUID = 14,
        CRUSADER = 15
    },
    BASE_ID = {
        NONE = 0,
        SORCERER = 1,
        DRUID = 2,
        PALADIN = 3,
        KNIGHT = 4,
        CRUSADER = 5
    }
}

Data/vocations.xml
Code:
<vocation id="9" clientid="15" baseid="5" name="Crusader" description="a Crusader" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4000" gainhpamount="1" gainmanaticks="6000" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15000" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>

Website:
Code:
9 => array(
            'name' => 'CRUSADER',
            'fromVoc' => false
        )
      
        // After
      
        9 => array(
            'hp' => 15,
            'mp' => 5,
            'cap' => 25
        ),
      
        //after
        5 => array(
                    'magic' => 0,
                    'fist' => 10,
                    'club' => 10,
                    'axe' => 10,
                    'sword' => 10,
                    'dist' => 10,
                    'shield' => 10,
                    'fishing' => 10,
                ),

When i try enter i got a directly crash of server, debug from visual took me to sources from a 'familiar' code show as error. ( I will post it in many hours).

Familiar i just copy paste the knight familiar and added Id 9
Code:
<familiar vocation="9" lookType="1365" name="Snowbash" premium="yes" unlocked="no" enabled="yes" />


Error Showed on Debug Visual Studio 2019: ( error appears with or without familiar added ).

Exception thrown: read access violation.
familiar was 0xFFFFFFFFFFFFFFDD.

Player.cpp: Is returning this:

Code:
    if (familiar.premium && !isPremium()) {
        return false;

@EduardoDantas
 
Last edited:
Solution
Yes, o changed too,but i got a crash directly, and when player remains online when i try log in with another normal voc, reaching the position of the new voc, it crashes too.
Using 9 or 15, doesnt work.


I edit the familiars and added lines,
Familiars.xml, create a file crusader_familiar.lua with utevo gran res test, vocation, crusader, etc, and still crashing, but now is the client, so can see anything, just , enum value error. Maybe is not possible to add a new one using normal tibia client ?

Something like add custom sprites on bestiary, giving dimensions on assets editor , Monsters doesnt appear at the middle of picture, but cutted of at left, there is no way to move the picture.
Client Id, put it to 11. I am not sure, but...
You're forgetting to add the vocation through sources, should be inside creatures_definitions.hpp

Lua:
enum Vocation_t : uint16_t {
    VOCATION_NONE = 0,
    VOCATION_SORCERER = 1,
    VOCATION_DRUID = 2,
    VOCATION_PALADIN = 3,
    VOCATION_KNIGHT = 4,
    VOCATION_MASTER_SORCERER = 5,
    VOCATION_ELDER_DRUID = 6,
    VOCATION_ROYAL_PALADIN = 7,
    VOCATION_ELITE_KNIGHT = 8,
    add your vocation here
    VOCATION_LAST = VOCATION_ELITE_KNIGHT -- then edit this to be the last vocation that you just created.
};
 
Also, I'm not sure if you should use base_id 5 for the crusader, as it's taken by 'master sorcerer' vocation
 
You're forgetting to add the vocation through sources, should be inside creatures_definitions.hpp

Lua:
enum Vocation_t : uint16_t {
    VOCATION_NONE = 0,
    VOCATION_SORCERER = 1,
    VOCATION_DRUID = 2,
    VOCATION_PALADIN = 3,
    VOCATION_KNIGHT = 4,
    VOCATION_MASTER_SORCERER = 5,
    VOCATION_ELDER_DRUID = 6,
    VOCATION_ROYAL_PALADIN = 7,
    VOCATION_ELITE_KNIGHT = 8,
    add your vocation here
    VOCATION_LAST = VOCATION_ELITE_KNIGHT -- then edit this to be the last vocation that you just created.
};
Now seems the console isn't crashing.

Now is the client crashing with an error "invalid enum value".
I just add:
Lua:
VOCATION_CRUSADER = 9,
VOCATION_LAST = VOCATION_CRUSADER

Code:
2022-08-02, 00:28:13: Error while processing network packet unhandled enum value

From here i edited all to number 9:
Code:
Code:
VOCATION = {
    ID = {
        NONE = 0,
        SORCERER = 1,
        DRUID = 2,
        PALADIN = 3,
        KNIGHT = 4,
        MASTER_SORCERER = 5,
        ELDER_DRUID = 6,
        ROYAL_PALADIN = 7,
        ELITE_KNIGHT = 8,
        CRUSADER = 9
    },
    CLIENT_ID = {
        NONE = 0,
        KNIGHT = 1,
        PALADIN = 2,
        SORCERER = 3,
        DRUID = 4,
        ELITE_KNIGHT = 11,
        ROYAL_PALADIN = 12,
        MASTER_SORCERER = 13,
        ELDER_DRUID = 14,
        CRUSADER = 9
    },
    BASE_ID = {
        NONE = 0,
        SORCERER = 1,
        DRUID = 2,
        PALADIN = 3,
        KNIGHT = 4,
        CRUSADER = 9
    }
 
CLIENT_ID i think u are using 15 not 9
Post automatically merged:

<vocation id="9" clientid="15"
Yes, o changed too,but i got a crash directly, and when player remains online when i try log in with another normal voc, reaching the position of the new voc, it crashes too.
Using 9 or 15, doesnt work.

I think you have to edit files with familiars system
I edit the familiars and added lines,
Familiars.xml, create a file crusader_familiar.lua with utevo gran res test, vocation, crusader, etc, and still crashing, but now is the client, so can see anything, just , enum value error. Maybe is not possible to add a new one using normal tibia client ?

Something like add custom sprites on bestiary, giving dimensions on assets editor , Monsters doesnt appear at the middle of picture, but cutted of at left, there is no way to move the picture.
 
Yes, o changed too,but i got a crash directly, and when player remains online when i try log in with another normal voc, reaching the position of the new voc, it crashes too.
Using 9 or 15, doesnt work.


I edit the familiars and added lines,
Familiars.xml, create a file crusader_familiar.lua with utevo gran res test, vocation, crusader, etc, and still crashing, but now is the client, so can see anything, just , enum value error. Maybe is not possible to add a new one using normal tibia client ?

Something like add custom sprites on bestiary, giving dimensions on assets editor , Monsters doesnt appear at the middle of picture, but cutted of at left, there is no way to move the picture.
Client Id, put it to 11. I am not sure, but I think I read that it was no longer in use which may even be written in the sources marked out above. I did this a while ago for someone which resulted in the usage of client id 11 in the vocations.xml.

And no, you do not have to touch the familiars unless you want the vocation to be able to use it.

"Yes, o changed too,but i got a crash directly, and when player remains online when i try log in with another normal voc, reaching the position of the new voc, it crashes too."
- Yes, it does result in that if the vocation is not imported.
 
Solution
Client Id, put it to 11. I am not sure, but I think I read that it was no longer in use which may even be written in the sources marked out above. I did this a while ago for someone which resulted in the usage of client id 11 in the vocations.xml.

And no, you do not have to touch the familiars unless you want the vocation to be able to use it.

"Yes, o changed too,but i got a crash directly, and when player remains online when i try log in with another normal voc, reaching the position of the new voc, it crashes too."
- Yes, it does result in that if the vocation is not imported.
OMG.

Is working, but simple question, is this make any interference with the Elite Knight Client ID 11, or nothing with EK ?.
So if i wish to create another one, i just add 12 ( pally ?) on client id till the 14 Client ID , right ?

Thanks again man!
 
OMG.

Is working, but simple question, is this make any interference with the Elite Knight Client ID 11, or nothing with EK ?.
So if i wish to create another one, i just add 12 ( pally ?) on client id till the 14 Client ID , right ?

Thanks again man!
No, so far as I know it should not matter with the client id. However it may say in the login menu if you login then logout that your character is an Elite Knight. But it does not conflict or mess up the character or it's vocation. It's simply just the display function as far as I am aware.

Not sure where client id is located to add a new id into it. Did not care enough to look into it sadly.

Best of luck.
- Joriku
 
No, so far as I know it should not matter with the client id. However it may say in the login menu if you login then logout that your character is an Elite Knight. But it does not conflict or mess up the character or it's vocation. It's simply just the display function as far as I am aware.

Not sure where client id is located to add a new id into it. Did not care enough to look into it sadly.

Best of luck.
- Joriku
I look in many files, then i dont find it also.
I Just move to 0, in order to display when CTRL+G, None, in vocation.
Is working perfectly , spells, familiar, all.

Thanks very much Joriku, i will add your name to the list of people helping on the project.
 
Hello, how i need change vocation.xml to so that it wouldn’t be crashes Server
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
<vocation id="0" clientid="0" name="None" description="none" magicshield="0" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="2.0" />
<skill id="2" multiplier="2.0" />
<skill id="3" multiplier="2.0" />
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="2.0" />
<skill id="2" multiplier="2.0" />
<skill id="3" multiplier="2.0" />
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="2" clientid="4" name="Druid" description="a druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="1.8" />
<skill id="2" multiplier="1.8" />
<skill id="3" multiplier="1.8" />
<skill id="4" multiplier="1.8" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="3" clientid="2" name="Paladin" description="a paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.2" />
<skill id="1" multiplier="1.2" />
<skill id="2" multiplier="1.2" />
<skill id="3" multiplier="1.2" />
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="4" clientid="1" name="Knight" description="a knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.1" />
<skill id="1" multiplier="1.1" />
<skill id="2" multiplier="1.1" />
<skill id="3" multiplier="1.1" />
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="2.0" />
<skill id="2" multiplier="2.0" />
<skill id="3" multiplier="2.0" />
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="1.8" />
<skill id="2" multiplier="1.8" />
<skill id="3" multiplier="1.8" />
<skill id="4" multiplier="1.8" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.2" />
<skill id="1" multiplier="1.2" />
<skill id="2" multiplier="1.2" />
<skill id="3" multiplier="1.2" />
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
<skill id="0" multiplier="1.1" />
<skill id="1" multiplier="1.1" />
<skill id="2" multiplier="1.1" />
<skill id="3" multiplier="1.1" />
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="9" clientid="3" name="Pro Master Sorcerer" description="a pro master sorcerer" magicshield="1" gaincap="300" gainhp="30" gainmana="45" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="1000" basespeed="2200" soulmax="200" gainsoulticks="15" fromvoc="1">
<formula meleeDamage="3.0" distDamage="3.0" defense="3.0" armor="3.0" />
<skill id="0" multiplier="1.2" />
<skill id="1" multiplier="1.2" />
<skill id="2" multiplier="1.2" />
<skill id="3" multiplier="1.2" />
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="10" clientid="4" name="Pro Elder Druid" description="an pro elder druid" magicshield="1" gaincap="400" gainhp="45" gainmana="15" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="1000" basespeed="2200" soulmax="200" gainsoulticks="15" fromvoc="2">
<formula meleeDamage="3.0" distDamage="3.0" defense="3.0" armor="3.0" />
<skill id="0" multiplier="1.1" />
<skill id="1" multiplier="1.1" />
<skill id="2" multiplier="1.1" />
<skill id="3" multiplier="1.1" />
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="11" clientid="2" name="Pro Royal Paladin" description="a pro royal paladin" magicshield="0" gaincap="300" gainhp="30" gainmana="45" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="1000" basespeed="2200" soulmax="200" gainsoulticks="15" fromvoc="3">
<formula meleeDamage="3.0" distDamage="3.0" defense="3.0" armor="3.0" />
<skill id="0" multiplier="1.2" />
<skill id="1" multiplier="1.2" />
<skill id="2" multiplier="1.2" />
<skill id="3" multiplier="1.2" />
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="12" clientid="1" name="Pro Elite Knight" description="an pro elite knight" magicshield="0" gaincap="400" gainhp="45" gainmana="15" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="1000" basespeed="2200" soulmax="200" gainsoulticks="15" fromvoc="4">
<formula meleeDamage="3.0" distDamage="3.0" defense="3.0" armor="3.0" />
<skill id="0" multiplier="1.1" />
<skill id="1" multiplier="1.1" />
<skill id="2" multiplier="1.1" />
<skill id="3" multiplier="1.1" />
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
</vocations>
 
Back
Top