• 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 1.2] Pet system

Try as regular player.

tried as a normal player several times, pet died and then never came back, revived it and now "your pet if offline".

Just some information that might be useful, when I try to heal the "offline" pet, it gives this error in console:

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/pet_heal.lua:eek:nSay
data/talkactions/scripts/pet_heal.lua:29: attempt to index local 'pet' (a nil va
lue)
stack traceback:
[C]: in function '__index'
data/talkactions/scripts/pet_heal.lua:29: in function <data/talkactions/
scripts/pet_heal.lua:1>

This would not be a very big issue if the player didn't take some time to level up the pet, as he would release and catch another one, but since it takes time to evolve, this would not be good (imagining the complaints)
 
I believe that a talkaction like !callpet would solve this issue, as the pet still exists, I don't know why it happens...

edit: I did some digging into the mysql database > players storage
Found the source of the problem, but not whats causing it and why in only happens in random ocasions.

The problem lies within the PetUid storage value, I think it's suposed to be 0, and it was 1073741824.

When I force edited the storage key 10001 in the database to "0" and relloged the character, the pet came back!
I might have found the problem, but I have no idea as to how to fix it.
 
Last edited:
So as I was saying, I believe that some event (petdeath e.g) is causing the storagevalue to be altered outside the parameters 0 -1 -2. Could make a function on login to check if petUid is different from 0 -1 and -2 and if so, change it back to 0, what do you think hellboy?

Since all problematic storage values where positive values, I've put this on login.lua, please see if it's correct:

for w = 10001, 10001 do --pet uid storage
if player:getStorageValue(10001) > 0 then
player:setStorageValue(w, 0)
end
end
 
Last edited:
So as I was saying, I believe that some event (petdeath e.g) is causing the storagevalue to be altered outside the parameters 0 -1 -2. Could make a function on login to check if petUid is different from 0 -1 and -2 and if so, change it back to 0, what do you think hellboy?

Since all problematic storage values where positive values, I've put this on login.lua, please see if it's correct:

for w = 10001, 10001 do --pet uid storage
if player:getStorageValue(10001) > 0 then
player:setStorageValue(w, 0)
end
end

Thanks for diging and find problem. I have too take a look one more time to my code and fix it.
Pet uid storage is set to value higer than 2, when is online, it's creature uid used by scripts to manage pet (set health, maxhealt, etc.).
Propably there is issue in pet death script or TFS crashed, when pet was online.

I'll try to fix it at weekend.
 
Thanks for diging and find problem. I have too take a look one more time to my code and fix it.
Pet uid storage is set to value higer than 2, when is online, it's creature uid used by scripts to manage pet (set health, maxhealt, etc.).
Propably there is issue in pet death script or TFS crashed, when pet was online.

I'll try to fix it at weekend.

Thanks hellboy! For now the quick fix seems to be working, everytime the character relog, if by some crash the uid remained altered when offline, the server sets it back to "0". No more problems so far.
In time, how are you in the "!pettransfer" command, it's a very nice feature to have.
 
Thanks hellboy! For now the quick fix seems to be working, everytime the character relog, if by some crash the uid remained altered when offline, the server sets it back to "0". No more problems so far.
In time, how are you in the "!pettransfer" command, it's a very nice feature to have.

Hmm... I can try create this command. It shouldn't be hard to implement.
I'll do it at weekend with online fix.

BTW You create your own OTS or only experiment with new scripts? I would be glad to see OTS with this script. :)
 
Hmm... I can try create this command. It shouldn't be hard to implement.
I'll do it at weekend with online fix.

BTW You create your own OTS or only experiment with new scripts? I would be glad to see OTS with this script. :)

I'm currently working a project called pridexia, I used to have an ots called PRIDEX around 2011 with 400+ online playerbase but had to close it due to my studies.
This server, just as the other one, was is based on new ideas, for instance, I used to have mounts before tibia implemented them.

I'm aiming at a small player database, custom map, heavy RPG(reading books and talking to custom npcs, old style), no item drops from monsters (only recipes for crafting and quests), no npc's as item and potion sellers, everything has to be crafted by collecting resources and traded with other players.
The project also has aditional systems like the possibility for master chemists to craft a revival item that rises players from death, *pets*, mounts, regular outfit addons and magical stones to enchant items with special skills and atributes..
 
I can't reproduce issue but I added simple fix in data/chatchannels/scripts/pet.lua (Take a look at first post)
I'm not quite sure, but it can be caused by another data type of storage (int32_t) and creature id (uint32_t)?
Max int32 number is 2147483647, max uint32 is 4294967295.
 
I can't reproduce issue but I added simple fix in data/chatchannels/scripts/pet.lua (Take a look at first post)
I'm not quite sure, but it can be caused by another data type of storage (int32_t) and creature id (uint32_t)?
Max int32 number is 2147483647, max uint32 is 4294967295.

Nice hellboy, I've seen what you did, but still, does that requires the player to use a command to reset the pet uid?

Edit: nvm, you used onJoin function so no need for a command. The player login fix also does the job.
 
i have this error im use TFS1.2 client 10.90
s7ee1vM.png


and this
4BhAjt-.png


i have this problem but i already have added the pet libs
 
Back
Top