• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[TFS 1.2] Pet system

Sorry for reviving the post, but how can you identify if the player has a pet? through storage? since if I use the #player:getSummons() function > 0 for example, it detects the pet only when it is invoked

Take a look at default config section.
And try to analyze code :)

LUA:
    STORAGE = {
        TYPE = 10000,
        UID = 10001,
        LOSTHEALTH = 10002,
        MAXHEALTH = 10003,
        EXPERIENCE = 10004,
        LEVEL = 10005
    },
 
Take a look at default config section.
And try to analyze code :)

LUA:
    STORAGE = {
        TYPE = 10000,
        UID = 10001,
        LOSTHEALTH = 10002,
        MAXHEALTH = 10003,
        EXPERIENCE = 10004,
        LEVEL = 10005
    },
Yes, now I have read more or less the code, in fact I have tried to add more pets (it works 50%) but I have some problems with that when evolving among other things.

thanks for responding anyway
 
This is a problem when a logo with a player is not ADM and this error appears.

LUA:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/2024/pet/pet_owner_creaturescripts.lua:onLogout
LuaScriptInterface::getNumber(). Argument 2 has out-of-range value for unsigned int: -1
stack traceback:
        [C]: in function 'Creature'
        data/lib/pets_lib.lua:290: in function <data/lib/pets_lib.lua:288>


And another thing, I didn't understand how to capture, I installed that item capture system, but whenever I try to catch a monster it says 'You may only capture your own pet', well from what I saw it's only by summoning, but I wanted to exchange it to catch any monster on the map as long as it has the name in the pet_lib file.
 
This is a problem when a logo with a player is not ADM and this error appears.

LUA:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/2024/pet/pet_owner_creaturescripts.lua:onLogout
LuaScriptInterface::getNumber(). Argument 2 has out-of-range value for unsigned int: -1
stack traceback:
        [C]: in function 'Creature'
        data/lib/pets_lib.lua:290: in function <data/lib/pets_lib.lua:288>


And another thing, I didn't understand how to capture, I installed that item capture system, but whenever I try to catch a monster it says 'You may only capture your own pet', well from what I saw it's only by summoning, but I wanted to exchange it to catch any monster on the map as long as it has the name in the pet_lib file.

It was tested on TFS 1.2
Which version You use?
 
Probably Creature interface changed.
Creature(-1) throw exception.

I'm a bit of a noob in this part, what should I do?
 
I'm a bit of a noob in this part, what should I do?

I don't have TFS 1.4 installation and right now I don't plan to make any server.

If You can describe it with more details I will try help.
Keep in mind I don't have tons of time. So I'll check otland once per day.

Bug appear onLogin?
Player don't have any pet?
You don't use same storage Id in other scripts?
 
Back
Top