• 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 0.X Debug when using shoottype 860.

Bigato

New Member
Joined
Feb 11, 2020
Messages
9
Reaction score
0
Base: TFS 0.3.6, Version 8.60



Hello guys, this is my first topic so I apologize if I made somemistake.

I have a problem adding a new shoottype to my server. I modified the sprites with Object Builder (in this case I added a few more shoottypes), modified the source (Tools.cpp and Const.h), compiled and included it in the \ lib \000-constant file, following the protocol.

I run the server and it goes normally, even when I use the command / x or / z (I don't remember which one is related to shoottype now) it informs me that I have 46 shoottypes, since it is the correct one. However, when I attack with the new weapon and, consequently, the new shoottype, it gives debugging on the client and no error on the distro. And the most iconic thing is that when I relog, the monster took the hits normally. Because I see him low life.

Remembering that I only use 46 shoottypes and the normal one (which already comes on the standard tibia 8.60 server) is 42. My last shoottype is number 46 in the object builder and 45 in the sources and 000-constant.lua.



I put this in the items.lua:

<attribute key = "shootType" value = "prismaticarrow" />

Which is consistent with what I added in the sources and compiled. When I replace the new sprites in place of others, for example: I put the prismatic arrow in place of the normal cake (id 42) it works fine. The problem is with the new shoottypes (id 43, 44, 45 and 46) it is not with the sprites, it seems to me.

Thanks.

My tools.cpp:
Lua:
ShootTypeNames shootTypeNames[] =
{
    {"spear",            SHOOT_EFFECT_SPEAR},
    {"bolt",            SHOOT_EFFECT_BOLT},
    {"arrow",            SHOOT_EFFECT_ARROW},
    {"fire",            SHOOT_EFFECT_FIRE},
    {"energy",            SHOOT_EFFECT_ENERGY},
    {"poisonarrow",        SHOOT_EFFECT_POISONARROW},
    {"burstarrow",        SHOOT_EFFECT_BURSTARROW},
    {"throwingstar",    SHOOT_EFFECT_THROWINGSTAR},
    {"throwingknife",    SHOOT_EFFECT_THROWINGKNIFE},
    {"smallstone",        SHOOT_EFFECT_SMALLSTONE},
    {"death",            SHOOT_EFFECT_DEATH},
    {"largerock",        SHOOT_EFFECT_LARGEROCK},
    {"snowball",        SHOOT_EFFECT_SNOWBALL},
    {"powerbolt",        SHOOT_EFFECT_POWERBOLT},
    {"poison",            SHOOT_EFFECT_POISONFIELD},
    {"infernalbolt",    SHOOT_EFFECT_INFERNALBOLT},
    {"huntingspear",    SHOOT_EFFECT_HUNTINGSPEAR},
    {"enchantedspear",    SHOOT_EFFECT_ENCHANTEDSPEAR},
    {"redstar",            SHOOT_EFFECT_REDSTAR},
    {"greenstar",        SHOOT_EFFECT_GREENSTAR},
    {"royalspear",        SHOOT_EFFECT_ROYALSPEAR},
    {"sniperarrow",        SHOOT_EFFECT_SNIPERARROW},
    {"onyxarrow",        SHOOT_EFFECT_ONYXARROW},
    {"piercingbolt",    SHOOT_EFFECT_PIERCINGBOLT},
    {"whirlwindsword",    SHOOT_EFFECT_WHIRLWINDSWORD},
    {"whirlwindaxe",    SHOOT_EFFECT_WHIRLWINDAXE},
    {"whirlwindclub",    SHOOT_EFFECT_WHIRLWINDCLUB},
    {"etherealspear",    SHOOT_EFFECT_ETHEREALSPEAR},
    {"ice",                SHOOT_EFFECT_ICE},
    {"earth",            SHOOT_EFFECT_EARTH},
    {"holy",            SHOOT_EFFECT_HOLY},
    {"suddendeath",        SHOOT_EFFECT_SUDDENDEATH},
    {"flasharrow",        SHOOT_EFFECT_FLASHARROW},
    {"flammingarrow",    SHOOT_EFFECT_FLAMMINGARROW},
    {"flamingarrow",    SHOOT_EFFECT_FLAMMINGARROW},
    {"shiverarrow",        SHOOT_EFFECT_SHIVERARROW},
    {"energyball",        SHOOT_EFFECT_ENERGYBALL},
    {"smallice",        SHOOT_EFFECT_SMALLICE},
    {"smallholy",        SHOOT_EFFECT_SMALLHOLY},
    {"smallearth",        SHOOT_EFFECT_SMALLEARTH},
    {"eartharrow",        SHOOT_EFFECT_EARTHARROW},
    {"explosion",        SHOOT_EFFECT_EXPLOSION},
    {"cake",            SHOOT_EFFECT_CAKE},
    {"prismaticarrow",        SHOOT_EFFECT_PRISMATICARROW},
    {"prismaticbolt",         SHOOT_EFFECT_PRISMATICBOLT},
    {"diamondarrow",         SHOOT_EFFECT_DIAMONDARROW},
    {"naturespear",            SHOOT_EFFECT_NATURESPEAR}
};


My 000-constant.lua:

Code:
CONST_ANI_SPEAR = 0
CONST_ANI_BOLT = 1
CONST_ANI_ARROW = 2
CONST_ANI_FIRE = 3
CONST_ANI_ENERGY = 4
CONST_ANI_POISONARROW = 5
CONST_ANI_BURSTARROW = 6
CONST_ANI_THROWINGSTAR = 7
CONST_ANI_THROWINGKNIFE = 8
CONST_ANI_SMALLSTONE = 9
CONST_ANI_DEATH = 10
CONST_ANI_LARGEROCK = 11
CONST_ANI_SNOWBALL = 12
CONST_ANI_POWERBOLT = 13
CONST_ANI_POISON = 14
CONST_ANI_INFERNALBOLT = 15
CONST_ANI_HUNTINGSPEAR = 16
CONST_ANI_ENCHANTEDSPEAR = 17
CONST_ANI_REDSTAR = 18
CONST_ANI_GREENSTAR = 19
CONST_ANI_ROYALSPEAR = 20
CONST_ANI_SNIPERARROW = 21
CONST_ANI_ONYXARROW = 22
CONST_ANI_PIERCINGBOLT = 23
CONST_ANI_WHIRLWINDSWORD = 24
CONST_ANI_WHIRLWINDAXE = 25
CONST_ANI_WHIRLWINDCLUB = 26
CONST_ANI_ETHEREALSPEAR = 27
CONST_ANI_ICE = 28
CONST_ANI_EARTH = 29
CONST_ANI_HOLY = 30
CONST_ANI_SUDDENDEATH = 31
CONST_ANI_FLASHARROW = 32
CONST_ANI_FLAMMINGARROW = 33
CONST_ANI_SHIVERARROW = 34
CONST_ANI_ENERGYBALL = 35
CONST_ANI_SMALLICE = 36
CONST_ANI_SMALLHOLY = 37
CONST_ANI_SMALLEARTH = 38
CONST_ANI_EARTHARROW = 39
CONST_ANI_EXPLOSION = 40
CONST_ANI_CAKE = 41
CONST_ANI_PRISMATICARROW = 42
CONST_ANI_PRISMATICBOLT = 43
CONST_ANI_DIAMONDARROW = 44
CONST_ANI_NATURESPEAR = 45
CONST_ANI_WEAPONTYPE = 254
CONST_ANI_NONE = 255
CONST_ANI_LAST = CONST_ANI_NATURESPEAR

My const.h:

Code:
enum ShootEffect_t
{
    SHOOT_EFFECT_SPEAR                = 0x00,
    SHOOT_EFFECT_BOLT                = 0x01,
    SHOOT_EFFECT_ARROW                = 0x02,
    SHOOT_EFFECT_FIRE                = 0x03,
    SHOOT_EFFECT_ENERGY                = 0x04,
    SHOOT_EFFECT_POISONARROW        = 0x05,
    SHOOT_EFFECT_BURSTARROW            = 0x06,
    SHOOT_EFFECT_THROWINGSTAR        = 0x07,
    SHOOT_EFFECT_THROWINGKNIFE        = 0x08,
    SHOOT_EFFECT_SMALLSTONE            = 0x09,
    SHOOT_EFFECT_DEATH                = 0x0A, //10
    SHOOT_EFFECT_LARGEROCK            = 0x0B, //11
    SHOOT_EFFECT_SNOWBALL            = 0x0C, //12
    SHOOT_EFFECT_POWERBOLT            = 0x0D, //13
    SHOOT_EFFECT_POISONFIELD        = 0x0E, //14
    SHOOT_EFFECT_INFERNALBOLT        = 0x0F, //15
    SHOOT_EFFECT_HUNTINGSPEAR        = 0x10, //16
    SHOOT_EFFECT_ENCHANTEDSPEAR        = 0x11, //17
    SHOOT_EFFECT_REDSTAR            = 0x12, //18
    SHOOT_EFFECT_GREENSTAR            = 0x13, //19
    SHOOT_EFFECT_ROYALSPEAR            = 0x14, //20
    SHOOT_EFFECT_SNIPERARROW        = 0x15, //21
    SHOOT_EFFECT_ONYXARROW            = 0x16, //22
    SHOOT_EFFECT_PIERCINGBOLT        = 0x17, //23
    SHOOT_EFFECT_WHIRLWINDSWORD        = 0x18, //24
    SHOOT_EFFECT_WHIRLWINDAXE        = 0x19, //25
    SHOOT_EFFECT_WHIRLWINDCLUB        = 0x1A, //26
    SHOOT_EFFECT_ETHEREALSPEAR        = 0x1B, //27
    SHOOT_EFFECT_ICE                = 0x1C, //28
    SHOOT_EFFECT_EARTH                = 0x1D, //29
    SHOOT_EFFECT_HOLY                = 0x1E, //30
    SHOOT_EFFECT_SUDDENDEATH        = 0x1F, //31
    SHOOT_EFFECT_FLASHARROW            = 0x20, //32
    SHOOT_EFFECT_FLAMMINGARROW        = 0x21, //33
    SHOOT_EFFECT_SHIVERARROW        = 0x22, //34
    SHOOT_EFFECT_ENERGYBALL            = 0x23, //35
    SHOOT_EFFECT_SMALLICE            = 0x24, //36
    SHOOT_EFFECT_SMALLHOLY            = 0x25, //37
    SHOOT_EFFECT_SMALLEARTH            = 0x26, //38
    SHOOT_EFFECT_EARTHARROW            = 0x27, //39
    SHOOT_EFFECT_EXPLOSION            = 0x28, //40
    SHOOT_EFFECT_CAKE                = 0x29, //41
    SHOOT_EFFECT_PRISMATICARROW                = 0x30, //42
    SHOOT_EFFECT_PRISMATICBOLT                = 0x31, //43
    SHOOT_EFFECT_DIAMONDARROW                = 0x32, //44
    SHOOT_EFFECT_NATURESPEAR                = 0x33, //45
    SHOOT_EFFECT_LAST                = SHOOT_EFFECT_NATURESPEAR,

    //for internal use, dont send to client
    SHOOT_EFFECT_WEAPONTYPE        = 0xFE, //254
    SHOOT_EFFECT_NONE            = 0xFF,
    SHOOT_EFFECT_UNKNOWN        = 0xFFFF
};
 
Solution
Thanks for the answers guys.

So, you suggest that I must compile the data with another editor. Do you have someone in mind? Compiling with another editor, do you think I can fix this problem?

I'm sorry but I not so sure if I understood what you said. Should I put this (SHOOT_EFFECT_PRISMATICARROW = 0x30, //42 0x30 = 48, 0x2A = 42) in my constant.h?
0x30 is not 42
0x30 is 48 (that is why you get debug)
0x2A is 42 use this instead


same for other values bellow, you need to use the hex value, not dec
OP
OP
B

Bigato

New Member
Joined
Feb 11, 2020
Messages
9
Reaction score
0
You need to add that effect in the client as well.
Thanks for you answer.
As I said, I've add the missiles (shoottypes) on my client with object builder and have compiled. When I overwrite a sprite, for example, the last missile cake (id 42) with the new sprite, it works. But when I creat a brandnew (id: 43 or more) doesn't work. The client crash when I try to atack with the new shoottype. That is my problem. And I just use 46 missiles and didn't change the effects (70).
 
Last edited:

kay

Legendary OT User
Joined
Apr 23, 2013
Messages
913
Solutions
9
Reaction score
1,251
Location
32316,31942,7
YouTube
TibiantisOnline
Thanks for you answer.
As I said, I've add the missiles (shoottypes) on my client with object builder and have compiled. When I overwrite a sprite, for example, the last missile cake (id 42) with the new sprite, it works. But when I creat a brandnew (id: 43 or more) doesn't work. The client crash when I try to atack with the new shoottype. That is my problem. And I just use 46 missiles and didn't change the effects (70).

I only read about sprites. You need to be more specific as to how you're adding the new missile in your Tibia.dat. Dat signature contains info about numbers of each type (items, creatures, effects, missiles), does that match?
The issue is apparently with your .dat, you could also include error log from your client (assuming it's cipsoft client).
 
OP
OP
B

Bigato

New Member
Joined
Feb 11, 2020
Messages
9
Reaction score
0
I only read about sprites. You need to be more specific as to how you're adding the new missile in your Tibia.dat. Dat signature contains info about numbers of each type (items, creatures, effects, missiles), does that match?
The issue is apparently with your .dat, you could also include error log from your client (assuming it's cipsoft client).
Let me explain to you. I've opened the tibia.dat and tibia.spr with object builder. I've duplicated some missile effect, like cake for example, and I've replaced the sprites for the new one and compiled. When I open the server there is no error in the distro and when I execute the command /x 43 I can see the new missile effect, but when I attack with the new weapon (the one who has the new shootype) the client crash.

As I said, I've compiled the sources, I've compiled the sprites and missile effects in the client, the command /x works with the new effect, but when I atack a creature with the new weapon the client crash.
 

Attachments

kay

Legendary OT User
Joined
Apr 23, 2013
Messages
913
Solutions
9
Reaction score
1,251
Location
32316,31942,7
YouTube
TibiantisOnline
The log clearly says you're going out of range, so either the range was not expanded properly when you added new missiles, or you're sending invalid one from the server.

I don't use object builder, so I don't know if it supports adding new effects, missiles etc., but you can open your tibia.dat in any hex editor, and check the first bytes of the file. It should start with: signature (4 bytes), number of items (2 bytes), number of creatures (2 bytes), number of effects (2 bytes) and number of missiles (2 bytes). Check them all to make sure all ranges are correct here.

After that I'd also verify what exactly you're sending to the client (what missile number).

From that error log it looks like the client was aware of the new number of missiles (46), but it has received invalid one (49)? That's what I think it says: effect=2 (which is 'poof' effect, so I assume that shot was a miss) and type=49 which would be invalid missile animation.
 
Last edited:

fabian766

Veteran OT User
Joined
Apr 22, 2008
Messages
128
Solutions
21
Reaction score
335
Location
Poland
From that error log it looks like the client was aware of the new number of missiles (46), but it has received invalid one (49)? That's what I think it says: effect=2 (which is 'poof' effect, so I assume that shot was a miss) and type=49 which would be invalid missile animation.

EffectNumber = 2 means that it is missile because old cipsoft client holds every effects in one table so it needs index for those things.
1 - effect, 2 - missile, 3 - text animation

ps.
SHOOT_EFFECT_PRISMATICARROW = 0x30, //42
0x30 = 48, 0x2A = 42
 

kay

Legendary OT User
Joined
Apr 23, 2013
Messages
913
Solutions
9
Reaction score
1,251
Location
32316,31942,7
YouTube
TibiantisOnline
EffectNumber = 2 means that it is missile because old cipsoft client holds every effects in one table so it needs index for those things.
1 - effect, 2 - missile, 3 - text animation

That makes sense. So yea, he sends missile number 49 (out of range) as I said. Invalid dec to hex calc.
 
OP
OP
B

Bigato

New Member
Joined
Feb 11, 2020
Messages
9
Reaction score
0
Thanks for the answers guys.
The log clearly says you're going out of range, so either the range was not expanded properly when you added new missiles, or you're sending invalid one from the server.

I don't use object builder, so I don't know if it supports adding new effects, missiles etc., but you can open your tibia.dat in any hex editor, and check the first bytes of the file. It should start with: signature (4 bytes), number of items (2 bytes), number of creatures (2 bytes), number of effects (2 bytes) and number of missiles (2 bytes). Check them all to make sure all ranges are correct here.

After that I'd also verify what exactly you're sending to the client (what missile number).

From that error log it looks like the client was aware of the new number of missiles (46), but it has received invalid one (49)? That's what I think it says: effect=2 (which is 'poof' effect, so I assume that shot was a miss) and type=49 which would be invalid missile animation.
So, you suggest that I must compile the data with another editor. Do you have someone in mind? Compiling with another editor, do you think I can fix this problem?
EffectNumber = 2 means that it is missile because old cipsoft client holds every effects in one table so it needs index for those things.
1 - effect, 2 - missile, 3 - text animation

ps.
SHOOT_EFFECT_PRISMATICARROW = 0x30, //42
0x30 = 48, 0x2A = 42
I'm sorry but I not so sure if I understood what you said. Should I put this (SHOOT_EFFECT_PRISMATICARROW = 0x30, //42 0x30 = 48, 0x2A = 42) in my constant.h?

I attached a image of the command /x 42. It works, but when I use the weapo, doesn't. Crash the server.
 

Attachments

Last edited:

Evil Puncker

prolonged absenteeism
TFS Developer
Joined
May 30, 2009
Messages
8,041
Solutions
215
Reaction score
3,881
Thanks for the answers guys.

So, you suggest that I must compile the data with another editor. Do you have someone in mind? Compiling with another editor, do you think I can fix this problem?

I'm sorry but I not so sure if I understood what you said. Should I put this (SHOOT_EFFECT_PRISMATICARROW = 0x30, //42 0x30 = 48, 0x2A = 42) in my constant.h?
0x30 is not 42
0x30 is 48 (that is why you get debug)
0x2A is 42 use this instead


same for other values bellow, you need to use the hex value, not dec
 
Solution
OP
OP
B

Bigato

New Member
Joined
Feb 11, 2020
Messages
9
Reaction score
0
Guys it works perfectly. Thank you very much. I've changed the constant.h as Evil Puncker and fabian766 said. Thank you all
EffectNumber = 2 means that it is missile because old cipsoft client holds every effects in one table so it needs index for those things.
1 - effect, 2 - missile, 3 - text animation

ps.
SHOOT_EFFECT_PRISMATICARROW = 0x30, //42
0x30 = 48, 0x2A = 42

.
0x30 is not 42
0x30 is 48 (that is why you get debug)
0x2A is 42 use this instead


same for other values bellow, you need to use the hex value, not dec
 
Top