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

Compiling Magic effect limit

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Solutions
6
Reaction score
29
HI all


I have a problem with magic effects which I added to server source(tfs0.3.6).
When effect number 255 is used then client crash when 256 is used this give effect number 1.
Is there any solution for this problem? Maybe this isn't a client limitation because WoDBO uses 276 effects
and i found something like this in tools.cpp
[cpp]

struct MagicEffectNames
{
const char* name;
MagicEffect_t magicEffect;
};
[/cpp]
maybe this is limitation

Thanks
destroyer
 
The highest number you can reach with hexadecimal values is 255.
I don't think you can go any higher than that without client and source modifications.

But don't rely 100% on me, I'm just saying what I think is the problem.
 
I tested devland server(clean devland not wodbo) using wodbo client and this was same as tfs and 8.54 tibia(crash)
and i still think is fault of char in code which i showed

so if this is fault of client then dbv wodbo etc are own written clients?
 
Post your talkactions/magiceffect.lua...

EDIT: I don't think you need all of those effects so just put a limit inside magiceffect.lua, then it will appear a message when you do unwanted effects.
 
Last edited:
@Vightrain
That's silly

Nah it is simple.
Server is using uint8_t for the magic effect. That means values from 0 - 255 are supported.
0xFF (255) is used internally by the server.
You have to change the value of magic effect to uint16_t which gives you the possiblity to use more effects than you will ever need. You also need to adjust the parameters of the effect send function and the part where the effect id is added to the message packet (protocolgame.cpp).

However the the client limitation comes.
The client will try to get a byte out of the packet, however you are sending it in uint16_t, so it will most likely crash
=> Solution: Use Otclient and edit the client side.
 
Lua:
function onSay(cid, words, param, channel)
	param = tonumber(param)
	if(not param or param < 0 or param > CONST_ME_LAST) then
		doPlayerSendCancel(cid, "Numeric param may not be lower than 0 and higher than " .. CONST_ME_LAST .. ".")
		return true
	end

	doSendMagicEffect(getCreaturePosition(cid), param)
	return true
end

here you are

- - - Updated - - -

@Vightrain
That's silly

Nah it is simple.
Server is using uint8_t for the magic effect. That means values from 0 - 255 are supported.
0xFF (255) is used internally by the server.
You have to change the value of magic effect to uint16_t which gives you the possiblity to use more effects than you will ever need. You also need to adjust the parameters of the effect send function and the part where the effect id is added to the message packet (protocolgame.cpp).

However the the client limitation comes.
The client will try to get a byte out of the packet, however you are sending it in uint16_t, so it will most likely crash
=> Solution: Use Otclient and edit the client side.

so i must edit protocolgame.cpp and tools.cpp or only protocolgame.cpp?

btw. Thanks for the quick reply
 
@Vightrain
That's silly

Kinda... but if this was a problem in tfs 0.3.6 sources then it would have been spammed on otland.

Crashes are not only caused by the source.. But I assume you have more knowledge than me in this so, Destoyer, litsen to him instead.

 
As Summ said.

About the talkaction it has nothing todo with it. If you use /z 255 <-- client crash, if you use /z 256 it will begin from beginning /z 256 = /z 1.

You can make it on regular tibia client <- but it require knowlegde with ollydbg. Use otclient, its much better todo. Also about source editing that isn't hard todo.
 
Back
Top