• 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

nice to see ppl still uses my system :D

btw im reworking it, much more advanced with otclient.
soon ill showoff,
thx for keeping it alive
 
nice to see ppl still uses my system :D

btw im reworking it, much more advanced with otclient.
soon ill showoff,
thx for keeping it alive

As I remember, I fixed few bugs in oryginal script and post it in otfans (nickname yrpen) :)

BTW. I need too change first post. (I added pet-mounts option) but someone blocked edit option in posts, so I can't fix description :/
 
I have problem with :

talkactions/scripts/pet_heal.lua:
Lua:
        local soulNeded = PETS.CONFIG.healSoulBase + lostHealth * PETS.CONFIG.healSoulCost

on console i see:
Code:
lua script error : [ Talkaction Interface ]
data/talkactions/scripts/pet_heal.lua: onSay
data/talkactions/scripts/pet_heal.lua:30: attemp to perform arthmetic on field 'healSoulCost' <a nil value> stack tracebac:
[c]: in function '__mul'
data/talkactions/scripts/pet_heal.lua:30: in function <data/talkactions/scripts/pet_heal.lua:1>

other talkaction work but not this ;)
 
just add on config:

Code:
healSoulCost = XX,
healSoulBase = YY

But the code is still quite bugged.
 
-Pets sometimes doesnt get any exp, even it he kills the monster alone.
-Even when it says that it gets 6exp for exemple, you look at him or !petinfo, the exp didnt change at all.
-When it teleports close to you, it can teleport into PZ. When it does, it bugs and you are able to call the same pet, twice. (If you enter PZ or go somewhere the pet cant tp or enter, pet should despawn)

Also, this isnt a bug, but its a flaw. If you are lvl 200 for exemple and get a cat or a dog, pets needs to deal damage to monster to get exp. If you go hunt low lvl creatures, you oneshot them and pet gets 0 damage done, if you go hunt high lvl creatures, cat nor dog will damage them even if they tried. So earned exp should be a portion of players exp, monsters killed, or whatever without having to deal damage.

And for now its all. I did fix some things, tho i dont remember what xD

Btw, you cant download the files from git and u need to copy them one by one, which is so fcking tedious :p!

Anyway, its a fun script, and really well done, so thanks for it and your time.
 
-Pets sometimes doesnt get any exp, even it he kills the monster alone.
-Even when it says that it gets 6exp for exemple, you look at him or !petinfo, the exp didnt change at all.
-When it teleports close to you, it can teleport into PZ. When it does, it bugs and you are able to call the same pet, twice. (If you enter PZ or go somewhere the pet cant tp or enter, pet should despawn)

Also, this isnt a bug, but its a flaw. If you are lvl 200 for exemple and get a cat or a dog, pets needs to deal damage to monster to get exp. If you go hunt low lvl creatures, you oneshot them and pet gets 0 damage done, if you go hunt high lvl creatures, cat nor dog will damage them even if they tried. So earned exp should be a portion of players exp, monsters killed, or whatever without having to deal damage.

And for now its all. I did fix some things, tho i dont remember what xD

Btw, you cant download the files from git and u need to copy them one by one, which is so fcking tedious :p!

Anyway, its a fun script, and really well done, so thanks for it and your time.

1. Thanks for report!
2. I'll try fix exp gain by pet using some math and creature:getDamageMap() Lua - onGainExperience for summons
3. I'll fix PZ teleport
4. Get some of player exp, is a nice feature. Thanks for posting. I'll try too implement this.
5. Download:
Code:
git clone https://github.com/yrpen/lua-scripts.git
or https://github.com/yrpen/lua-scripts/archive/master.zip
 
-Pets sometimes doesnt get any exp, even it he kills the monster alone.
-Even when it says that it gets 6exp for exemple, you look at him or !petinfo, the exp didnt change at all.
-When it teleports close to you, it can teleport into PZ. When it does, it bugs and you are able to call the same pet, twice. (If you enter PZ or go somewhere the pet cant tp or enter, pet should despawn)

Also, this isnt a bug, but its a flaw. If you are lvl 200 for exemple and get a cat or a dog, pets needs to deal damage to monster to get exp. If you go hunt low lvl creatures, you oneshot them and pet gets 0 damage done, if you go hunt high lvl creatures, cat nor dog will damage them even if they tried. So earned exp should be a portion of players exp, monsters killed, or whatever without having to deal damage.

And for now its all. I did fix some things, tho i dont remember what xD

Btw, you cant download the files from git and u need to copy them one by one, which is so fcking tedious :p!

Anyway, its a fun script, and really well done, so thanks for it and your time.

Try download it now and test problem with PZ and house tiles. Also you can try use experimental player-pet exp sharing.
Changes to do:
Commits · yrpen/lua-scripts · GitHub
 
@hellboy Okay! I've been doing some texting with fix.

-Exp seems to work fine now but he needs to keep doing damage to the monster, otherwise, 0 exp. A lion will never hurt a dragon for exemple, by the time i kill the dragon, the lion did 0 damage, and get 0 exp.
-PZ fixed. But i found another way to duplicate the pet. You have your pet out, you are out of combat, and relog on same character. The pet is "a lion" instead of "your pet", you close the pet channel, he doesnt dissapear, open the pet channel and you get your "real" pet, and now you have 2 pets. So im guessing "pet dismiss onlogout" is needed here.
-github fixed. (I dont really mind since i know what i do, but you changed file names, and unexperienced people will complain when they try to add files and they dont work >.< for exemple pet_channels.lua it was pet.lua)

Many people said it. Opening and closing tab everytime to summon/unsummon your pet is anoying as fck :), a commands should be totally done.

Thanks for the fast fix and work. I will keep posting if i solve anything or find something.
 
for some reason i cant edit my post, so writting it here.

Maybe i did wrong, but i used this part:

Code:
if PETS and PETS.SYSTEM.PLAYER_SHARE_EXPERIENCE and self:getPetUid() > 0 and source and source:isMonster() then
    local pet_exp = exp * PETS.CONFIG.shareExpMultipler
    self:addPetExp(pet_exp)
  end

at events/player.lua (I dont know if you wanted to use it somewhere else).

Also i've set this part to true
Code:
PLAYER_SHARE_EXPERIENCE = false
This part is supposed to give "playersExp * 0.3" at all times, even if the creature didnt attack. Ill do more testing!
 
Okey. Fixed everything.

First of all the exp works. Only that the exp number doesnt show up above the pet. (and yeah, it goes on event/players.lua)

The duplicated pet problem was solved simply by creating the commands !petcall and !petdismiss, instead of doing it through the channel.

Right now, it works 100%, no flaws, no problems so far.
 
I've been trying to modify this part:
Code:
function getExpNeeded(level)
    return ( (50 *level^3) -(150 *level^2) +(400 *level) )/3 *PETS.CONFIG.expMultipler
    end
but as i guessed, level is player level, and it should be petlevel. (Just imagine if player is level 1000 :'} )
when i try to modify this part i get tons of errors >.<!
 
nvm.. changing level for petlevel working perfectly -.- xD
 
I've been testing so only PETS_ can attack PETS_ with something like this:
../events/creature.lua
Code:
if self:isPlayer and target:isMonster() then
    local master = self:getMaster()
    local targetmaster = target:getMaster()
    if target:isSummon() and target:getSummonName() == cat then
    if master and master:isPlayer() and targetmaster and targetMaster:isPlayer() then
    return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE
    end
    end
end

Is there a function i can use like:

Code:
if target:isPet then

I wouldnt like having to write all pet names, lol
 
I hate this multiposting.. edit would be easier LoL!

Found a bug. Every time your pet gains a level it adds some extrahp.. if the pet dies before you "dismiss" it, the pethp goes back to basic hp.
 
I hate this multiposting.. edit would be easier LoL!

Found a bug. Every time your pet gains a level it adds some extrahp.. if the pet dies before you "dismiss" it, the pethp goes back to basic hp.

1. Thanks for testing!
2. I'll try fix some bugs at saturday/sunday
 
@hellboy
-PZ fixed. But i found another way to duplicate the pet. You have your pet out, you are out of combat, and relog on same character. The pet is "a lion" instead of "your pet", you close the pet channel, he doesnt dissapear, open the pet channel and you get your "real" pet, and now you have 2 pets. So im guessing "pet dismiss onlogout" is needed here.
[...]

Many people said it. Opening and closing tab everytime to summon/unsummon your pet is anoying as fck :), a commands should be totally done.

[...]

- I'll try fix it. onLogout dismiss already exists.
- I'll add those commands if most of players like it more than channel stuff

[...]
First of all the exp works. Only that the exp number doesnt show up above the pet. (and yeah, it goes on event/players.lua)

The duplicated pet problem was solved simply by creating the commands !petcall and !petdismiss, instead of doing it through the channel.
[...]

- I can try add experience in pet channel and above pet
- It's not solution, it's workaround

I've been trying to modify this part:
Code:
function getExpNeeded(level)
    return ( (50 *level^3) -(150 *level^2) +(400 *level) )/3 *PETS.CONFIG.expMultipler
    end
but as i guessed, level is player level, and it should be petlevel. (Just imagine if player is level 1000 :'} )
when i try to modify this part i get tons of errors >.<!

This function is out of any metatable. It only calculate experience needed too next level. It don't depend on player or pet.

I've been testing so only PETS_ can attack PETS_ with something like this:
../events/creature.lua
[...]
Is there a function i can use like:

Code:
if target:isPet then

[...]

- :isPet() method added
- set to true DUELS_ONLY in pets_lib and use creature_on_target_combat.lua. Test this new feature :)

[...]
Found a bug. Every time your pet gains a level it adds some extrahp.. if the pet dies before you "dismiss" it, the pethp goes back to basic hp.

- Propably fixed
 
exp on death fixed correctly.
DUELS_ONLY working, but not correcly. I did like this.
Code:
if PETS and PETS.SYSTEM.DUELS_ONLY then
        if self:isPet() and target:isPlayer() or target:isPet() and self:isPlayer() or self:isMonster() and target:isPet() then
            return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE
        end
end
This makes the pet ONLY attackable by other pets, BUT monsters keep targeting the pet, so its inmune and it can tank forever.. (i made this because a demon with big aoe for exemple was killing my pets all the time), any way to make pets untargeteable by monsters? (i thought RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE was doing exactly that). Also pets attack what players attack, if a player cant attack pets, pet vs pet is not possible.
 
I tried to use something like this instead:
I used this creaturescript and set it to cats.
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
       
        if attacker and attacker:isPlayer()  and (origin == ORIGIN_MELEE) or (origin == ORIGIN_MELEE) or (origin == ORIGIN_MELEE) then
            return 0, primaryType, 0, secondaryType
        end
       
            return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Now even if player attacks pet, no damage is done. Problem is, for some reason, pets doesnt do any damage to pets either. :/
 
I tried to use something like this instead:
I used this creaturescript and set it to cats.
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
       
        if attacker and attacker:isPlayer()  and (origin == ORIGIN_MELEE) or (origin == ORIGIN_MELEE) or (origin == ORIGIN_MELEE) then
            return 0, primaryType, 0, secondaryType
        end
       
            return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Now even if player attacks pet, no damage is done. Problem is, for some reason, pets doesnt do any damage to pets either. :/

- I'll try fix it tomorrow.
- I can't reproduce relog bug (using OTClient on Ubuntu)
 
Back
Top