• 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.X] Pet System - Scripters, I challange you to make it together!

Eldin

Eldin Projects
Premium User
Joined
Jun 12, 2008
Messages
1,334
Reaction score
613
Location
Sweden
Greets!

Open Tibia is all about Custom Projects in my oppinion, alot of cool things can be done but the most of us, the deadly people, can't manage to create it. The best scripts never get created or can only be gained by buying them. I believe that some servers never get created or gets as good as they can be simply because the lack of knowledge. I do agree that the most people are lazy but all of us aren't, take me as for example, I do have more or less knowledge here and there about open tibia but im not an advanced scripter, its not my call and time is not enough to learn right now.

Instead of hoping that one scripter will create one huge script or system and then another one create another, I now challange you guys for a first task and start somewhere to work together!
OpenTibia needs you, without you, no cool custom things would be seen. You are often in the "background" but yet so important if not one of the most important roles!

A Pet System has been requested loads of times and most of us can't manage to create it.
The one that seem to be one of the "better" is as old as 2008:
http://otland.net/threads/many-my-fully-lua-pet-system-many-features.3432/

What is a Pet System for me?
*Its a Creature you can Catch or/and Buy.
*You can have 1 at a time (or set amount in a config)
*The Pet has X HP from start and may gain lvl that will result in X more HP per lvl, max lvl can be set.
*Pet has Spells like any monster or player and will be automaticly learned at a new lvl.
*It has mana and regain to use its spells or simply randomize like monsters.
*It gains exp like a player and gain its level that way.
*Unless it spawns during login (if you have one), you can simply call it with a TalkAction or Item.
*If Pet Dies, it can be brought to Life for a fee or free at an NPC. (or whatever)
*The Pet will "evolve" after X lvl to get a new outfit and better damage/more HP.

I believe its important to make it without source edit to make the "installation" as easy as possible.
The Pet system can be done and I know that it exists already, the Community needs a free one even if its more of a basic one, maybe the one in the link could be start and get updated?

You scripters could manage this in a couple of days, a week tops if you did it together, one after another putting some working parts in and do what you do best!
I am pretty sure that you could start a more advanced scripting "service" where people can request cool ideas and you make it together, imagine all the things that could be done.

If I missed any Pet System that works, simply slap it in my face. ;)
Thanks in advance and thank you for atleast taking your time and read this.

Kind Regards,
Eldin.

@Limos @Ninja @Printer @Summ @Dalkon @Znote and you others to name a few... We love you guys, thank you for everything that you have done so far!
 
Its a pokemon like pet :p

Its hard to do in my opinion without making sources edits in TFS 1.0. I mean, without storage saving strings or custom properties on Items, how the hell i would save the pet data? Database? No good option.
 
the biggest issue facing this kind of feature in TFS 1.0 is the lack of creature storage to save creature data to the creature itself, once we found a solution for it, it will only be a matter of time before an advanced pet system like this becomes a real thing :)

PS: i am researching a way for lua script to read and save data in a txt or xml file, if it exists, then consider the script done already XD
 
the biggest issue facing this kind of feature in TFS 1.0 is the lack of creature storage to save creature data to the creature itself, once we found a solution for it, it will only be a matter of time before an advanced pet system like this becomes a real thing :)

PS: i am researching a way for lua script to read and save data in a txt or xml file, if it exists, then consider the script done already XD
Shared lua state -> just use a table for the creature data you wanna store.
 
Shared lua state -> just use a table for the creature data you wanna store.
This won't stay saved when the server restarts, will it? (since you need to initialize the lua state)
 
If you had monster storages those would not be saved either, so you have to use player storages.
 
If you had monster storages those would not be saved either, so you have to use player storages.
oh yea.. that is indeed true. how to perma-store creature data? globalstorage is not in the database anymore in TFS 1.0 which is a bummer.
 
Why not store the pet information in the description of the item that summon it?
 
Why not store the pet information in the description of the item that summon it?
That's a good idea as long as the client doesn't debug because the item description became too long (could be fixed by creating a custom "look" text for that specific item)
 
Well, it does not need too much information. Just level, hp/hpmax, mana/manamax.
 
How would you like to call your pet? Command?

vetFQz4A.png


ae2O-LnE.gif
 
Last edited:
I wouldn't say so, I'm currently working on a very efficient save/load system for the pets in lua files
it'll create a new folder called "pets" and for each player who ownes a pet (or more) it'll create a lua file with the name of the master

this is how it'll be saved:
pet.png

this is just a rough scheme, things like looktype and monster type are missing but that's how it is saved.
 
I wouldn't say so, I'm currently working on a very efficient save/load system for the pets in lua files
it'll create a new folder called "pets" and for each player who ownes a pet (or more) it'll create a lua file with the name of the master

this is how it'll be saved:
pet.png

this is just a rough scheme, things like looktype and monster type are missing but that's how it is saved.
Ohhhh this is genius :D
 
Code:
function table.serialize(t, depth)
    local depth = depth or 0
    local ret, first = '{\n', true
    for k, v in pairs(t) do
        if not first then
            ret = ret .. ',\n'            
        end

        ret = ret .. ('  '):rep(depth + 1)
       
        if type(k) == 'number' then
            ret = ret .. '[' .. k .. '] = '
        elseif type(k) == 'string' then
            ret = ret .. '["' .. tostring(k):gsub('"', '\\"') .. '"] = '
        else
            error('Unhandled key type')
        end

        if type(v) == 'number' then
            ret = ret .. v
        elseif type(v) == 'string' then
            ret = ret .. v:gsub('"', '\\"')
        elseif type(v) == 'table' then
            ret = ret .. table.serialize(v, depth + 1)
        elseif type(v) == 'boolean' or type(v) == 'nil' then
            ret = ret .. (v == true and 'true' or v == false and 'false' or 'nil')
        else
            error('Unhandled value type')
        end
        first = false
    end
    ret = ret .. '\n' .. ('  '):rep(depth) .. '}'
   
    return ret
end

function table.unserialize(str)
    return loadstring('return ' .. str)() 
end

In case you wanna save your globalstorages or another table.
 
Saving whole tables is really really good. The bad thing is performance.
 
I blinked my eyes again while a smile rise upon my face, this is the Open-Tibia Community that we all would like to see, the Community we all love. <3
Evil Hero took the time and we started out via Skype to form the new Pet System in lua as people at first said it was hard, here we are now, with a growing thread of great scripters, comments and ideas.

Whatever happens from here, I thank you all already, this means the World to me personaly and should show OTland that we have hope and can do loads together.
Well... I need Another drink... :,)

Kind Regards,
Eldin.
 
Back
Top