• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Compiling Adding new spell effects source tfs 1.3

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
919
Location
Chile
Hello guys, i have many custom spell effects, and i was wondering how to use them in game? so i now know i need to register them in sources, i just did. i registered all in const.h, but i read somewhere i also need to "change the numbers" in protocolgame.cpp? im asking here because i cant find anything to edit there...

is there anything else i need to edit? before compiling and be able to use these new effects? also, command !z only reaches to 250-260, don't know exactly, will that be a problem when i try to implement spell effects that are of higher number than that?

Thanks!
 

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,639
Solutions
559
Reaction score
3,898
just search for some magic effect and look everywhere it's registered, especially in tools.cpp (obviously you can ignore when a magic effect is used by sendMagicEffect in sources)
for example: Search · CONST_ME_YALAHARIGHOST · GitHub
just follow the files in c++ and add your magic effect in those files, and it should work
as for the command you have to change the talkaction to support the number you put your effect as in const.h
 
OP
OP
Thorn

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
919
Location
Chile
just search for some magic effect and look everywhere it's registered, especially in tools.cpp (obviously you can ignore when a magic effect is used by sendMagicEffect in sources)
for example: Search · CONST_ME_YALAHARIGHOST · GitHub
just follow the files in c++ and add your magic effect in those files, and it should work
as for the command you have to change the talkaction to support the number you put your effect as in const.h
i added the spells in both files and i got this error :S
8a88ce5e78ff9ed2200f52626c6e59be.png
 

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,639
Solutions
559
Reaction score
3,898
Solution
OP
OP
Thorn

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
919
Location
Chile
actually im doing this because i want to have spells with the custom animations, but a friend told me this is not necesary, that if i put the number instead of the name should work, but it doesn't, it just cast a tibia spell effect, do you know why? (not in the !z talkaction, in the spell)
 

jestem pro

That is the question
Joined
Apr 20, 2013
Messages
646
Solutions
14
Reaction score
85
Just add them to the .spr/.dat file and eventually change the range of effects in the talkaction script related to effects. This should work.

going with your problem maybe add them to lib (8.6)/ global.lua(1.×)
 

tekadon2

Member
Joined
Jun 18, 2016
Messages
66
Reaction score
11
I'm having the same problem, I've done all the modifications but the spells only show effects until 255.
The! Z command uses the command to the maximum.
 

chrallaz

Member
Joined
Jan 1, 2022
Messages
36
Reaction score
21
I know this is an old thread.
I followed @Infernum 's guide on this "EVEN THO" I'm using OTServBR
Everything executes correctly in MSVC 2022 but!!! Its not showing my effect 256 or 257 I added above.

I know probably for me const.h is utils_definitions.hpp since its were I can find.
enum MagicEffectClasses : uint8_t {
which I changed to
enum MagicEffectClasses : uint16_t {


Then I followed
Which all lines up correctly. Just differences in which "lines".


!!!! But here is where I think my problem occurs.

I cannot seem to find exactly were to change these lines for OTServBR
Because I check these lines and they look already pretty much the same as TFS
Does anyone wanna help me out? <3


So I was guessing around but I can't compile this.


1654512383816.png
1654512510576.png
 
Last edited:

amatria

Well-Known Member
Joined
May 15, 2021
Messages
63
Solutions
5
Reaction score
67
Location
Spain
GitHub
amatria
Last edited:

chrallaz

Member
Joined
Jan 1, 2022
Messages
36
Reaction score
21
This is pure speculation, but if you are now using a uint16_t type for the effectId, these lines should change
to
C++:
msg.addByte(type >> 8);
msg.addByte(type);
!! Disclaimer: Not tested. This change may debug your client.
I Will try it later on. Thanks for checking mano ❤️
I'll get back asap with an answer.
Post automatically merged:

This is pure speculation, but if you are now using a uint16_t type for the effectId, these lines should change
to
C++:
msg.add<uint16_t>(type);
!! Disclaimer: Not tested. This change may debug your client.
Alright yes your correct, with OTC I can login now but its some what buggy.
With Normal Client it crasches instantly now.

How would I approach this issue with OTC client?
 
Last edited:

amatria

Well-Known Member
Joined
May 15, 2021
Messages
63
Solutions
5
Reaction score
67
Location
Spain
GitHub
amatria
What do you mean by "somewhat buggy"? Are you able to see the new effects? Or, for instance, are you seeing only a small subset of all the available effects?

How would I approach this issue with OTC client?
I would start my research here:
As you can see, after it parses the position, it extracts a uint8_t value from the InputMessagePtr.

Now that you send 2 bytes of information from your server, all those lines should be reading exactly 2 bytes of information.
e.g.

Afterwards, follow the flow of the program and find all the functions that consume the 2 bytes long effectId and change the datatype to uint16_t. And so on and so forth. Best of luck, this is kind of a tedious process. However, isn't there a thread here in OTLand that implements this same functionality?
 
Top